ccxt 4.5.5 → 4.5.6
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 +15 -15
- package/dist/cjs/ccxt.js +6 -6
- package/dist/cjs/src/abstract/toobit.js +11 -0
- package/dist/cjs/src/abstract/tradeogre.js +1 -1
- package/dist/cjs/src/backpack.js +1 -1
- package/dist/cjs/src/base/Exchange.js +129 -2
- package/dist/cjs/src/bigone.js +4 -4
- package/dist/cjs/src/binance.js +79 -20
- package/dist/cjs/src/bingx.js +5 -2
- package/dist/cjs/src/bitget.js +16 -9
- package/dist/cjs/src/bybit.js +186 -127
- package/dist/cjs/src/coinsph.js +4 -1
- package/dist/cjs/src/cryptocom.js +6 -3
- package/dist/cjs/src/gate.js +1 -1
- package/dist/cjs/src/gemini.js +2 -2
- package/dist/cjs/src/hyperliquid.js +3 -0
- package/dist/cjs/src/kraken.js +6 -2
- package/dist/cjs/src/kucoin.js +1 -2
- package/dist/cjs/src/luno.js +4 -1
- package/dist/cjs/src/mexc.js +4 -1
- package/dist/cjs/src/okcoin.js +4 -1
- package/dist/cjs/src/okx.js +34 -3
- package/dist/cjs/src/phemex.js +1 -1
- package/dist/cjs/src/pro/apex.js +1 -0
- package/dist/cjs/src/pro/backpack.js +1 -1
- package/dist/cjs/src/pro/binance.js +150 -19
- package/dist/cjs/src/pro/bitget.js +332 -76
- package/dist/cjs/src/pro/cex.js +1 -0
- package/dist/cjs/src/pro/independentreserve.js +1 -0
- package/dist/cjs/src/pro/mexc.js +23 -23
- package/dist/cjs/src/pro/okx.js +46 -10
- package/dist/cjs/src/pro/toobit.js +1163 -0
- package/dist/cjs/src/pro/tradeogre.js +1 -1
- package/dist/cjs/src/toobit.js +2999 -0
- package/dist/cjs/src/tradeogre.js +1 -1
- package/js/ccxt.d.ts +8 -8
- package/js/ccxt.js +6 -6
- 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/abstract/toobit.d.ts +66 -0
- package/js/src/backpack.js +1 -1
- package/js/src/base/Exchange.d.ts +9 -0
- package/js/src/base/Exchange.js +129 -2
- package/js/src/bigone.js +4 -4
- package/js/src/binance.d.ts +9 -0
- package/js/src/binance.js +79 -20
- package/js/src/bingx.js +5 -2
- package/js/src/bitget.js +16 -9
- package/js/src/bybit.d.ts +8 -0
- package/js/src/bybit.js +186 -127
- package/js/src/coinsph.js +4 -1
- package/js/src/cryptocom.js +6 -3
- package/js/src/gate.js +1 -1
- package/js/src/gemini.js +2 -2
- package/js/src/hyperliquid.js +3 -0
- package/js/src/kraken.d.ts +1 -1
- package/js/src/kraken.js +6 -2
- package/js/src/kucoin.js +1 -2
- package/js/src/luno.js +4 -1
- package/js/src/mexc.js +4 -1
- package/js/src/okcoin.js +4 -1
- package/js/src/okx.js +34 -3
- package/js/src/phemex.js +1 -1
- package/js/src/pro/apex.js +1 -0
- package/js/src/pro/backpack.d.ts +1 -1
- package/js/src/pro/backpack.js +1 -1
- package/js/src/pro/binance.d.ts +24 -0
- package/js/src/pro/binance.js +150 -19
- package/js/src/pro/bitget.d.ts +6 -0
- package/js/src/pro/bitget.js +332 -76
- package/js/src/pro/cex.js +1 -0
- package/js/src/pro/independentreserve.js +1 -0
- package/js/src/pro/mexc.js +23 -23
- package/js/src/pro/okx.d.ts +7 -1
- package/js/src/pro/okx.js +46 -10
- package/js/src/pro/toobit.d.ts +174 -0
- package/js/src/pro/toobit.js +1162 -0
- package/js/src/toobit.d.ts +456 -0
- package/js/src/toobit.js +2992 -0
- package/package.json +1 -1
- package/dist/373.ccxt.browser.js +0 -7630
- package/dist/373.ccxt.browser.min.js +0 -1
- package/js/src/abstract/tradeogre.d.ts +0 -21
- package/js/src/pro/tradeogre.d.ts +0 -49
- package/js/src/pro/tradeogre.js +0 -278
- package/js/src/tradeogre.d.ts +0 -149
- package/js/src/tradeogre.js +0 -872
- /package/js/src/abstract/{tradeogre.js → toobit.js} +0 -0
package/js/src/binance.js
CHANGED
|
@@ -202,6 +202,20 @@ export default class binance extends Exchange {
|
|
|
202
202
|
'private': 'https://testnet.binance.vision/api/v3',
|
|
203
203
|
'v1': 'https://testnet.binance.vision/api/v1',
|
|
204
204
|
},
|
|
205
|
+
'demo': {
|
|
206
|
+
'dapiPublic': 'https://demo-dapi.binance.com/dapi/v1',
|
|
207
|
+
'dapiPrivate': 'https://demo-dapi.binance.com/dapi/v1',
|
|
208
|
+
'dapiPrivateV2': 'https://demo-dapi.binance.com/dapi/v2',
|
|
209
|
+
'fapiPublic': 'https://demo-fapi.binance.com/fapi/v1',
|
|
210
|
+
'fapiPublicV2': 'https://demo-fapi.binance.com/fapi/v2',
|
|
211
|
+
'fapiPublicV3': 'https://demo-fapi.binance.com/fapi/v3',
|
|
212
|
+
'fapiPrivate': 'https://demo-fapi.binance.com/fapi/v1',
|
|
213
|
+
'fapiPrivateV2': 'https://demo-fapi.binance.com/fapi/v2',
|
|
214
|
+
'fapiPrivateV3': 'https://demo-fapi.binance.com/fapi/v3',
|
|
215
|
+
'public': 'https://demo-api.binance.com/api/v3',
|
|
216
|
+
'private': 'https://demo-api.binance.com/api/v3',
|
|
217
|
+
'v1': 'https://demo-api.binance.com/api/v1',
|
|
218
|
+
},
|
|
205
219
|
'api': {
|
|
206
220
|
'sapi': 'https://api.binance.com/sapi/v1',
|
|
207
221
|
'sapiV2': 'https://api.binance.com/sapi/v2',
|
|
@@ -1387,6 +1401,9 @@ export default class binance extends Exchange {
|
|
|
1387
1401
|
'features': {
|
|
1388
1402
|
'spot': {
|
|
1389
1403
|
'sandbox': true,
|
|
1404
|
+
'fetchCurrencies': {
|
|
1405
|
+
'private': true,
|
|
1406
|
+
},
|
|
1390
1407
|
'createOrder': {
|
|
1391
1408
|
'marginMode': true,
|
|
1392
1409
|
'triggerPrice': true,
|
|
@@ -2753,6 +2770,29 @@ export default class binance extends Exchange {
|
|
|
2753
2770
|
nonce() {
|
|
2754
2771
|
return this.milliseconds() - this.options['timeDifference'];
|
|
2755
2772
|
}
|
|
2773
|
+
/**
|
|
2774
|
+
* @method
|
|
2775
|
+
* @name binance#enableDemoTrading
|
|
2776
|
+
* @description enables or disables demo trading mode
|
|
2777
|
+
* @see https://www.binance.com/en/support/faq/detail/9be58f73e5e14338809e3b705b9687dd
|
|
2778
|
+
* @see https://demo.binance.com/en/my/settings/api-management
|
|
2779
|
+
* @param {boolean} [enable] true if demo trading should be enabled, false otherwise
|
|
2780
|
+
*/
|
|
2781
|
+
enableDemoTrading(enable) {
|
|
2782
|
+
if (this.isSandboxModeEnabled) {
|
|
2783
|
+
throw new NotSupported(this.id + ' demo trading is not supported in the sandbox environment. Please check https://www.binance.com/en/support/faq/detail/9be58f73e5e14338809e3b705b9687dd to see the differences');
|
|
2784
|
+
}
|
|
2785
|
+
if (enable) {
|
|
2786
|
+
this.urls['apiBackupDemoTrading'] = this.urls['api'];
|
|
2787
|
+
this.urls['api'] = this.urls['demo'];
|
|
2788
|
+
}
|
|
2789
|
+
else if ('apiBackupDemoTrading' in this.urls) {
|
|
2790
|
+
this.urls['api'] = this.urls['apiBackupDemoTrading'];
|
|
2791
|
+
const newUrls = this.omit(this.urls, 'apiBackupDemoTrading');
|
|
2792
|
+
this.urls = newUrls;
|
|
2793
|
+
}
|
|
2794
|
+
this.options['enableDemoTrading'] = enable;
|
|
2795
|
+
}
|
|
2756
2796
|
/**
|
|
2757
2797
|
* @method
|
|
2758
2798
|
* @name binance#fetchTime
|
|
@@ -2794,19 +2834,23 @@ export default class binance extends Exchange {
|
|
|
2794
2834
|
async fetchCurrencies(params = {}) {
|
|
2795
2835
|
const fetchCurrenciesEnabled = this.safeBool(this.options, 'fetchCurrencies');
|
|
2796
2836
|
if (!fetchCurrenciesEnabled) {
|
|
2797
|
-
return
|
|
2837
|
+
return {};
|
|
2798
2838
|
}
|
|
2799
2839
|
// this endpoint requires authentication
|
|
2800
2840
|
// while fetchCurrencies is a public API method by design
|
|
2801
2841
|
// therefore we check the keys here
|
|
2802
2842
|
// and fallback to generating the currencies from the markets
|
|
2803
2843
|
if (!this.checkRequiredCredentials(false)) {
|
|
2804
|
-
return
|
|
2844
|
+
return {};
|
|
2805
2845
|
}
|
|
2806
2846
|
// sandbox/testnet does not support sapi endpoints
|
|
2807
2847
|
const apiBackup = this.safeValue(this.urls, 'apiBackup');
|
|
2808
2848
|
if (apiBackup !== undefined) {
|
|
2809
|
-
return
|
|
2849
|
+
return {};
|
|
2850
|
+
}
|
|
2851
|
+
// demotrading does not support sapi endpoints
|
|
2852
|
+
if (this.safeBool(this.options, 'enableDemoTrading', false)) {
|
|
2853
|
+
return {};
|
|
2810
2854
|
}
|
|
2811
2855
|
const promises = [this.sapiGetCapitalConfigGetall(params)];
|
|
2812
2856
|
const fetchMargins = this.safeBool(this.options, 'fetchMargins', false);
|
|
@@ -2880,7 +2924,7 @@ export default class binance extends Exchange {
|
|
|
2880
2924
|
// "addressRegex": "^(bnb1)[0-9a-z]{38}$",
|
|
2881
2925
|
// "addressRule": "",
|
|
2882
2926
|
// "memoRegex": "^[0-9A-Za-z\\-_]{1,120}$",
|
|
2883
|
-
// "withdrawFee": "0.
|
|
2927
|
+
// "withdrawFee": "0.003",
|
|
2884
2928
|
// "withdrawMin": "0.01",
|
|
2885
2929
|
// "withdrawMax": "10000000000",
|
|
2886
2930
|
// "minConfirm": "1",
|
|
@@ -3051,10 +3095,12 @@ export default class binance extends Exchange {
|
|
|
3051
3095
|
}
|
|
3052
3096
|
}
|
|
3053
3097
|
const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
|
|
3098
|
+
const demoMode = this.safeBool(this.options, 'enableDemoTrading', false);
|
|
3099
|
+
const isDemoEnv = demoMode || sandboxMode;
|
|
3054
3100
|
const fetchMarkets = [];
|
|
3055
3101
|
for (let i = 0; i < rawFetchMarkets.length; i++) {
|
|
3056
3102
|
const type = rawFetchMarkets[i];
|
|
3057
|
-
if (type === 'option' &&
|
|
3103
|
+
if (type === 'option' && isDemoEnv) {
|
|
3058
3104
|
continue;
|
|
3059
3105
|
}
|
|
3060
3106
|
fetchMarkets.push(type);
|
|
@@ -3064,7 +3110,7 @@ export default class binance extends Exchange {
|
|
|
3064
3110
|
const marketType = fetchMarkets[i];
|
|
3065
3111
|
if (marketType === 'spot') {
|
|
3066
3112
|
promisesRaw.push(this.publicGetExchangeInfo(params));
|
|
3067
|
-
if (fetchMargins && this.checkRequiredCredentials(false) && !
|
|
3113
|
+
if (fetchMargins && this.checkRequiredCredentials(false) && !isDemoEnv) {
|
|
3068
3114
|
promisesRaw.push(this.sapiGetMarginAllPairs(params));
|
|
3069
3115
|
promisesRaw.push(this.sapiGetMarginIsolatedAllPairs(params));
|
|
3070
3116
|
}
|
|
@@ -6395,6 +6441,7 @@ export default class binance extends Exchange {
|
|
|
6395
6441
|
const isConditional = isTriggerOrder || isTrailingPercentOrder || isStopLoss || isTakeProfit;
|
|
6396
6442
|
const isPortfolioMarginConditional = (isPortfolioMargin && isConditional);
|
|
6397
6443
|
const isPriceMatch = priceMatch !== undefined;
|
|
6444
|
+
let priceRequiredForTrailing = true;
|
|
6398
6445
|
let uppercaseType = type.toUpperCase();
|
|
6399
6446
|
let stopPrice = undefined;
|
|
6400
6447
|
if (isTrailingPercentOrder) {
|
|
@@ -6406,19 +6453,31 @@ export default class binance extends Exchange {
|
|
|
6406
6453
|
}
|
|
6407
6454
|
}
|
|
6408
6455
|
else {
|
|
6409
|
-
if (
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6456
|
+
if ((uppercaseType !== 'STOP_LOSS') && (uppercaseType !== 'TAKE_PROFIT') && (uppercaseType !== 'STOP_LOSS_LIMIT') && (uppercaseType !== 'TAKE_PROFIT_LIMIT')) {
|
|
6457
|
+
const stopLossOrTakeProfit = this.safeString(params, 'stopLossOrTakeProfit');
|
|
6458
|
+
params = this.omit(params, 'stopLossOrTakeProfit');
|
|
6459
|
+
if ((stopLossOrTakeProfit !== 'stopLoss') && (stopLossOrTakeProfit !== 'takeProfit')) {
|
|
6460
|
+
throw new InvalidOrder(this.id + symbol + ' trailingPercent orders require a stopLossOrTakeProfit parameter of either stopLoss or takeProfit');
|
|
6461
|
+
}
|
|
6462
|
+
if (isMarketOrder) {
|
|
6463
|
+
if (stopLossOrTakeProfit === 'stopLoss') {
|
|
6464
|
+
uppercaseType = 'STOP_LOSS';
|
|
6465
|
+
}
|
|
6466
|
+
else if (stopLossOrTakeProfit === 'takeProfit') {
|
|
6467
|
+
uppercaseType = 'TAKE_PROFIT';
|
|
6468
|
+
}
|
|
6469
|
+
}
|
|
6470
|
+
else {
|
|
6471
|
+
if (stopLossOrTakeProfit === 'stopLoss') {
|
|
6472
|
+
uppercaseType = 'STOP_LOSS_LIMIT';
|
|
6473
|
+
}
|
|
6474
|
+
else if (stopLossOrTakeProfit === 'takeProfit') {
|
|
6475
|
+
uppercaseType = 'TAKE_PROFIT_LIMIT';
|
|
6476
|
+
}
|
|
6477
|
+
}
|
|
6419
6478
|
}
|
|
6420
|
-
|
|
6421
|
-
|
|
6479
|
+
if ((uppercaseType === 'STOP_LOSS') || (uppercaseType === 'TAKE_PROFIT')) {
|
|
6480
|
+
priceRequiredForTrailing = false;
|
|
6422
6481
|
}
|
|
6423
6482
|
if (trailingTriggerPrice !== undefined) {
|
|
6424
6483
|
stopPrice = this.priceToPrecision(symbol, trailingTriggerPrice);
|
|
@@ -6572,7 +6631,7 @@ export default class binance extends Exchange {
|
|
|
6572
6631
|
else if ((uppercaseType === 'STOP_LOSS') || (uppercaseType === 'TAKE_PROFIT')) {
|
|
6573
6632
|
triggerPriceIsRequired = true;
|
|
6574
6633
|
quantityIsRequired = true;
|
|
6575
|
-
if (market['linear'] || market['inverse']) {
|
|
6634
|
+
if ((market['linear'] || market['inverse']) && priceRequiredForTrailing) {
|
|
6576
6635
|
priceIsRequired = true;
|
|
6577
6636
|
}
|
|
6578
6637
|
}
|
|
@@ -11861,7 +11920,7 @@ export default class binance extends Exchange {
|
|
|
11861
11920
|
// "asset": "USDT",
|
|
11862
11921
|
// "amount": "-0.16518203",
|
|
11863
11922
|
// "type": "FEE",
|
|
11864
|
-
// "createDate":
|
|
11923
|
+
// "createDate": 167662104241
|
|
11865
11924
|
// }
|
|
11866
11925
|
//
|
|
11867
11926
|
// futures (fapi, dapi, papi)
|
package/js/src/bingx.js
CHANGED
|
@@ -661,6 +661,9 @@ export default class bingx extends Exchange {
|
|
|
661
661
|
//
|
|
662
662
|
'spot': {
|
|
663
663
|
'extends': 'defaultForLinear',
|
|
664
|
+
'fetchCurrencies': {
|
|
665
|
+
'private': true,
|
|
666
|
+
},
|
|
664
667
|
'createOrder': {
|
|
665
668
|
'triggerPriceType': undefined,
|
|
666
669
|
'attachedStopLossTakeProfit': undefined,
|
|
@@ -732,11 +735,11 @@ export default class bingx extends Exchange {
|
|
|
732
735
|
*/
|
|
733
736
|
async fetchCurrencies(params = {}) {
|
|
734
737
|
if (!this.checkRequiredCredentials(false)) {
|
|
735
|
-
return
|
|
738
|
+
return {};
|
|
736
739
|
}
|
|
737
740
|
const isSandbox = this.safeBool(this.options, 'sandboxMode', false);
|
|
738
741
|
if (isSandbox) {
|
|
739
|
-
return
|
|
742
|
+
return {};
|
|
740
743
|
}
|
|
741
744
|
const response = await this.walletsV1PrivateGetCapitalConfigGetall(params);
|
|
742
745
|
//
|
package/js/src/bitget.js
CHANGED
|
@@ -1321,6 +1321,8 @@ export default class bitget extends Exchange {
|
|
|
1321
1321
|
'43025': InvalidOrder,
|
|
1322
1322
|
'43115': OnMaintenance,
|
|
1323
1323
|
'45110': InvalidOrder,
|
|
1324
|
+
'40774': InvalidOrder,
|
|
1325
|
+
'45122': InvalidOrder,
|
|
1324
1326
|
// spot
|
|
1325
1327
|
'invalid sign': AuthenticationError,
|
|
1326
1328
|
'invalid currency': BadSymbol,
|
|
@@ -5242,6 +5244,14 @@ export default class bitget extends Exchange {
|
|
|
5242
5244
|
'symbol': market['id'],
|
|
5243
5245
|
'orderType': type,
|
|
5244
5246
|
};
|
|
5247
|
+
let hedged = undefined;
|
|
5248
|
+
[hedged, params] = this.handleParamBool(params, 'hedged', false);
|
|
5249
|
+
// backward compatibility for `oneWayMode`
|
|
5250
|
+
let oneWayMode = undefined;
|
|
5251
|
+
[oneWayMode, params] = this.handleParamBool(params, 'oneWayMode');
|
|
5252
|
+
if (oneWayMode !== undefined) {
|
|
5253
|
+
hedged = !oneWayMode;
|
|
5254
|
+
}
|
|
5245
5255
|
const isMarketOrder = type === 'market';
|
|
5246
5256
|
const triggerPrice = this.safeValue2(params, 'stopPrice', 'triggerPrice');
|
|
5247
5257
|
const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
|
|
@@ -5335,7 +5345,12 @@ export default class bitget extends Exchange {
|
|
|
5335
5345
|
if (!isMarketOrder) {
|
|
5336
5346
|
throw new ExchangeError(this.id + ' createOrder() bitget stopLoss or takeProfit orders must be market orders');
|
|
5337
5347
|
}
|
|
5338
|
-
|
|
5348
|
+
if (hedged) {
|
|
5349
|
+
request['holdSide'] = (side === 'sell') ? 'long' : 'short';
|
|
5350
|
+
}
|
|
5351
|
+
else {
|
|
5352
|
+
request['holdSide'] = (side === 'sell') ? 'buy' : 'sell';
|
|
5353
|
+
}
|
|
5339
5354
|
if (isStopLossTriggerOrder) {
|
|
5340
5355
|
request['triggerPrice'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
5341
5356
|
request['planType'] = 'pos_loss';
|
|
@@ -5361,14 +5376,6 @@ export default class bitget extends Exchange {
|
|
|
5361
5376
|
}
|
|
5362
5377
|
const marginModeRequest = (marginMode === 'cross') ? 'crossed' : 'isolated';
|
|
5363
5378
|
request['marginMode'] = marginModeRequest;
|
|
5364
|
-
let hedged = undefined;
|
|
5365
|
-
[hedged, params] = this.handleParamBool(params, 'hedged', false);
|
|
5366
|
-
// backward compatibility for `oneWayMode`
|
|
5367
|
-
let oneWayMode = undefined;
|
|
5368
|
-
[oneWayMode, params] = this.handleParamBool(params, 'oneWayMode');
|
|
5369
|
-
if (oneWayMode !== undefined) {
|
|
5370
|
-
hedged = !oneWayMode;
|
|
5371
|
-
}
|
|
5372
5379
|
let requestSide = side;
|
|
5373
5380
|
if (reduceOnly) {
|
|
5374
5381
|
if (!hedged) {
|
package/js/src/bybit.d.ts
CHANGED
|
@@ -6,6 +6,13 @@ import type { Int, OrderSide, OrderType, Trade, Order, OHLCV, FundingRateHistory
|
|
|
6
6
|
*/
|
|
7
7
|
export default class bybit extends Exchange {
|
|
8
8
|
describe(): any;
|
|
9
|
+
/**
|
|
10
|
+
* @method
|
|
11
|
+
* @name bybit#enableDemoTrading
|
|
12
|
+
* @description enables or disables demo trading mode
|
|
13
|
+
* @see https://bybit-exchange.github.io/docs/v5/demo
|
|
14
|
+
* @param {boolean} [enable] true if demo trading should be enabled, false otherwise
|
|
15
|
+
*/
|
|
9
16
|
enableDemoTrading(enable: boolean): void;
|
|
10
17
|
nonce(): number;
|
|
11
18
|
addPaginationCursorToResult(response: any): any[];
|
|
@@ -615,6 +622,7 @@ export default class bybit extends Exchange {
|
|
|
615
622
|
* @param {string} address the address to withdraw to
|
|
616
623
|
* @param {string} tag
|
|
617
624
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
625
|
+
* @param {string} [params.accountType] 'UTA', 'FUND', 'FUND,UTA', and 'SPOT (for classic accounts only)
|
|
618
626
|
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
619
627
|
*/
|
|
620
628
|
withdraw(code: string, amount: number, address: string, tag?: Str, params?: {}): Promise<Transaction>;
|