ccxt 4.5.2 → 4.5.4
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 +4 -4
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +78 -5
- package/dist/cjs/src/base/functions/encode.js +8 -0
- package/dist/cjs/src/base/functions/rsa.js +14 -1
- package/dist/cjs/src/base/functions.js +1 -0
- package/dist/cjs/src/binance.js +12 -15
- package/dist/cjs/src/bitget.js +1 -1
- package/dist/cjs/src/bitvavo.js +8 -0
- package/dist/cjs/src/bybit.js +20 -6
- package/dist/cjs/src/coinbase.js +28 -10
- package/dist/cjs/src/coincatch.js +34 -21
- package/dist/cjs/src/delta.js +1 -0
- package/dist/cjs/src/gate.js +27 -12
- package/dist/cjs/src/gemini.js +3 -3
- package/dist/cjs/src/htx.js +4 -4
- package/dist/cjs/src/kucoinfutures.js +11 -10
- package/dist/cjs/src/mexc.js +30 -1
- package/dist/cjs/src/okx.js +19 -4
- package/dist/cjs/src/pro/binance.js +3 -3
- package/dist/cjs/src/pro/bitfinex.js +140 -0
- package/dist/cjs/src/pro/bitget.js +168 -26
- package/dist/cjs/src/pro/bybit.js +67 -11
- package/dist/cjs/src/pro/coinex.js +10 -11
- package/dist/cjs/src/pro/kucoin.js +64 -0
- package/dist/cjs/src/pro/mexc.js +7 -3
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/myokx.d.ts +1 -0
- package/js/src/abstract/okx.d.ts +1 -0
- package/js/src/abstract/okxus.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +6 -0
- package/js/src/base/Exchange.js +78 -5
- package/js/src/base/functions/encode.d.ts +2 -1
- package/js/src/base/functions/encode.js +8 -1
- package/js/src/base/functions/rsa.js +16 -3
- package/js/src/binance.js +12 -15
- package/js/src/bitget.js +1 -1
- package/js/src/bitvavo.js +8 -0
- package/js/src/bybit.js +20 -6
- package/js/src/coinbase.d.ts +1 -1
- package/js/src/coinbase.js +28 -10
- package/js/src/coincatch.d.ts +2 -0
- package/js/src/coincatch.js +34 -21
- package/js/src/delta.js +1 -0
- package/js/src/gate.js +27 -12
- package/js/src/gemini.js +3 -3
- package/js/src/htx.js +4 -4
- package/js/src/kucoinfutures.js +11 -10
- package/js/src/mexc.d.ts +3 -0
- package/js/src/mexc.js +30 -1
- package/js/src/okx.d.ts +4 -2
- package/js/src/okx.js +19 -4
- package/js/src/pro/binance.js +3 -3
- package/js/src/pro/bitfinex.d.ts +30 -0
- package/js/src/pro/bitfinex.js +140 -0
- package/js/src/pro/bitget.d.ts +9 -1
- package/js/src/pro/bitget.js +168 -26
- package/js/src/pro/bybit.d.ts +6 -2
- package/js/src/pro/bybit.js +67 -11
- package/js/src/pro/coinex.js +11 -12
- package/js/src/pro/kucoin.d.ts +22 -0
- package/js/src/pro/kucoin.js +64 -0
- package/js/src/pro/mexc.js +7 -3
- package/package.json +3 -3
package/js/src/coincatch.d.ts
CHANGED
|
@@ -284,6 +284,7 @@ export default class coincatch extends Exchange {
|
|
|
284
284
|
* @param {float} amount how much of you want to trade in units of the base currency
|
|
285
285
|
* @param {float} [price] the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
286
286
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
287
|
+
* @param {bool} [params.hedged] *swap markets only* must be set to true if position mode is hedged (default false)
|
|
287
288
|
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
288
289
|
* @param {float} [params.triggerPrice] the price that the order is to be triggered
|
|
289
290
|
* @param {bool} [params.postOnly] if true, the order will only be posted to the order book and not executed immediately
|
|
@@ -328,6 +329,7 @@ export default class coincatch extends Exchange {
|
|
|
328
329
|
* @param {float} amount how much of you want to trade in units of the base currency
|
|
329
330
|
* @param {float} [price] the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
330
331
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
332
|
+
* @param {bool} [params.hedged] must be set to true if position mode is hedged (default false)
|
|
331
333
|
* @param {bool} [params.postOnly] *non-trigger orders only* if true, the order will only be posted to the order book and not executed immediately
|
|
332
334
|
* @param {bool} [params.reduceOnly] true or false whether the order is reduce only
|
|
333
335
|
* @param {string} [params.timeInForce] *non-trigger orders only* 'GTC', 'FOK', 'IOC' or 'PO'
|
package/js/src/coincatch.js
CHANGED
|
@@ -611,8 +611,8 @@ export default class coincatch extends Exchange {
|
|
|
611
611
|
for (let j = 0; j < networks.length; j++) {
|
|
612
612
|
const network = networks[j];
|
|
613
613
|
const networkId = this.safeString(network, 'chain');
|
|
614
|
-
const networkCode = this.
|
|
615
|
-
parsedNetworks[
|
|
614
|
+
const networkCode = this.networkIdToCode(networkId);
|
|
615
|
+
parsedNetworks[networkCode] = {
|
|
616
616
|
'id': networkId,
|
|
617
617
|
'network': networkCode,
|
|
618
618
|
'limits': {
|
|
@@ -2307,6 +2307,7 @@ export default class coincatch extends Exchange {
|
|
|
2307
2307
|
* @param {float} amount how much of you want to trade in units of the base currency
|
|
2308
2308
|
* @param {float} [price] the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
2309
2309
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2310
|
+
* @param {bool} [params.hedged] *swap markets only* must be set to true if position mode is hedged (default false)
|
|
2310
2311
|
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
2311
2312
|
* @param {float} [params.triggerPrice] the price that the order is to be triggered
|
|
2312
2313
|
* @param {bool} [params.postOnly] if true, the order will only be posted to the order book and not executed immediately
|
|
@@ -2509,6 +2510,7 @@ export default class coincatch extends Exchange {
|
|
|
2509
2510
|
* @param {float} amount how much of you want to trade in units of the base currency
|
|
2510
2511
|
* @param {float} [price] the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
2511
2512
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2513
|
+
* @param {bool} [params.hedged] must be set to true if position mode is hedged (default false)
|
|
2512
2514
|
* @param {bool} [params.postOnly] *non-trigger orders only* if true, the order will only be posted to the order book and not executed immediately
|
|
2513
2515
|
* @param {bool} [params.reduceOnly] true or false whether the order is reduce only
|
|
2514
2516
|
* @param {string} [params.timeInForce] *non-trigger orders only* 'GTC', 'FOK', 'IOC' or 'PO'
|
|
@@ -2566,7 +2568,7 @@ export default class coincatch extends Exchange {
|
|
|
2566
2568
|
* @param {float} amount how much of you want to trade in units of the base currency
|
|
2567
2569
|
* @param {float} [price] the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
2568
2570
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2569
|
-
* @param {bool} [params.hedged] default false
|
|
2571
|
+
* @param {bool} [params.hedged] must be set to true if position mode is hedged (default false)
|
|
2570
2572
|
* @param {bool} [params.postOnly] *non-trigger orders only* if true, the order will only be posted to the order book and not executed immediately
|
|
2571
2573
|
* @param {bool} [params.reduceOnly] true or false whether the order is reduce only
|
|
2572
2574
|
* @param {string} [params.timeInForce] *non-trigger orders only* 'GTC', 'FOK', 'IOC' or 'PO'
|
|
@@ -2605,31 +2607,42 @@ export default class coincatch extends Exchange {
|
|
|
2605
2607
|
}
|
|
2606
2608
|
if ((endpointType !== 'tpsl')) {
|
|
2607
2609
|
request['orderType'] = type;
|
|
2610
|
+
let sideIsExchangeSpecific = false;
|
|
2608
2611
|
let hedged = false;
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2612
|
+
if ((side === 'buy_single') || (side === 'sell_single') || (side === 'open_long') || (side === 'open_short') || (side === 'close_long') || (side === 'close_short')) {
|
|
2613
|
+
sideIsExchangeSpecific = true;
|
|
2614
|
+
if ((side !== 'buy_single') && (side !== 'sell_single')) {
|
|
2615
|
+
hedged = true;
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2618
|
+
if (!sideIsExchangeSpecific) {
|
|
2619
|
+
[hedged, params] = this.handleOptionAndParams(params, methodName, 'hedged', hedged);
|
|
2620
|
+
// hedged and non-hedged orders have different side values and reduceOnly handling
|
|
2621
|
+
const reduceOnly = this.safeBool(params, 'reduceOnly');
|
|
2622
|
+
if (hedged) {
|
|
2623
|
+
if ((reduceOnly !== undefined) && reduceOnly) {
|
|
2624
|
+
if (side === 'buy') {
|
|
2625
|
+
side = 'close_short';
|
|
2626
|
+
}
|
|
2627
|
+
else if (side === 'sell') {
|
|
2628
|
+
side = 'close_long';
|
|
2629
|
+
}
|
|
2617
2630
|
}
|
|
2618
|
-
else
|
|
2619
|
-
side
|
|
2631
|
+
else {
|
|
2632
|
+
if (side === 'buy') {
|
|
2633
|
+
side = 'open_long';
|
|
2634
|
+
}
|
|
2635
|
+
else if (side === 'sell') {
|
|
2636
|
+
side = 'open_short';
|
|
2637
|
+
}
|
|
2620
2638
|
}
|
|
2621
2639
|
}
|
|
2622
2640
|
else {
|
|
2623
|
-
|
|
2624
|
-
side = 'open_long';
|
|
2625
|
-
}
|
|
2626
|
-
else if (side === 'sell') {
|
|
2627
|
-
side = 'open_short';
|
|
2628
|
-
}
|
|
2641
|
+
side = side.toLowerCase() + '_single';
|
|
2629
2642
|
}
|
|
2630
2643
|
}
|
|
2631
|
-
|
|
2632
|
-
|
|
2644
|
+
if (hedged) {
|
|
2645
|
+
params = this.omit(params, 'reduceOnly');
|
|
2633
2646
|
}
|
|
2634
2647
|
request['side'] = side;
|
|
2635
2648
|
}
|
package/js/src/delta.js
CHANGED
package/js/src/gate.js
CHANGED
|
@@ -57,14 +57,24 @@ export default class gate extends Exchange {
|
|
|
57
57
|
},
|
|
58
58
|
'test': {
|
|
59
59
|
'public': {
|
|
60
|
-
'futures': 'https://
|
|
61
|
-
'delivery': 'https://
|
|
62
|
-
'options': 'https://
|
|
60
|
+
'futures': 'https://api-testnet.gateapi.io/api/v4',
|
|
61
|
+
'delivery': 'https://api-testnet.gateapi.io/api/v4',
|
|
62
|
+
'options': 'https://api-testnet.gateapi.io/api/v4',
|
|
63
|
+
'spot': 'https://api-testnet.gateapi.io/api/v4',
|
|
64
|
+
'wallet': 'https://api-testnet.gateapi.io/api/v4',
|
|
65
|
+
'margin': 'https://api-testnet.gateapi.io/api/v4',
|
|
66
|
+
'sub_accounts': 'https://api-testnet.gateapi.io/api/v4',
|
|
67
|
+
'account': 'https://api-testnet.gateapi.io/api/v4',
|
|
63
68
|
},
|
|
64
69
|
'private': {
|
|
65
|
-
'futures': 'https://
|
|
66
|
-
'delivery': 'https://
|
|
67
|
-
'options': 'https://
|
|
70
|
+
'futures': 'https://api-testnet.gateapi.io/api/v4',
|
|
71
|
+
'delivery': 'https://api-testnet.gateapi.io/api/v4',
|
|
72
|
+
'options': 'https://api-testnet.gateapi.io/api/v4',
|
|
73
|
+
'spot': 'https://api-testnet.gateapi.io/api/v4',
|
|
74
|
+
'wallet': 'https://api-testnet.gateapi.io/api/v4',
|
|
75
|
+
'margin': 'https://api-testnet.gateapi.io/api/v4',
|
|
76
|
+
'sub_accounts': 'https://api-testnet.gateapi.io/api/v4',
|
|
77
|
+
'account': 'https://api-testnet.gateapi.io/api/v4',
|
|
68
78
|
},
|
|
69
79
|
},
|
|
70
80
|
'referral': {
|
|
@@ -1231,16 +1241,15 @@ export default class gate extends Exchange {
|
|
|
1231
1241
|
await this.loadUnifiedStatus();
|
|
1232
1242
|
}
|
|
1233
1243
|
const rawPromises = [];
|
|
1234
|
-
const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
|
|
1235
1244
|
const fetchMarketsOptions = this.safeDict(this.options, 'fetchMarkets');
|
|
1236
1245
|
const types = this.safeList(fetchMarketsOptions, 'types', ['spot', 'swap', 'future', 'option']);
|
|
1237
1246
|
for (let i = 0; i < types.length; i++) {
|
|
1238
1247
|
const marketType = types[i];
|
|
1239
1248
|
if (marketType === 'spot') {
|
|
1240
|
-
if (!sandboxMode) {
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
}
|
|
1249
|
+
// if (!sandboxMode) {
|
|
1250
|
+
// gate doesn't have a sandbox for spot markets
|
|
1251
|
+
rawPromises.push(this.fetchSpotMarkets(params));
|
|
1252
|
+
// }
|
|
1244
1253
|
}
|
|
1245
1254
|
else if (marketType === 'swap') {
|
|
1246
1255
|
rawPromises.push(this.fetchSwapMarkets(params));
|
|
@@ -1371,7 +1380,10 @@ export default class gate extends Exchange {
|
|
|
1371
1380
|
}
|
|
1372
1381
|
async fetchSwapMarkets(params = {}) {
|
|
1373
1382
|
const result = [];
|
|
1374
|
-
|
|
1383
|
+
let swapSettlementCurrencies = this.getSettlementCurrencies('swap', 'fetchMarkets');
|
|
1384
|
+
if (this.options['sandboxMode']) {
|
|
1385
|
+
swapSettlementCurrencies = ['usdt']; // gate sandbox only has usdt-margined swaps
|
|
1386
|
+
}
|
|
1375
1387
|
for (let c = 0; c < swapSettlementCurrencies.length; c++) {
|
|
1376
1388
|
const settleId = swapSettlementCurrencies[c];
|
|
1377
1389
|
const request = {
|
|
@@ -1386,6 +1398,9 @@ export default class gate extends Exchange {
|
|
|
1386
1398
|
return result;
|
|
1387
1399
|
}
|
|
1388
1400
|
async fetchFutureMarkets(params = {}) {
|
|
1401
|
+
if (this.options['sandboxMode']) {
|
|
1402
|
+
return []; // right now sandbox does not have inverse swaps
|
|
1403
|
+
}
|
|
1389
1404
|
const result = [];
|
|
1390
1405
|
const futureSettlementCurrencies = this.getSettlementCurrencies('future', 'fetchMarkets');
|
|
1391
1406
|
for (let c = 0; c < futureSettlementCurrencies.length; c++) {
|
package/js/src/gemini.js
CHANGED
|
@@ -694,8 +694,8 @@ export default class gemini extends Exchange {
|
|
|
694
694
|
//
|
|
695
695
|
// [
|
|
696
696
|
// 'BTCUSD', // symbol
|
|
697
|
-
// 2, // priceTickDecimalPlaces
|
|
698
|
-
// 8, // quantityTickDecimalPlaces
|
|
697
|
+
// 2, // tick precision (priceTickDecimalPlaces)
|
|
698
|
+
// 8, // amount precision (quantityTickDecimalPlaces)
|
|
699
699
|
// '0.00001', // quantityMinimum
|
|
700
700
|
// 10, // quantityRoundDecimalPlaces
|
|
701
701
|
// true // minimumsAreInclusive
|
|
@@ -714,7 +714,7 @@ export default class gemini extends Exchange {
|
|
|
714
714
|
// "wrap_enabled": false
|
|
715
715
|
// "product_type": "swap", // only in perps
|
|
716
716
|
// "contract_type": "linear", // only in perps
|
|
717
|
-
// "contract_price_currency": "GUSD"
|
|
717
|
+
// "contract_price_currency": "GUSD"
|
|
718
718
|
// }
|
|
719
719
|
//
|
|
720
720
|
let marketId = undefined;
|
package/js/src/htx.js
CHANGED
|
@@ -664,7 +664,7 @@ export default class htx extends Exchange {
|
|
|
664
664
|
'api/v1/contract_batchorder': 1,
|
|
665
665
|
'api/v1/contract_cancel': 1,
|
|
666
666
|
'api/v1/contract_cancelall': 1,
|
|
667
|
-
'api/v1/contract_switch_lever_rate':
|
|
667
|
+
'api/v1/contract_switch_lever_rate': 30,
|
|
668
668
|
'api/v1/lightning_close_position': 1,
|
|
669
669
|
'api/v1/contract_order_info': 1,
|
|
670
670
|
'api/v1/contract_order_detail': 1,
|
|
@@ -723,7 +723,7 @@ export default class htx extends Exchange {
|
|
|
723
723
|
'swap-api/v1/swap_cancel': 1,
|
|
724
724
|
'swap-api/v1/swap_cancelall': 1,
|
|
725
725
|
'swap-api/v1/swap_lightning_close_position': 1,
|
|
726
|
-
'swap-api/v1/swap_switch_lever_rate':
|
|
726
|
+
'swap-api/v1/swap_switch_lever_rate': 30,
|
|
727
727
|
'swap-api/v1/swap_order_info': 1,
|
|
728
728
|
'swap-api/v1/swap_order_detail': 1,
|
|
729
729
|
'swap-api/v1/swap_openorders': 1,
|
|
@@ -797,8 +797,8 @@ export default class htx extends Exchange {
|
|
|
797
797
|
'linear-swap-api/v1/swap_cross_cancel': 1,
|
|
798
798
|
'linear-swap-api/v1/swap_cancelall': 1,
|
|
799
799
|
'linear-swap-api/v1/swap_cross_cancelall': 1,
|
|
800
|
-
'linear-swap-api/v1/swap_switch_lever_rate':
|
|
801
|
-
'linear-swap-api/v1/swap_cross_switch_lever_rate':
|
|
800
|
+
'linear-swap-api/v1/swap_switch_lever_rate': 30,
|
|
801
|
+
'linear-swap-api/v1/swap_cross_switch_lever_rate': 30,
|
|
802
802
|
'linear-swap-api/v1/swap_lightning_close_position': 1,
|
|
803
803
|
'linear-swap-api/v1/swap_cross_lightning_close_position': 1,
|
|
804
804
|
'linear-swap-api/v1/swap_order_info': 1,
|
package/js/src/kucoinfutures.js
CHANGED
|
@@ -229,7 +229,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
229
229
|
'429': RateLimitExceeded,
|
|
230
230
|
'500': ExchangeNotAvailable,
|
|
231
231
|
'503': ExchangeNotAvailable,
|
|
232
|
-
'100001':
|
|
232
|
+
'100001': OrderNotFound,
|
|
233
233
|
'100004': BadRequest,
|
|
234
234
|
'101030': PermissionDenied,
|
|
235
235
|
'200004': InsufficientFunds,
|
|
@@ -248,7 +248,8 @@ export default class kucoinfutures extends kucoin {
|
|
|
248
248
|
'400100': BadRequest,
|
|
249
249
|
'411100': AccountSuspended,
|
|
250
250
|
'500000': ExchangeNotAvailable,
|
|
251
|
-
'300009': InvalidOrder,
|
|
251
|
+
'300009': InvalidOrder,
|
|
252
|
+
'330008': InsufficientFunds, // {"msg":"Your current margin and leverage have reached the maximum open limit. Please increase your margin or raise your leverage to open larger positions.","code":"330008"}
|
|
252
253
|
},
|
|
253
254
|
'broad': {
|
|
254
255
|
'Position does not exist': OrderNotFound, // { "code":"200000", "msg":"Position does not exist" }
|
|
@@ -469,7 +470,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
469
470
|
// }
|
|
470
471
|
// }
|
|
471
472
|
//
|
|
472
|
-
const data = this.
|
|
473
|
+
const data = this.safeDict(response, 'data', {});
|
|
473
474
|
const status = this.safeString(data, 'status');
|
|
474
475
|
return {
|
|
475
476
|
'status': (status === 'open') ? 'ok' : 'maintenance',
|
|
@@ -552,7 +553,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
552
553
|
// }
|
|
553
554
|
//
|
|
554
555
|
const result = [];
|
|
555
|
-
const data = this.
|
|
556
|
+
const data = this.safeList(response, 'data', []);
|
|
556
557
|
for (let i = 0; i < data.length; i++) {
|
|
557
558
|
const market = data[i];
|
|
558
559
|
const id = this.safeString(market, 'symbol');
|
|
@@ -769,7 +770,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
769
770
|
// }
|
|
770
771
|
// }
|
|
771
772
|
//
|
|
772
|
-
const data = this.
|
|
773
|
+
const data = this.safeDict(response, 'data', {});
|
|
773
774
|
const address = this.safeString(data, 'address');
|
|
774
775
|
if (currencyId !== 'NIM') {
|
|
775
776
|
// contains spaces
|
|
@@ -833,7 +834,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
833
834
|
// }
|
|
834
835
|
// }
|
|
835
836
|
//
|
|
836
|
-
const data = this.
|
|
837
|
+
const data = this.safeDict(response, 'data', {});
|
|
837
838
|
const timestamp = this.parseToInt(this.safeInteger(data, 'ts') / 1000000);
|
|
838
839
|
const orderbook = this.parseOrderBook(data, market['symbol'], timestamp, 'bids', 'asks', 0, 1);
|
|
839
840
|
orderbook['nonce'] = this.safeInteger(data, 'sequence');
|
|
@@ -1163,7 +1164,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
1163
1164
|
// }
|
|
1164
1165
|
//
|
|
1165
1166
|
const data = this.safeValue(response, 'data');
|
|
1166
|
-
const dataList = this.
|
|
1167
|
+
const dataList = this.safeList(data, 'dataList', []);
|
|
1167
1168
|
const fees = [];
|
|
1168
1169
|
for (let i = 0; i < dataList.length; i++) {
|
|
1169
1170
|
const listItem = dataList[i];
|
|
@@ -2124,7 +2125,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
2124
2125
|
// }
|
|
2125
2126
|
// }
|
|
2126
2127
|
//
|
|
2127
|
-
const responseData = this.
|
|
2128
|
+
const responseData = this.safeDict(response, 'data', {});
|
|
2128
2129
|
const orders = this.safeList(responseData, 'items', []);
|
|
2129
2130
|
return this.parseOrders(orders, market, since, limit);
|
|
2130
2131
|
}
|
|
@@ -3052,7 +3053,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
3052
3053
|
// ]
|
|
3053
3054
|
// }
|
|
3054
3055
|
//
|
|
3055
|
-
const data = this.
|
|
3056
|
+
const data = this.safeList(response, 'data', []);
|
|
3056
3057
|
return this.parseMarketLeverageTiers(data, market);
|
|
3057
3058
|
}
|
|
3058
3059
|
parseMarketLeverageTiers(info, market = undefined) {
|
|
@@ -3141,7 +3142,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
3141
3142
|
// ]
|
|
3142
3143
|
// }
|
|
3143
3144
|
//
|
|
3144
|
-
const data = this.
|
|
3145
|
+
const data = this.safeList(response, 'data', []);
|
|
3145
3146
|
return this.parseFundingRateHistories(data, market, since, limit);
|
|
3146
3147
|
}
|
|
3147
3148
|
parseFundingRateHistory(info, market = undefined) {
|
package/js/src/mexc.d.ts
CHANGED
|
@@ -653,11 +653,14 @@ export default class mexc extends Exchange {
|
|
|
653
653
|
* @name mexc#withdraw
|
|
654
654
|
* @description make a withdrawal
|
|
655
655
|
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#withdraw-new
|
|
656
|
+
* @see https://www.mexc.com/api-docs/spot-v3/wallet-endpoints#internal-transfer
|
|
656
657
|
* @param {string} code unified currency code
|
|
657
658
|
* @param {float} amount the amount to withdraw
|
|
658
659
|
* @param {string} address the address to withdraw to
|
|
659
660
|
* @param {string} tag
|
|
660
661
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
662
|
+
* @param {object} [params.internal] false by default, set to true for an "internal transfer"
|
|
663
|
+
* @param {object} [params.toAccountType] skipped by default, set to 'EMAIL|UID|MOBILE' when making an "internal transfer"
|
|
661
664
|
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
662
665
|
*/
|
|
663
666
|
withdraw(code: string, amount: number, address: string, tag?: Str, params?: {}): Promise<Transaction>;
|
package/js/src/mexc.js
CHANGED
|
@@ -4998,7 +4998,13 @@ export default class mexc extends Exchange {
|
|
|
4998
4998
|
// "id":"25fb2831fb6d4fc7aa4094612a26c81d"
|
|
4999
4999
|
// }
|
|
5000
5000
|
//
|
|
5001
|
-
|
|
5001
|
+
// internal withdraw (aka internal-transfer)
|
|
5002
|
+
//
|
|
5003
|
+
// {
|
|
5004
|
+
// "tranId":"ad36f0e9c9a24ae794b36fa4f152e471"
|
|
5005
|
+
// }
|
|
5006
|
+
//
|
|
5007
|
+
const id = this.safeString2(transaction, 'id', 'tranId');
|
|
5002
5008
|
const type = (id === undefined) ? 'deposit' : 'withdrawal';
|
|
5003
5009
|
const timestamp = this.safeInteger2(transaction, 'insertTime', 'applyTime');
|
|
5004
5010
|
const updated = this.safeInteger(transaction, 'updateTime');
|
|
@@ -5511,17 +5517,40 @@ export default class mexc extends Exchange {
|
|
|
5511
5517
|
* @name mexc#withdraw
|
|
5512
5518
|
* @description make a withdrawal
|
|
5513
5519
|
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#withdraw-new
|
|
5520
|
+
* @see https://www.mexc.com/api-docs/spot-v3/wallet-endpoints#internal-transfer
|
|
5514
5521
|
* @param {string} code unified currency code
|
|
5515
5522
|
* @param {float} amount the amount to withdraw
|
|
5516
5523
|
* @param {string} address the address to withdraw to
|
|
5517
5524
|
* @param {string} tag
|
|
5518
5525
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5526
|
+
* @param {object} [params.internal] false by default, set to true for an "internal transfer"
|
|
5527
|
+
* @param {object} [params.toAccountType] skipped by default, set to 'EMAIL|UID|MOBILE' when making an "internal transfer"
|
|
5519
5528
|
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5520
5529
|
*/
|
|
5521
5530
|
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
5522
5531
|
await this.loadMarkets();
|
|
5523
5532
|
const currency = this.currency(code);
|
|
5524
5533
|
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
5534
|
+
const internal = this.safeBool(params, 'internal', false);
|
|
5535
|
+
if (internal) {
|
|
5536
|
+
params = this.omit(params, 'internal');
|
|
5537
|
+
const requestForInternal = {
|
|
5538
|
+
'asset': currency['id'],
|
|
5539
|
+
'amount': amount,
|
|
5540
|
+
'toAccount': address,
|
|
5541
|
+
};
|
|
5542
|
+
const toAccountType = this.safeString(params, 'toAccountType');
|
|
5543
|
+
if (toAccountType === undefined) {
|
|
5544
|
+
throw new ArgumentsRequired(this.id + ' withdraw() requires a toAccountType parameter for internal transfer to be of: EMAIL | UID | MOBILE');
|
|
5545
|
+
}
|
|
5546
|
+
const responseForInternal = await this.spotPrivatePostCapitalTransferInternal(this.extend(requestForInternal, params));
|
|
5547
|
+
//
|
|
5548
|
+
// {
|
|
5549
|
+
// "id":"7213fea8e94b4a5593d507237e5a555b"
|
|
5550
|
+
// }
|
|
5551
|
+
//
|
|
5552
|
+
return this.parseTransaction(responseForInternal, currency);
|
|
5553
|
+
}
|
|
5525
5554
|
const networks = this.safeDict(this.options, 'networks', {});
|
|
5526
5555
|
let network = this.safeString2(params, 'network', 'netWork'); // this line allows the user to specify either ERC20 or ETH
|
|
5527
5556
|
network = this.safeString(networks, network, network); // handle ETH > ERC-20 alias
|
package/js/src/okx.d.ts
CHANGED
|
@@ -138,6 +138,7 @@ export default class okx extends Exchange {
|
|
|
138
138
|
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-mark-price-candlesticks-history
|
|
139
139
|
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-index-candlesticks
|
|
140
140
|
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-index-candlesticks-history
|
|
141
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-candlesticks-history
|
|
141
142
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
142
143
|
* @param {string} timeframe the length of time each candle represents
|
|
143
144
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -145,6 +146,7 @@ export default class okx extends Exchange {
|
|
|
145
146
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
146
147
|
* @param {string} [params.price] "mark" or "index" for mark price and index price candles
|
|
147
148
|
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
149
|
+
* @param {string} [params.type] "Candles" or "HistoryCandles", default is "Candles" for recent candles, "HistoryCandles" for older candles
|
|
148
150
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
149
151
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
150
152
|
*/
|
|
@@ -190,8 +192,8 @@ export default class okx extends Exchange {
|
|
|
190
192
|
/**
|
|
191
193
|
* @method
|
|
192
194
|
* @name okx#createMarketBuyOrderWithCost
|
|
193
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
194
195
|
* @description create a market buy order by providing the symbol and cost
|
|
196
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
195
197
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
196
198
|
* @param {float} cost how much you want to trade in units of the quote currency
|
|
197
199
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -201,8 +203,8 @@ export default class okx extends Exchange {
|
|
|
201
203
|
/**
|
|
202
204
|
* @method
|
|
203
205
|
* @name okx#createMarketSellOrderWithCost
|
|
204
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
205
206
|
* @description create a market buy order by providing the symbol and cost
|
|
207
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
206
208
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
207
209
|
* @param {float} cost how much you want to trade in units of the quote currency
|
|
208
210
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
package/js/src/okx.js
CHANGED
|
@@ -214,6 +214,7 @@ export default class okx extends Exchange {
|
|
|
214
214
|
'market/open-oracle': 50,
|
|
215
215
|
'market/exchange-rate': 20,
|
|
216
216
|
'market/index-components': 1,
|
|
217
|
+
'public/market-data-history': 4,
|
|
217
218
|
'public/economic-calendar': 50,
|
|
218
219
|
'market/block-tickers': 1,
|
|
219
220
|
'market/block-ticker': 1,
|
|
@@ -365,7 +366,7 @@ export default class okx extends Exchange {
|
|
|
365
366
|
'account/fixed-loan/borrowing-limit': 4,
|
|
366
367
|
'account/fixed-loan/borrowing-quote': 5,
|
|
367
368
|
'account/fixed-loan/borrowing-orders-list': 5,
|
|
368
|
-
'account/spot-manual-borrow-repay':
|
|
369
|
+
'account/spot-manual-borrow-repay': 30,
|
|
369
370
|
'account/set-auto-repay': 4,
|
|
370
371
|
'account/spot-borrow-repay-history': 4,
|
|
371
372
|
'account/move-positions-history': 10,
|
|
@@ -2420,6 +2421,7 @@ export default class okx extends Exchange {
|
|
|
2420
2421
|
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-mark-price-candlesticks-history
|
|
2421
2422
|
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-index-candlesticks
|
|
2422
2423
|
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-index-candlesticks-history
|
|
2424
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-candlesticks-history
|
|
2423
2425
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
2424
2426
|
* @param {string} timeframe the length of time each candle represents
|
|
2425
2427
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -2427,6 +2429,7 @@ export default class okx extends Exchange {
|
|
|
2427
2429
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2428
2430
|
* @param {string} [params.price] "mark" or "index" for mark price and index price candles
|
|
2429
2431
|
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
2432
|
+
* @param {string} [params.type] "Candles" or "HistoryCandles", default is "Candles" for recent candles, "HistoryCandles" for older candles
|
|
2430
2433
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
2431
2434
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
2432
2435
|
*/
|
|
@@ -2442,6 +2445,7 @@ export default class okx extends Exchange {
|
|
|
2442
2445
|
params = this.omit(params, 'price');
|
|
2443
2446
|
const options = this.safeDict(this.options, 'fetchOHLCV', {});
|
|
2444
2447
|
const timezone = this.safeString(options, 'timezone', 'UTC');
|
|
2448
|
+
const limitIsUndefined = (limit === undefined);
|
|
2445
2449
|
if (limit === undefined) {
|
|
2446
2450
|
limit = 100; // default 100, max 100
|
|
2447
2451
|
}
|
|
@@ -2466,7 +2470,8 @@ export default class okx extends Exchange {
|
|
|
2466
2470
|
const historyBorder = now - ((1440 - 1) * durationInMilliseconds);
|
|
2467
2471
|
if (since < historyBorder) {
|
|
2468
2472
|
defaultType = 'HistoryCandles';
|
|
2469
|
-
|
|
2473
|
+
const maxLimit = (price !== undefined) ? 100 : 300;
|
|
2474
|
+
limit = Math.min(limit, maxLimit); // max 300 for historical endpoint
|
|
2470
2475
|
}
|
|
2471
2476
|
const startTime = Math.max(since - 1, 0);
|
|
2472
2477
|
request['before'] = startTime;
|
|
@@ -2501,6 +2506,10 @@ export default class okx extends Exchange {
|
|
|
2501
2506
|
}
|
|
2502
2507
|
else {
|
|
2503
2508
|
if (isHistoryCandles) {
|
|
2509
|
+
if (limitIsUndefined && (limit === 100)) {
|
|
2510
|
+
limit = 300;
|
|
2511
|
+
request['limit'] = 300; // reassign to 300, but this whole logic needs to be simplified...
|
|
2512
|
+
}
|
|
2504
2513
|
response = await this.publicGetMarketHistoryCandles(this.extend(request, params));
|
|
2505
2514
|
}
|
|
2506
2515
|
else {
|
|
@@ -2848,8 +2857,8 @@ export default class okx extends Exchange {
|
|
|
2848
2857
|
/**
|
|
2849
2858
|
* @method
|
|
2850
2859
|
* @name okx#createMarketBuyOrderWithCost
|
|
2851
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
2852
2860
|
* @description create a market buy order by providing the symbol and cost
|
|
2861
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
2853
2862
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
2854
2863
|
* @param {float} cost how much you want to trade in units of the quote currency
|
|
2855
2864
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -2870,8 +2879,8 @@ export default class okx extends Exchange {
|
|
|
2870
2879
|
/**
|
|
2871
2880
|
* @method
|
|
2872
2881
|
* @name okx#createMarketSellOrderWithCost
|
|
2873
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
2874
2882
|
* @description create a market buy order by providing the symbol and cost
|
|
2883
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
2875
2884
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
2876
2885
|
* @param {float} cost how much you want to trade in units of the quote currency
|
|
2877
2886
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -2934,6 +2943,8 @@ export default class okx extends Exchange {
|
|
|
2934
2943
|
const takeProfitDefined = (takeProfit !== undefined);
|
|
2935
2944
|
const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRatio');
|
|
2936
2945
|
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
2946
|
+
const trailingPrice = this.safeString2(params, 'trailingPrice', 'callbackSpread');
|
|
2947
|
+
const isTrailingPriceOrder = trailingPrice !== undefined;
|
|
2937
2948
|
const trigger = (triggerPrice !== undefined) || (type === 'trigger');
|
|
2938
2949
|
const isReduceOnly = this.safeValue(params, 'reduceOnly', false);
|
|
2939
2950
|
const defaultMarginMode = this.safeString2(this.options, 'defaultMarginMode', 'marginMode', 'cross');
|
|
@@ -3050,6 +3061,10 @@ export default class okx extends Exchange {
|
|
|
3050
3061
|
request['callbackRatio'] = convertedTrailingPercent;
|
|
3051
3062
|
request['ordType'] = 'move_order_stop';
|
|
3052
3063
|
}
|
|
3064
|
+
else if (isTrailingPriceOrder) {
|
|
3065
|
+
request['callbackSpread'] = trailingPrice;
|
|
3066
|
+
request['ordType'] = 'move_order_stop';
|
|
3067
|
+
}
|
|
3053
3068
|
else if (stopLossDefined || takeProfitDefined) {
|
|
3054
3069
|
if (stopLossDefined) {
|
|
3055
3070
|
const stopLossTriggerPrice = this.safeValueN(stopLoss, ['triggerPrice', 'stopPrice', 'slTriggerPx']);
|
package/js/src/pro/binance.js
CHANGED
|
@@ -3244,8 +3244,8 @@ export default class binance extends binanceRest {
|
|
|
3244
3244
|
await this.loadMarkets();
|
|
3245
3245
|
const market = this.market(symbol);
|
|
3246
3246
|
const type = this.getMarketType('cancelAllOrdersWs', market, params);
|
|
3247
|
-
if (type !== 'spot'
|
|
3248
|
-
throw new BadRequest(this.id + ' cancelAllOrdersWs only supports spot
|
|
3247
|
+
if (type !== 'spot') {
|
|
3248
|
+
throw new BadRequest(this.id + ' cancelAllOrdersWs only supports spot markets');
|
|
3249
3249
|
}
|
|
3250
3250
|
const url = this.urls['api']['ws']['ws-api'][type];
|
|
3251
3251
|
const requestId = this.requestId(url);
|
|
@@ -3258,7 +3258,7 @@ export default class binance extends binanceRest {
|
|
|
3258
3258
|
};
|
|
3259
3259
|
const message = {
|
|
3260
3260
|
'id': messageHash,
|
|
3261
|
-
'method': '
|
|
3261
|
+
'method': 'openOrders.cancelAll',
|
|
3262
3262
|
'params': this.signParams(this.extend(payload, params)),
|
|
3263
3263
|
};
|
|
3264
3264
|
const subscription = {
|
package/js/src/pro/bitfinex.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import Client from '../base/ws/Client.js';
|
|
|
4
4
|
export default class bitfinex extends bitfinexRest {
|
|
5
5
|
describe(): any;
|
|
6
6
|
subscribe(channel: any, symbol: any, params?: {}): Promise<any>;
|
|
7
|
+
unSubscribe(channel: any, topic: any, symbol: any, params?: {}): Promise<any>;
|
|
7
8
|
subscribePrivate(messageHash: any): Promise<any>;
|
|
8
9
|
/**
|
|
9
10
|
* @method
|
|
@@ -17,6 +18,16 @@ export default class bitfinex extends bitfinexRest {
|
|
|
17
18
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
18
19
|
*/
|
|
19
20
|
watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
21
|
+
/**
|
|
22
|
+
* @method
|
|
23
|
+
* @name bitfinex#unWatchOHLCV
|
|
24
|
+
* @description unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
25
|
+
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
26
|
+
* @param {string} timeframe the length of time each candle represents
|
|
27
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
28
|
+
* @returns {bool} true if successfully unsubscribed, false otherwise
|
|
29
|
+
*/
|
|
30
|
+
unWatchOHLCV(symbol: string, timeframe?: string, params?: {}): Promise<any>;
|
|
20
31
|
handleOHLCV(client: Client, message: any, subscription: any): void;
|
|
21
32
|
/**
|
|
22
33
|
* @method
|
|
@@ -29,6 +40,15 @@ export default class bitfinex extends bitfinexRest {
|
|
|
29
40
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
30
41
|
*/
|
|
31
42
|
watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
43
|
+
/**
|
|
44
|
+
* @method
|
|
45
|
+
* @name bitfinex#unWatchTrades
|
|
46
|
+
* @description unWatches the list of most recent trades for a particular symbol
|
|
47
|
+
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
48
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
49
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
50
|
+
*/
|
|
51
|
+
unWatchTrades(symbol: string, params?: {}): Promise<any>;
|
|
32
52
|
/**
|
|
33
53
|
* @method
|
|
34
54
|
* @name bitfinex#watchMyTrades
|
|
@@ -49,6 +69,15 @@ export default class bitfinex extends bitfinexRest {
|
|
|
49
69
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
50
70
|
*/
|
|
51
71
|
watchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
72
|
+
/**
|
|
73
|
+
* @method
|
|
74
|
+
* @name bitfinex#unWatchTicker
|
|
75
|
+
* @description unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
76
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
77
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
78
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
79
|
+
*/
|
|
80
|
+
unWatchTicker(symbol: string, params?: {}): Promise<any>;
|
|
52
81
|
handleMyTrade(client: Client, message: any, subscription?: {}): void;
|
|
53
82
|
handleTrades(client: Client, message: any, subscription: any): void;
|
|
54
83
|
parseWsTrade(trade: any, market?: any): Trade;
|
|
@@ -78,6 +107,7 @@ export default class bitfinex extends bitfinexRest {
|
|
|
78
107
|
handleBalance(client: Client, message: any, subscription: any): void;
|
|
79
108
|
parseWsBalance(balance: any): import("../base/types.js").BalanceAccount;
|
|
80
109
|
handleSystemStatus(client: Client, message: any): any;
|
|
110
|
+
handleUnsubscriptionStatus(client: Client, message: any): boolean;
|
|
81
111
|
handleSubscriptionStatus(client: Client, message: any): any;
|
|
82
112
|
authenticate(params?: {}): Promise<any>;
|
|
83
113
|
handleAuthenticationMessage(client: Client, message: any): void;
|