ccxt 4.5.5 → 4.5.7
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/apex.js +2 -2
- 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 +82 -20
- package/dist/cjs/src/bingx.js +5 -2
- package/dist/cjs/src/bitbank.js +1 -0
- package/dist/cjs/src/bitbns.js +1 -0
- package/dist/cjs/src/bitflyer.js +1 -0
- package/dist/cjs/src/bitget.js +16 -9
- package/dist/cjs/src/bithumb.js +1 -0
- package/dist/cjs/src/bitso.js +1 -0
- package/dist/cjs/src/bitvavo.js +26 -40
- package/dist/cjs/src/blockchaincom.js +1 -0
- package/dist/cjs/src/btcalpha.js +1 -0
- package/dist/cjs/src/btcbox.js +1 -0
- package/dist/cjs/src/btcmarkets.js +1 -0
- package/dist/cjs/src/btcturk.js +1 -0
- 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/deribit.js +3 -2
- package/dist/cjs/src/digifinex.js +1 -1
- package/dist/cjs/src/gate.js +9 -13
- package/dist/cjs/src/gemini.js +5 -5
- package/dist/cjs/src/htx.js +11 -1
- package/dist/cjs/src/hyperliquid.js +3 -0
- package/dist/cjs/src/independentreserve.js +1 -0
- package/dist/cjs/src/indodax.js +17 -6
- package/dist/cjs/src/kraken.js +31 -8
- package/dist/cjs/src/krakenfutures.js +1 -0
- package/dist/cjs/src/kucoin.js +1 -2
- package/dist/cjs/src/luno.js +4 -1
- package/dist/cjs/src/mercado.js +1 -0
- package/dist/cjs/src/mexc.js +84 -37
- package/dist/cjs/src/novadax.js +1 -0
- package/dist/cjs/src/oceanex.js +1 -0
- package/dist/cjs/src/okcoin.js +4 -1
- package/dist/cjs/src/okx.js +52 -8
- package/dist/cjs/src/phemex.js +1 -1
- package/dist/cjs/src/pro/apex.js +8 -4
- package/dist/cjs/src/pro/backpack.js +7 -5
- package/dist/cjs/src/pro/binance.js +150 -19
- package/dist/cjs/src/pro/bingx.js +206 -220
- package/dist/cjs/src/pro/bitget.js +332 -76
- package/dist/cjs/src/pro/cex.js +1 -0
- package/dist/cjs/src/pro/htx.js +1 -1
- 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/dist/cjs/src/upbit.js +1 -0
- package/dist/cjs/src/wavesexchange.js +1 -0
- package/dist/cjs/src/yobit.js +1 -0
- package/dist/cjs/src/zaif.js +1 -0
- package/dist/cjs/src/zonda.js +1 -0
- package/js/ccxt.d.ts +8 -8
- package/js/ccxt.js +6 -6
- package/js/src/abstract/mexc.d.ts +1 -0
- 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/apex.js +2 -2
- 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 +82 -20
- package/js/src/bingx.js +5 -2
- package/js/src/bitbank.js +1 -0
- package/js/src/bitbns.js +1 -0
- package/js/src/bitflyer.js +1 -0
- package/js/src/bitget.js +16 -9
- package/js/src/bithumb.js +1 -0
- package/js/src/bitso.js +1 -0
- package/js/src/bitvavo.d.ts +0 -2
- package/js/src/bitvavo.js +27 -41
- package/js/src/blockchaincom.js +1 -0
- package/js/src/btcalpha.js +1 -0
- package/js/src/btcbox.js +1 -0
- package/js/src/btcmarkets.js +1 -0
- package/js/src/btcturk.js +1 -0
- 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/deribit.js +3 -2
- package/js/src/digifinex.js +1 -1
- package/js/src/gate.d.ts +2 -2
- package/js/src/gate.js +9 -13
- package/js/src/gemini.js +5 -5
- package/js/src/htx.js +11 -1
- package/js/src/hyperliquid.js +3 -0
- package/js/src/independentreserve.js +1 -0
- package/js/src/indodax.js +17 -6
- package/js/src/kraken.d.ts +2 -2
- package/js/src/kraken.js +31 -8
- package/js/src/krakenfutures.js +1 -0
- package/js/src/kucoin.js +1 -2
- package/js/src/luno.js +4 -1
- package/js/src/mercado.js +1 -0
- package/js/src/mexc.d.ts +4 -1
- package/js/src/mexc.js +84 -37
- package/js/src/novadax.js +1 -0
- package/js/src/oceanex.js +1 -0
- package/js/src/okcoin.js +4 -1
- package/js/src/okx.js +52 -8
- package/js/src/phemex.js +1 -1
- package/js/src/pro/apex.js +8 -4
- package/js/src/pro/backpack.d.ts +1 -1
- package/js/src/pro/backpack.js +7 -5
- package/js/src/pro/binance.d.ts +24 -0
- package/js/src/pro/binance.js +150 -19
- package/js/src/pro/bingx.d.ts +53 -33
- package/js/src/pro/bingx.js +207 -221
- 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/htx.js +1 -1
- 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/js/src/upbit.js +1 -0
- package/js/src/wavesexchange.js +1 -0
- package/js/src/yobit.js +1 -0
- package/js/src/zaif.js +1 -0
- package/js/src/zonda.js +1 -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)
|
|
@@ -12003,6 +12062,9 @@ export default class binance extends Exchange {
|
|
|
12003
12062
|
}
|
|
12004
12063
|
else if ((api === 'private') || (api === 'eapiPrivate') || (api === 'sapi' && path !== 'system/status') || (api === 'sapiV2') || (api === 'sapiV3') || (api === 'sapiV4') || (api === 'dapiPrivate') || (api === 'dapiPrivateV2') || (api === 'fapiPrivate') || (api === 'fapiPrivateV2') || (api === 'fapiPrivateV3') || (api === 'papi' && path !== 'ping')) {
|
|
12005
12064
|
this.checkRequiredCredentials();
|
|
12065
|
+
if ((url.indexOf('testnet.binancefuture.com') > -1) && this.isSandboxModeEnabled && (!this.safeBool(this.options, 'disableFuturesSandboxWarning'))) {
|
|
12066
|
+
throw new NotSupported(this.id + ' testnet/sandbox mode is not supported for futures anymore, please check the deprecation announcement https://t.me/ccxt_announcements/92 and consider using the demo trading instead.');
|
|
12067
|
+
}
|
|
12006
12068
|
if (method === 'POST' && ((path === 'order') || (path === 'sor/order'))) {
|
|
12007
12069
|
// inject in implicit API calls
|
|
12008
12070
|
const newClientOrderId = this.safeString(params, 'newClientOrderId');
|
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/bitbank.js
CHANGED
|
@@ -43,6 +43,7 @@ export default class bitbank extends Exchange {
|
|
|
43
43
|
'fetchBorrowRatesPerSymbol': false,
|
|
44
44
|
'fetchCrossBorrowRate': false,
|
|
45
45
|
'fetchCrossBorrowRates': false,
|
|
46
|
+
'fetchCurrencies': false,
|
|
46
47
|
'fetchDepositAddress': true,
|
|
47
48
|
'fetchDepositAddresses': false,
|
|
48
49
|
'fetchDepositAddressesByNetwork': false,
|
package/js/src/bitbns.js
CHANGED
|
@@ -32,6 +32,7 @@ export default class bitbns extends Exchange {
|
|
|
32
32
|
'createStopOrder': true,
|
|
33
33
|
'createTriggerOrder': true,
|
|
34
34
|
'fetchBalance': true,
|
|
35
|
+
'fechCurrencies': false,
|
|
35
36
|
'fetchDepositAddress': true,
|
|
36
37
|
'fetchDepositAddresses': false,
|
|
37
38
|
'fetchDepositAddressesByNetwork': false,
|
package/js/src/bitflyer.js
CHANGED
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/bithumb.js
CHANGED
|
@@ -45,6 +45,7 @@ export default class bithumb extends Exchange {
|
|
|
45
45
|
'fetchBorrowRatesPerSymbol': false,
|
|
46
46
|
'fetchCrossBorrowRate': false,
|
|
47
47
|
'fetchCrossBorrowRates': false,
|
|
48
|
+
'fetchCurrencies': false,
|
|
48
49
|
'fetchFundingHistory': false,
|
|
49
50
|
'fetchFundingInterval': false,
|
|
50
51
|
'fetchFundingIntervals': false,
|
package/js/src/bitso.js
CHANGED
|
@@ -48,6 +48,7 @@ export default class bitso extends Exchange {
|
|
|
48
48
|
'fetchBorrowRatesPerSymbol': false,
|
|
49
49
|
'fetchCrossBorrowRate': false,
|
|
50
50
|
'fetchCrossBorrowRates': false,
|
|
51
|
+
'fetchCurrencies': false,
|
|
51
52
|
'fetchDeposit': true,
|
|
52
53
|
'fetchDepositAddress': true,
|
|
53
54
|
'fetchDepositAddresses': false,
|
package/js/src/bitvavo.d.ts
CHANGED
|
@@ -6,8 +6,6 @@ import type { Balances, Currencies, Currency, Dict, Int, Market, Num, OHLCV, Ord
|
|
|
6
6
|
*/
|
|
7
7
|
export default class bitvavo extends Exchange {
|
|
8
8
|
describe(): any;
|
|
9
|
-
amountToPrecision(symbol: any, amount: any): string;
|
|
10
|
-
priceToPrecision(symbol: any, price: any): string;
|
|
11
9
|
/**
|
|
12
10
|
* @method
|
|
13
11
|
* @name bitvavo#fetchTime
|
package/js/src/bitvavo.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// ----------------------------------------------------------------------------
|
|
2
2
|
import Exchange from './abstract/bitvavo.js';
|
|
3
3
|
import { ExchangeError, BadSymbol, AuthenticationError, InsufficientFunds, InvalidOrder, ArgumentsRequired, OrderNotFound, InvalidAddress, BadRequest, RateLimitExceeded, PermissionDenied, ExchangeNotAvailable, AccountSuspended, OnMaintenance } from './base/errors.js';
|
|
4
|
-
import {
|
|
4
|
+
import { TRUNCATE, TICK_SIZE } from './base/functions/number.js';
|
|
5
5
|
import { Precise } from './base/Precise.js';
|
|
6
6
|
import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
|
|
7
7
|
// ----------------------------------------------------------------------------
|
|
@@ -377,26 +377,12 @@ export default class bitvavo extends Exchange {
|
|
|
377
377
|
'operatorId': undefined,
|
|
378
378
|
'fiatCurrencies': ['EUR'], // only fiat atm
|
|
379
379
|
},
|
|
380
|
-
'precisionMode':
|
|
380
|
+
'precisionMode': TICK_SIZE,
|
|
381
381
|
'commonCurrencies': {
|
|
382
382
|
'MIOTA': 'IOTA', // https://github.com/ccxt/ccxt/issues/7487
|
|
383
383
|
},
|
|
384
384
|
});
|
|
385
385
|
}
|
|
386
|
-
amountToPrecision(symbol, amount) {
|
|
387
|
-
// https://docs.bitfinex.com/docs/introduction#amount-precision
|
|
388
|
-
// The amount field allows up to 8 decimals.
|
|
389
|
-
// Anything exceeding this will be rounded to the 8th decimal.
|
|
390
|
-
return this.decimalToPrecision(amount, TRUNCATE, this.markets[symbol]['precision']['amount'], DECIMAL_PLACES);
|
|
391
|
-
}
|
|
392
|
-
priceToPrecision(symbol, price) {
|
|
393
|
-
price = this.decimalToPrecision(price, ROUND, this.markets[symbol]['precision']['price'], this.precisionMode);
|
|
394
|
-
// https://docs.bitfinex.com/docs/introduction#price-precision
|
|
395
|
-
// The precision level of all trading prices is based on significant figures.
|
|
396
|
-
// All pairs on Bitfinex use up to 5 significant digits and up to 8 decimals (e.g. 1.2345, 123.45, 1234.5, 0.00012345).
|
|
397
|
-
// Prices submit with a precision larger than 5 will be cut by the API.
|
|
398
|
-
return this.decimalToPrecision(price, TRUNCATE, 8, DECIMAL_PLACES);
|
|
399
|
-
}
|
|
400
386
|
/**
|
|
401
387
|
* @method
|
|
402
388
|
* @name bitvavo#fetchTime
|
|
@@ -422,24 +408,27 @@ export default class bitvavo extends Exchange {
|
|
|
422
408
|
async fetchMarkets(params = {}) {
|
|
423
409
|
const response = await this.publicGetMarkets(params);
|
|
424
410
|
//
|
|
425
|
-
//
|
|
426
|
-
//
|
|
427
|
-
//
|
|
428
|
-
//
|
|
429
|
-
//
|
|
430
|
-
//
|
|
431
|
-
//
|
|
432
|
-
//
|
|
433
|
-
//
|
|
434
|
-
//
|
|
435
|
-
//
|
|
436
|
-
//
|
|
411
|
+
// {
|
|
412
|
+
// "market": "BTC-EUR",
|
|
413
|
+
// "status": "trading",
|
|
414
|
+
// "base": "BTC",
|
|
415
|
+
// "quote": "EUR",
|
|
416
|
+
// "pricePrecision": "0", // deprecated, this is mostly 0 across other markets too, which is abnormal, so we ignore this.
|
|
417
|
+
// "tickSize": "1.00",
|
|
418
|
+
// "minOrderInBaseAsset": "0.00006100",
|
|
419
|
+
// "minOrderInQuoteAsset": "5.00",
|
|
420
|
+
// "maxOrderInBaseAsset": "1000000000.00000000",
|
|
421
|
+
// "maxOrderInQuoteAsset": "1000000000.00",
|
|
422
|
+
// "quantityDecimals": "8",
|
|
423
|
+
// "notionalDecimals": "2",
|
|
424
|
+
// "maxOpenOrders": "100",
|
|
425
|
+
// "feeCategory": "A",
|
|
426
|
+
// "orderTypes": [ "market", "limit", "stopLoss", "stopLossLimit", "takeProfit", "takeProfitLimit" ]
|
|
427
|
+
// }
|
|
437
428
|
//
|
|
438
429
|
return this.parseMarkets(response);
|
|
439
430
|
}
|
|
440
431
|
parseMarkets(markets) {
|
|
441
|
-
const currencies = this.currencies;
|
|
442
|
-
const currenciesById = this.indexBy(currencies, 'id');
|
|
443
432
|
const result = [];
|
|
444
433
|
const fees = this.fees;
|
|
445
434
|
for (let i = 0; i < markets.length; i++) {
|
|
@@ -450,8 +439,6 @@ export default class bitvavo extends Exchange {
|
|
|
450
439
|
const base = this.safeCurrencyCode(baseId);
|
|
451
440
|
const quote = this.safeCurrencyCode(quoteId);
|
|
452
441
|
const status = this.safeString(market, 'status');
|
|
453
|
-
const baseCurrency = this.safeValue(currenciesById, baseId);
|
|
454
|
-
const basePrecision = this.safeInteger(baseCurrency, 'precision');
|
|
455
442
|
result.push(this.safeMarketStructure({
|
|
456
443
|
'id': id,
|
|
457
444
|
'symbol': base + '/' + quote,
|
|
@@ -479,8 +466,9 @@ export default class bitvavo extends Exchange {
|
|
|
479
466
|
'taker': fees['trading']['taker'],
|
|
480
467
|
'maker': fees['trading']['maker'],
|
|
481
468
|
'precision': {
|
|
482
|
-
'amount': this.
|
|
483
|
-
'price': this.
|
|
469
|
+
'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'quantityDecimals'))),
|
|
470
|
+
'price': this.safeNumber(market, 'tickSize'),
|
|
471
|
+
'cost': this.parseNumber(this.parsePrecision(this.safeString(market, 'notionalDecimals'))),
|
|
484
472
|
},
|
|
485
473
|
'limits': {
|
|
486
474
|
'leverage': {
|
|
@@ -489,7 +477,7 @@ export default class bitvavo extends Exchange {
|
|
|
489
477
|
},
|
|
490
478
|
'amount': {
|
|
491
479
|
'min': this.safeNumber(market, 'minOrderInBaseAsset'),
|
|
492
|
-
'max':
|
|
480
|
+
'max': this.safeNumber(market, 'maxOrderInBaseAsset'),
|
|
493
481
|
},
|
|
494
482
|
'price': {
|
|
495
483
|
'min': undefined,
|
|
@@ -497,7 +485,7 @@ export default class bitvavo extends Exchange {
|
|
|
497
485
|
},
|
|
498
486
|
'cost': {
|
|
499
487
|
'min': this.safeNumber(market, 'minOrderInQuoteAsset'),
|
|
500
|
-
'max':
|
|
488
|
+
'max': this.safeNumber(market, 'maxOrderInQuoteAsset'),
|
|
501
489
|
},
|
|
502
490
|
},
|
|
503
491
|
'created': undefined,
|
|
@@ -598,7 +586,7 @@ export default class bitvavo extends Exchange {
|
|
|
598
586
|
const withdrawal = this.safeString(currency, 'withdrawalStatus') === 'OK';
|
|
599
587
|
const active = deposit && withdrawal;
|
|
600
588
|
const withdrawFee = this.safeNumber(currency, 'withdrawalFee');
|
|
601
|
-
const precision = this.
|
|
589
|
+
const precision = this.safeString(currency, 'decimals', '8');
|
|
602
590
|
const minWithdraw = this.safeNumber(currency, 'withdrawalMinAmount');
|
|
603
591
|
// btw, absolutely all of them have 1 network atm
|
|
604
592
|
for (let j = 0; j < networksArray.length; j++) {
|
|
@@ -612,7 +600,7 @@ export default class bitvavo extends Exchange {
|
|
|
612
600
|
'deposit': deposit,
|
|
613
601
|
'withdraw': withdrawal,
|
|
614
602
|
'fee': withdrawFee,
|
|
615
|
-
'precision': precision,
|
|
603
|
+
'precision': this.parseNumber(this.parsePrecision(precision)),
|
|
616
604
|
'limits': {
|
|
617
605
|
'withdraw': {
|
|
618
606
|
'min': minWithdraw,
|
|
@@ -631,7 +619,7 @@ export default class bitvavo extends Exchange {
|
|
|
631
619
|
'withdraw': withdrawal,
|
|
632
620
|
'networks': networks,
|
|
633
621
|
'fee': withdrawFee,
|
|
634
|
-
'precision':
|
|
622
|
+
'precision': undefined,
|
|
635
623
|
'type': isFiat ? 'fiat' : 'crypto',
|
|
636
624
|
'limits': {
|
|
637
625
|
'amount': {
|
|
@@ -649,8 +637,6 @@ export default class bitvavo extends Exchange {
|
|
|
649
637
|
},
|
|
650
638
|
});
|
|
651
639
|
}
|
|
652
|
-
// set currencies here to avoid calling publicGetAssets twice
|
|
653
|
-
this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, result));
|
|
654
640
|
return result;
|
|
655
641
|
}
|
|
656
642
|
/**
|
package/js/src/blockchaincom.js
CHANGED
package/js/src/btcalpha.js
CHANGED
|
@@ -49,6 +49,7 @@ export default class btcalpha extends Exchange {
|
|
|
49
49
|
'fetchClosedOrders': true,
|
|
50
50
|
'fetchCrossBorrowRate': false,
|
|
51
51
|
'fetchCrossBorrowRates': false,
|
|
52
|
+
'fetchCurrencies': false,
|
|
52
53
|
'fetchDeposit': false,
|
|
53
54
|
'fetchDepositAddress': false,
|
|
54
55
|
'fetchDepositAddresses': false,
|
package/js/src/btcbox.js
CHANGED
|
@@ -47,6 +47,7 @@ export default class btcbox extends Exchange {
|
|
|
47
47
|
'fetchBorrowRatesPerSymbol': false,
|
|
48
48
|
'fetchCrossBorrowRate': false,
|
|
49
49
|
'fetchCrossBorrowRates': false,
|
|
50
|
+
'fetchCurrencies': false,
|
|
50
51
|
'fetchFundingHistory': false,
|
|
51
52
|
'fetchFundingInterval': false,
|
|
52
53
|
'fetchFundingIntervals': false,
|
package/js/src/btcmarkets.js
CHANGED
|
@@ -49,6 +49,7 @@ export default class btcmarkets extends Exchange {
|
|
|
49
49
|
'fetchClosedOrders': 'emulated',
|
|
50
50
|
'fetchCrossBorrowRate': false,
|
|
51
51
|
'fetchCrossBorrowRates': false,
|
|
52
|
+
'fetchCurrencies': false,
|
|
52
53
|
'fetchDepositAddress': false,
|
|
53
54
|
'fetchDepositAddresses': false,
|
|
54
55
|
'fetchDepositAddressesByNetwork': false,
|
package/js/src/btcturk.js
CHANGED
|
@@ -46,6 +46,7 @@ export default class btcturk extends Exchange {
|
|
|
46
46
|
'fetchBorrowRatesPerSymbol': false,
|
|
47
47
|
'fetchCrossBorrowRate': false,
|
|
48
48
|
'fetchCrossBorrowRates': false,
|
|
49
|
+
'fetchCurrencies': false,
|
|
49
50
|
'fetchDepositAddress': false,
|
|
50
51
|
'fetchDepositAddresses': false,
|
|
51
52
|
'fetchDepositAddressesByNetwork': false,
|
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>;
|