ccxt 4.1.58 → 4.1.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/build.sh +2 -2
- package/dist/ccxt.browser.js +1017 -1031
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -19
- package/dist/cjs/src/base/Exchange.js +45 -24
- package/dist/cjs/src/base/ws/Client.js +1 -1
- package/dist/cjs/src/binance.js +71 -22
- package/dist/cjs/src/bitget.js +74 -52
- package/dist/cjs/src/bitmart.js +10 -18
- package/dist/cjs/src/bitrue.js +1 -1
- package/dist/cjs/src/bybit.js +36 -33
- package/dist/cjs/src/coinbasepro.js +15 -0
- package/dist/cjs/src/coinex.js +25 -30
- package/dist/cjs/src/htx.js +82 -39
- package/dist/cjs/src/kucoin.js +209 -163
- package/dist/cjs/src/mexc.js +21 -118
- package/dist/cjs/src/okx.js +23 -17
- package/dist/cjs/src/pro/bitget.js +7 -0
- package/dist/cjs/src/pro/bitmart.js +7 -0
- package/dist/cjs/src/pro/bitvavo.js +9 -0
- package/dist/cjs/src/pro/bybit.js +9 -0
- package/dist/cjs/src/pro/htx.js +86 -61
- package/dist/cjs/src/pro/kucoin.js +7 -0
- package/dist/cjs/src/pro/mexc.js +9 -0
- package/js/ccxt.d.ts +2 -23
- package/js/ccxt.js +2 -16
- package/js/src/abstract/binance.d.ts +1 -0
- package/js/src/abstract/binancecoinm.d.ts +1 -0
- package/js/src/abstract/binanceus.d.ts +1 -0
- package/js/src/abstract/binanceusdm.d.ts +1 -0
- package/js/src/abstract/mexc.d.ts +0 -4
- package/js/src/base/Exchange.d.ts +9 -2
- package/js/src/base/Exchange.js +45 -24
- package/js/src/base/ws/Client.js +1 -1
- package/js/src/binance.d.ts +20 -2
- package/js/src/binance.js +71 -22
- package/js/src/bitget.d.ts +20 -2
- package/js/src/bitget.js +74 -52
- package/js/src/bitmart.d.ts +2 -2
- package/js/src/bitmart.js +10 -18
- package/js/src/bitrue.js +1 -1
- package/js/src/bybit.d.ts +2 -2
- package/js/src/bybit.js +36 -33
- package/js/src/coinbasepro.js +15 -0
- package/js/src/coinex.d.ts +2 -2
- package/js/src/coinex.js +25 -30
- package/js/src/htx.d.ts +5 -3
- package/js/src/htx.js +82 -39
- package/js/src/kucoin.d.ts +20 -2
- package/js/src/kucoin.js +209 -163
- package/js/src/mexc.d.ts +0 -11
- package/js/src/mexc.js +21 -118
- package/js/src/okx.d.ts +19 -2
- package/js/src/okx.js +23 -17
- package/js/src/pro/bitget.js +7 -0
- package/js/src/pro/bitmart.js +7 -0
- package/js/src/pro/bitvavo.js +9 -0
- package/js/src/pro/bybit.js +9 -0
- package/js/src/pro/htx.d.ts +2 -2
- package/js/src/pro/htx.js +86 -61
- package/js/src/pro/kucoin.js +7 -0
- package/js/src/pro/mexc.js +9 -0
- package/package.json +1 -1
- package/skip-tests.json +5 -1
- package/js/src/abstract/huobipro.d.ts +0 -547
- package/js/src/abstract/huobipro.js +0 -11
- package/js/src/abstract/mexc3.d.ts +0 -180
- package/js/src/abstract/mexc3.js +0 -11
- package/js/src/abstract/okex.d.ts +0 -280
- package/js/src/abstract/okex.js +0 -11
- package/js/src/abstract/okex5.d.ts +0 -280
- package/js/src/abstract/okex5.js +0 -11
package/dist/cjs/src/htx.js
CHANGED
|
@@ -32,7 +32,8 @@ class htx extends htx$1 {
|
|
|
32
32
|
'future': true,
|
|
33
33
|
'option': undefined,
|
|
34
34
|
'addMargin': undefined,
|
|
35
|
-
'
|
|
35
|
+
'borrowCrossMargin': true,
|
|
36
|
+
'borrowIsolatedMargin': true,
|
|
36
37
|
'cancelAllOrders': true,
|
|
37
38
|
'cancelOrder': true,
|
|
38
39
|
'cancelOrders': true,
|
|
@@ -112,7 +113,8 @@ class htx extends htx$1 {
|
|
|
112
113
|
'fetchWithdrawals': true,
|
|
113
114
|
'fetchWithdrawalWhitelist': undefined,
|
|
114
115
|
'reduceMargin': undefined,
|
|
115
|
-
'
|
|
116
|
+
'repayCrossMargin': true,
|
|
117
|
+
'repayIsolatedMargin': true,
|
|
116
118
|
'setLeverage': true,
|
|
117
119
|
'setMarginMode': false,
|
|
118
120
|
'setPositionMode': false,
|
|
@@ -1162,10 +1164,6 @@ class htx extends htx$1 {
|
|
|
1162
1164
|
'deposit-earning': 'deposit-earning',
|
|
1163
1165
|
'otc-options': 'otc-options',
|
|
1164
1166
|
},
|
|
1165
|
-
'marginAccounts': {
|
|
1166
|
-
'cross': 'super-margin',
|
|
1167
|
-
'isolated': 'margin',
|
|
1168
|
-
},
|
|
1169
1167
|
'typesByAccount': {
|
|
1170
1168
|
'pro': 'spot',
|
|
1171
1169
|
'futures': 'future',
|
|
@@ -8128,41 +8126,60 @@ class htx extends htx$1 {
|
|
|
8128
8126
|
'info': interest,
|
|
8129
8127
|
}, market);
|
|
8130
8128
|
}
|
|
8131
|
-
async
|
|
8129
|
+
async borrowIsolatedMargin(symbol, code, amount, params = {}) {
|
|
8132
8130
|
/**
|
|
8133
8131
|
* @method
|
|
8134
|
-
* @name huobi#
|
|
8132
|
+
* @name huobi#borrowIsolatedMargin
|
|
8135
8133
|
* @description create a loan to borrow margin
|
|
8136
8134
|
* @see https://huobiapi.github.io/docs/spot/v1/en/#request-a-margin-loan-isolated
|
|
8137
8135
|
* @see https://huobiapi.github.io/docs/spot/v1/en/#request-a-margin-loan-cross
|
|
8136
|
+
* @param {string} symbol unified market symbol, required for isolated margin
|
|
8138
8137
|
* @param {string} code unified currency code of the currency to borrow
|
|
8139
8138
|
* @param {float} amount the amount to borrow
|
|
8140
|
-
* @param {string} symbol unified market symbol, required for isolated margin
|
|
8141
8139
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
8142
8140
|
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
8143
8141
|
*/
|
|
8144
8142
|
await this.loadMarkets();
|
|
8145
8143
|
const currency = this.currency(code);
|
|
8144
|
+
const market = this.market(symbol);
|
|
8146
8145
|
const request = {
|
|
8147
8146
|
'currency': currency['id'],
|
|
8148
8147
|
'amount': this.currencyToPrecision(code, amount),
|
|
8148
|
+
'symbol': market['id'],
|
|
8149
8149
|
};
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8150
|
+
const response = await this.privatePostMarginOrders(this.extend(request, params));
|
|
8151
|
+
//
|
|
8152
|
+
// Isolated
|
|
8153
|
+
//
|
|
8154
|
+
// {
|
|
8155
|
+
// "data": 1000
|
|
8156
|
+
// }
|
|
8157
|
+
//
|
|
8158
|
+
const transaction = this.parseMarginLoan(response, currency);
|
|
8159
|
+
return this.extend(transaction, {
|
|
8160
|
+
'amount': amount,
|
|
8161
|
+
'symbol': symbol,
|
|
8162
|
+
});
|
|
8163
|
+
}
|
|
8164
|
+
async borrowCrossMargin(code, amount, params = {}) {
|
|
8165
|
+
/**
|
|
8166
|
+
* @method
|
|
8167
|
+
* @name huobi#borrowCrossMargin
|
|
8168
|
+
* @description create a loan to borrow margin
|
|
8169
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#request-a-margin-loan-isolated
|
|
8170
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#request-a-margin-loan-cross
|
|
8171
|
+
* @param {string} code unified currency code of the currency to borrow
|
|
8172
|
+
* @param {float} amount the amount to borrow
|
|
8173
|
+
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
8174
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
8175
|
+
*/
|
|
8176
|
+
await this.loadMarkets();
|
|
8177
|
+
const currency = this.currency(code);
|
|
8178
|
+
const request = {
|
|
8179
|
+
'currency': currency['id'],
|
|
8180
|
+
'amount': this.currencyToPrecision(code, amount),
|
|
8181
|
+
};
|
|
8182
|
+
const response = await this.privatePostCrossMarginOrders(this.extend(request, params));
|
|
8166
8183
|
//
|
|
8167
8184
|
// Cross
|
|
8168
8185
|
//
|
|
@@ -8171,38 +8188,65 @@ class htx extends htx$1 {
|
|
|
8171
8188
|
// "data": null
|
|
8172
8189
|
// }
|
|
8173
8190
|
//
|
|
8174
|
-
|
|
8191
|
+
const transaction = this.parseMarginLoan(response, currency);
|
|
8192
|
+
return this.extend(transaction, {
|
|
8193
|
+
'amount': amount,
|
|
8194
|
+
});
|
|
8195
|
+
}
|
|
8196
|
+
async repayIsolatedMargin(symbol, code, amount, params = {}) {
|
|
8197
|
+
/**
|
|
8198
|
+
* @method
|
|
8199
|
+
* @name huobi#repayIsolatedMargin
|
|
8200
|
+
* @description repay borrowed margin and interest
|
|
8201
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#repay-margin-loan-cross-isolated
|
|
8202
|
+
* @param {string} code unified currency code of the currency to repay
|
|
8203
|
+
* @param {float} amount the amount to repay
|
|
8204
|
+
* @param {string} symbol unified market symbol
|
|
8205
|
+
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
8206
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
8207
|
+
*/
|
|
8208
|
+
await this.loadMarkets();
|
|
8209
|
+
const currency = this.currency(code);
|
|
8210
|
+
const accountId = await this.fetchAccountIdByType('spot', 'isolated', symbol, params);
|
|
8211
|
+
const request = {
|
|
8212
|
+
'currency': currency['id'],
|
|
8213
|
+
'amount': this.currencyToPrecision(code, amount),
|
|
8214
|
+
'accountId': accountId,
|
|
8215
|
+
};
|
|
8216
|
+
const response = await this.v2PrivatePostAccountRepayment(this.extend(request, params));
|
|
8175
8217
|
//
|
|
8176
8218
|
// {
|
|
8177
|
-
// "
|
|
8219
|
+
// "code":200,
|
|
8220
|
+
// "data": [
|
|
8221
|
+
// {
|
|
8222
|
+
// "repayId":1174424,
|
|
8223
|
+
// "repayTime":1600747722018
|
|
8224
|
+
// }
|
|
8225
|
+
// ]
|
|
8178
8226
|
// }
|
|
8179
8227
|
//
|
|
8180
|
-
const
|
|
8228
|
+
const data = this.safeValue(response, 'Data', []);
|
|
8229
|
+
const loan = this.safeValue(data, 0);
|
|
8230
|
+
const transaction = this.parseMarginLoan(loan, currency);
|
|
8181
8231
|
return this.extend(transaction, {
|
|
8182
8232
|
'amount': amount,
|
|
8183
8233
|
'symbol': symbol,
|
|
8184
8234
|
});
|
|
8185
8235
|
}
|
|
8186
|
-
async
|
|
8236
|
+
async repayCrossMargin(code, amount, params = {}) {
|
|
8187
8237
|
/**
|
|
8188
8238
|
* @method
|
|
8189
|
-
* @name huobi#
|
|
8239
|
+
* @name huobi#repayCrossMargin
|
|
8190
8240
|
* @description repay borrowed margin and interest
|
|
8191
8241
|
* @see https://huobiapi.github.io/docs/spot/v1/en/#repay-margin-loan-cross-isolated
|
|
8192
8242
|
* @param {string} code unified currency code of the currency to repay
|
|
8193
8243
|
* @param {float} amount the amount to repay
|
|
8194
|
-
* @param {string} symbol unified market symbol
|
|
8195
8244
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
8196
8245
|
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
8197
8246
|
*/
|
|
8198
8247
|
await this.loadMarkets();
|
|
8199
8248
|
const currency = this.currency(code);
|
|
8200
|
-
|
|
8201
|
-
[marginMode, params] = this.handleMarginModeAndParams('repayMargin', params);
|
|
8202
|
-
marginMode = (marginMode === undefined) ? 'cross' : marginMode;
|
|
8203
|
-
const marginAccounts = this.safeValue(this.options, 'marginAccounts', {});
|
|
8204
|
-
const accountType = this.getSupportedMapping(marginMode, marginAccounts);
|
|
8205
|
-
const accountId = await this.fetchAccountIdByType(accountType, marginMode, symbol, params);
|
|
8249
|
+
const accountId = await this.fetchAccountIdByType('spot', 'cross', undefined, params);
|
|
8206
8250
|
const request = {
|
|
8207
8251
|
'currency': currency['id'],
|
|
8208
8252
|
'amount': this.currencyToPrecision(code, amount),
|
|
@@ -8225,7 +8269,6 @@ class htx extends htx$1 {
|
|
|
8225
8269
|
const transaction = this.parseMarginLoan(loan, currency);
|
|
8226
8270
|
return this.extend(transaction, {
|
|
8227
8271
|
'amount': amount,
|
|
8228
|
-
'symbol': symbol,
|
|
8229
8272
|
});
|
|
8230
8273
|
}
|
|
8231
8274
|
parseMarginLoan(info, currency = undefined) {
|
|
@@ -8252,7 +8295,7 @@ class htx extends htx$1 {
|
|
|
8252
8295
|
//
|
|
8253
8296
|
const timestamp = this.safeInteger(info, 'repayTime');
|
|
8254
8297
|
return {
|
|
8255
|
-
'id': this.
|
|
8298
|
+
'id': this.safeString2(info, 'repayId', 'data'),
|
|
8256
8299
|
'currency': this.safeCurrencyCode(undefined, currency),
|
|
8257
8300
|
'amount': undefined,
|
|
8258
8301
|
'symbol': undefined,
|