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/js/src/htx.js
CHANGED
|
@@ -35,7 +35,8 @@ export default class htx extends Exchange {
|
|
|
35
35
|
'future': true,
|
|
36
36
|
'option': undefined,
|
|
37
37
|
'addMargin': undefined,
|
|
38
|
-
'
|
|
38
|
+
'borrowCrossMargin': true,
|
|
39
|
+
'borrowIsolatedMargin': true,
|
|
39
40
|
'cancelAllOrders': true,
|
|
40
41
|
'cancelOrder': true,
|
|
41
42
|
'cancelOrders': true,
|
|
@@ -115,7 +116,8 @@ export default class htx extends Exchange {
|
|
|
115
116
|
'fetchWithdrawals': true,
|
|
116
117
|
'fetchWithdrawalWhitelist': undefined,
|
|
117
118
|
'reduceMargin': undefined,
|
|
118
|
-
'
|
|
119
|
+
'repayCrossMargin': true,
|
|
120
|
+
'repayIsolatedMargin': true,
|
|
119
121
|
'setLeverage': true,
|
|
120
122
|
'setMarginMode': false,
|
|
121
123
|
'setPositionMode': false,
|
|
@@ -1165,10 +1167,6 @@ export default class htx extends Exchange {
|
|
|
1165
1167
|
'deposit-earning': 'deposit-earning',
|
|
1166
1168
|
'otc-options': 'otc-options',
|
|
1167
1169
|
},
|
|
1168
|
-
'marginAccounts': {
|
|
1169
|
-
'cross': 'super-margin',
|
|
1170
|
-
'isolated': 'margin',
|
|
1171
|
-
},
|
|
1172
1170
|
'typesByAccount': {
|
|
1173
1171
|
'pro': 'spot',
|
|
1174
1172
|
'futures': 'future',
|
|
@@ -8131,41 +8129,60 @@ export default class htx extends Exchange {
|
|
|
8131
8129
|
'info': interest,
|
|
8132
8130
|
}, market);
|
|
8133
8131
|
}
|
|
8134
|
-
async
|
|
8132
|
+
async borrowIsolatedMargin(symbol, code, amount, params = {}) {
|
|
8135
8133
|
/**
|
|
8136
8134
|
* @method
|
|
8137
|
-
* @name huobi#
|
|
8135
|
+
* @name huobi#borrowIsolatedMargin
|
|
8138
8136
|
* @description create a loan to borrow margin
|
|
8139
8137
|
* @see https://huobiapi.github.io/docs/spot/v1/en/#request-a-margin-loan-isolated
|
|
8140
8138
|
* @see https://huobiapi.github.io/docs/spot/v1/en/#request-a-margin-loan-cross
|
|
8139
|
+
* @param {string} symbol unified market symbol, required for isolated margin
|
|
8141
8140
|
* @param {string} code unified currency code of the currency to borrow
|
|
8142
8141
|
* @param {float} amount the amount to borrow
|
|
8143
|
-
* @param {string} symbol unified market symbol, required for isolated margin
|
|
8144
8142
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
8145
8143
|
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
8146
8144
|
*/
|
|
8147
8145
|
await this.loadMarkets();
|
|
8148
8146
|
const currency = this.currency(code);
|
|
8147
|
+
const market = this.market(symbol);
|
|
8149
8148
|
const request = {
|
|
8150
8149
|
'currency': currency['id'],
|
|
8151
8150
|
'amount': this.currencyToPrecision(code, amount),
|
|
8151
|
+
'symbol': market['id'],
|
|
8152
8152
|
};
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8153
|
+
const response = await this.privatePostMarginOrders(this.extend(request, params));
|
|
8154
|
+
//
|
|
8155
|
+
// Isolated
|
|
8156
|
+
//
|
|
8157
|
+
// {
|
|
8158
|
+
// "data": 1000
|
|
8159
|
+
// }
|
|
8160
|
+
//
|
|
8161
|
+
const transaction = this.parseMarginLoan(response, currency);
|
|
8162
|
+
return this.extend(transaction, {
|
|
8163
|
+
'amount': amount,
|
|
8164
|
+
'symbol': symbol,
|
|
8165
|
+
});
|
|
8166
|
+
}
|
|
8167
|
+
async borrowCrossMargin(code, amount, params = {}) {
|
|
8168
|
+
/**
|
|
8169
|
+
* @method
|
|
8170
|
+
* @name huobi#borrowCrossMargin
|
|
8171
|
+
* @description create a loan to borrow margin
|
|
8172
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#request-a-margin-loan-isolated
|
|
8173
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#request-a-margin-loan-cross
|
|
8174
|
+
* @param {string} code unified currency code of the currency to borrow
|
|
8175
|
+
* @param {float} amount the amount to borrow
|
|
8176
|
+
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
8177
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
8178
|
+
*/
|
|
8179
|
+
await this.loadMarkets();
|
|
8180
|
+
const currency = this.currency(code);
|
|
8181
|
+
const request = {
|
|
8182
|
+
'currency': currency['id'],
|
|
8183
|
+
'amount': this.currencyToPrecision(code, amount),
|
|
8184
|
+
};
|
|
8185
|
+
const response = await this.privatePostCrossMarginOrders(this.extend(request, params));
|
|
8169
8186
|
//
|
|
8170
8187
|
// Cross
|
|
8171
8188
|
//
|
|
@@ -8174,38 +8191,65 @@ export default class htx extends Exchange {
|
|
|
8174
8191
|
// "data": null
|
|
8175
8192
|
// }
|
|
8176
8193
|
//
|
|
8177
|
-
|
|
8194
|
+
const transaction = this.parseMarginLoan(response, currency);
|
|
8195
|
+
return this.extend(transaction, {
|
|
8196
|
+
'amount': amount,
|
|
8197
|
+
});
|
|
8198
|
+
}
|
|
8199
|
+
async repayIsolatedMargin(symbol, code, amount, params = {}) {
|
|
8200
|
+
/**
|
|
8201
|
+
* @method
|
|
8202
|
+
* @name huobi#repayIsolatedMargin
|
|
8203
|
+
* @description repay borrowed margin and interest
|
|
8204
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#repay-margin-loan-cross-isolated
|
|
8205
|
+
* @param {string} code unified currency code of the currency to repay
|
|
8206
|
+
* @param {float} amount the amount to repay
|
|
8207
|
+
* @param {string} symbol unified market symbol
|
|
8208
|
+
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
8209
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
8210
|
+
*/
|
|
8211
|
+
await this.loadMarkets();
|
|
8212
|
+
const currency = this.currency(code);
|
|
8213
|
+
const accountId = await this.fetchAccountIdByType('spot', 'isolated', symbol, params);
|
|
8214
|
+
const request = {
|
|
8215
|
+
'currency': currency['id'],
|
|
8216
|
+
'amount': this.currencyToPrecision(code, amount),
|
|
8217
|
+
'accountId': accountId,
|
|
8218
|
+
};
|
|
8219
|
+
const response = await this.v2PrivatePostAccountRepayment(this.extend(request, params));
|
|
8178
8220
|
//
|
|
8179
8221
|
// {
|
|
8180
|
-
// "
|
|
8222
|
+
// "code":200,
|
|
8223
|
+
// "data": [
|
|
8224
|
+
// {
|
|
8225
|
+
// "repayId":1174424,
|
|
8226
|
+
// "repayTime":1600747722018
|
|
8227
|
+
// }
|
|
8228
|
+
// ]
|
|
8181
8229
|
// }
|
|
8182
8230
|
//
|
|
8183
|
-
const
|
|
8231
|
+
const data = this.safeValue(response, 'Data', []);
|
|
8232
|
+
const loan = this.safeValue(data, 0);
|
|
8233
|
+
const transaction = this.parseMarginLoan(loan, currency);
|
|
8184
8234
|
return this.extend(transaction, {
|
|
8185
8235
|
'amount': amount,
|
|
8186
8236
|
'symbol': symbol,
|
|
8187
8237
|
});
|
|
8188
8238
|
}
|
|
8189
|
-
async
|
|
8239
|
+
async repayCrossMargin(code, amount, params = {}) {
|
|
8190
8240
|
/**
|
|
8191
8241
|
* @method
|
|
8192
|
-
* @name huobi#
|
|
8242
|
+
* @name huobi#repayCrossMargin
|
|
8193
8243
|
* @description repay borrowed margin and interest
|
|
8194
8244
|
* @see https://huobiapi.github.io/docs/spot/v1/en/#repay-margin-loan-cross-isolated
|
|
8195
8245
|
* @param {string} code unified currency code of the currency to repay
|
|
8196
8246
|
* @param {float} amount the amount to repay
|
|
8197
|
-
* @param {string} symbol unified market symbol
|
|
8198
8247
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
8199
8248
|
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
8200
8249
|
*/
|
|
8201
8250
|
await this.loadMarkets();
|
|
8202
8251
|
const currency = this.currency(code);
|
|
8203
|
-
|
|
8204
|
-
[marginMode, params] = this.handleMarginModeAndParams('repayMargin', params);
|
|
8205
|
-
marginMode = (marginMode === undefined) ? 'cross' : marginMode;
|
|
8206
|
-
const marginAccounts = this.safeValue(this.options, 'marginAccounts', {});
|
|
8207
|
-
const accountType = this.getSupportedMapping(marginMode, marginAccounts);
|
|
8208
|
-
const accountId = await this.fetchAccountIdByType(accountType, marginMode, symbol, params);
|
|
8252
|
+
const accountId = await this.fetchAccountIdByType('spot', 'cross', undefined, params);
|
|
8209
8253
|
const request = {
|
|
8210
8254
|
'currency': currency['id'],
|
|
8211
8255
|
'amount': this.currencyToPrecision(code, amount),
|
|
@@ -8228,7 +8272,6 @@ export default class htx extends Exchange {
|
|
|
8228
8272
|
const transaction = this.parseMarginLoan(loan, currency);
|
|
8229
8273
|
return this.extend(transaction, {
|
|
8230
8274
|
'amount': amount,
|
|
8231
|
-
'symbol': symbol,
|
|
8232
8275
|
});
|
|
8233
8276
|
}
|
|
8234
8277
|
parseMarginLoan(info, currency = undefined) {
|
|
@@ -8255,7 +8298,7 @@ export default class htx extends Exchange {
|
|
|
8255
8298
|
//
|
|
8256
8299
|
const timestamp = this.safeInteger(info, 'repayTime');
|
|
8257
8300
|
return {
|
|
8258
|
-
'id': this.
|
|
8301
|
+
'id': this.safeString2(info, 'repayId', 'data'),
|
|
8259
8302
|
'currency': this.safeCurrencyCode(undefined, currency),
|
|
8260
8303
|
'amount': undefined,
|
|
8261
8304
|
'symbol': undefined,
|
package/js/src/kucoin.d.ts
CHANGED
|
@@ -171,7 +171,7 @@ export default class kucoin extends Exchange {
|
|
|
171
171
|
datetime: string;
|
|
172
172
|
info: any;
|
|
173
173
|
};
|
|
174
|
-
|
|
174
|
+
borrowCrossMargin(code: string, amount: any, params?: {}): Promise<{
|
|
175
175
|
id: string;
|
|
176
176
|
currency: string;
|
|
177
177
|
amount: number;
|
|
@@ -180,7 +180,25 @@ export default class kucoin extends Exchange {
|
|
|
180
180
|
datetime: string;
|
|
181
181
|
info: any;
|
|
182
182
|
}>;
|
|
183
|
-
|
|
183
|
+
borrowIsolatedMargin(symbol: string, code: string, amount: any, params?: {}): Promise<{
|
|
184
|
+
id: string;
|
|
185
|
+
currency: string;
|
|
186
|
+
amount: number;
|
|
187
|
+
symbol: any;
|
|
188
|
+
timestamp: number;
|
|
189
|
+
datetime: string;
|
|
190
|
+
info: any;
|
|
191
|
+
}>;
|
|
192
|
+
repayCrossMargin(code: string, amount: any, params?: {}): Promise<{
|
|
193
|
+
id: string;
|
|
194
|
+
currency: string;
|
|
195
|
+
amount: number;
|
|
196
|
+
symbol: any;
|
|
197
|
+
timestamp: number;
|
|
198
|
+
datetime: string;
|
|
199
|
+
info: any;
|
|
200
|
+
}>;
|
|
201
|
+
repayIsolatedMargin(symbol: string, code: string, amount: any, params?: {}): Promise<{
|
|
184
202
|
id: string;
|
|
185
203
|
currency: string;
|
|
186
204
|
amount: number;
|