ccxt 4.2.88 → 4.2.89

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.
Files changed (125) hide show
  1. package/README.md +3 -3
  2. package/build.sh +1 -1
  3. package/dist/ccxt.browser.js +234 -128
  4. package/dist/ccxt.browser.min.js +3 -3
  5. package/dist/cjs/ccxt.js +1 -1
  6. package/dist/cjs/src/ascendex.js +2 -0
  7. package/dist/cjs/src/base/Exchange.js +15 -7
  8. package/dist/cjs/src/binance.js +2 -0
  9. package/dist/cjs/src/bitflyer.js +2 -0
  10. package/dist/cjs/src/bitget.js +7 -1
  11. package/dist/cjs/src/bitmart.js +2 -0
  12. package/dist/cjs/src/bitstamp.js +83 -99
  13. package/dist/cjs/src/blofin.js +2 -0
  14. package/dist/cjs/src/bybit.js +2 -0
  15. package/dist/cjs/src/coinsph.js +2 -0
  16. package/dist/cjs/src/digifinex.js +2 -0
  17. package/dist/cjs/src/gate.js +2 -0
  18. package/dist/cjs/src/hitbtc.js +2 -0
  19. package/dist/cjs/src/htx.js +2 -0
  20. package/dist/cjs/src/kucoin.js +39 -15
  21. package/dist/cjs/src/latoken.js +4 -0
  22. package/dist/cjs/src/lbank.js +3 -1
  23. package/dist/cjs/src/luno.js +2 -0
  24. package/dist/cjs/src/mexc.js +54 -6
  25. package/dist/cjs/src/okx.js +2 -0
  26. package/dist/cjs/src/pro/bitget.js +2 -0
  27. package/dist/cjs/src/timex.js +2 -0
  28. package/js/ccxt.d.ts +1 -1
  29. package/js/ccxt.js +1 -1
  30. package/js/src/ascendex.d.ts +3 -3
  31. package/js/src/ascendex.js +2 -0
  32. package/js/src/base/Exchange.d.ts +8 -8
  33. package/js/src/base/Exchange.js +15 -7
  34. package/js/src/base/types.d.ts +34 -1
  35. package/js/src/bigone.d.ts +2 -2
  36. package/js/src/binance.d.ts +5 -15
  37. package/js/src/binance.js +2 -0
  38. package/js/src/bingx.d.ts +2 -2
  39. package/js/src/bit2c.d.ts +2 -2
  40. package/js/src/bitbank.d.ts +2 -2
  41. package/js/src/bitfinex.d.ts +2 -2
  42. package/js/src/bitfinex2.d.ts +3 -3
  43. package/js/src/bitflyer.d.ts +2 -7
  44. package/js/src/bitflyer.js +2 -0
  45. package/js/src/bitget.d.ts +6 -9
  46. package/js/src/bitget.js +7 -1
  47. package/js/src/bitmart.d.ts +4 -14
  48. package/js/src/bitmart.js +2 -0
  49. package/js/src/bitmex.d.ts +2 -2
  50. package/js/src/bitopro.d.ts +3 -3
  51. package/js/src/bitrue.d.ts +2 -2
  52. package/js/src/bitso.d.ts +2 -2
  53. package/js/src/bitstamp.d.ts +7 -19
  54. package/js/src/bitstamp.js +83 -99
  55. package/js/src/bitteam.d.ts +2 -2
  56. package/js/src/bitvavo.d.ts +3 -3
  57. package/js/src/bl3p.d.ts +2 -2
  58. package/js/src/blockchaincom.d.ts +2 -2
  59. package/js/src/blofin.d.ts +2 -7
  60. package/js/src/blofin.js +2 -0
  61. package/js/src/bybit.d.ts +5 -15
  62. package/js/src/bybit.js +2 -0
  63. package/js/src/cex.d.ts +3 -3
  64. package/js/src/coinbase.d.ts +2 -2
  65. package/js/src/coinbaseinternational.d.ts +2 -2
  66. package/js/src/coinbasepro.d.ts +3 -3
  67. package/js/src/coincheck.d.ts +2 -2
  68. package/js/src/coinex.d.ts +5 -19
  69. package/js/src/coinlist.d.ts +3 -3
  70. package/js/src/coinmate.d.ts +2 -9
  71. package/js/src/coinmetro.d.ts +2 -2
  72. package/js/src/coinone.d.ts +2 -2
  73. package/js/src/coinsph.d.ts +4 -14
  74. package/js/src/coinsph.js +2 -0
  75. package/js/src/currencycom.d.ts +3 -3
  76. package/js/src/delta.d.ts +2 -2
  77. package/js/src/deribit.d.ts +3 -3
  78. package/js/src/digifinex.d.ts +4 -14
  79. package/js/src/digifinex.js +2 -0
  80. package/js/src/exmo.d.ts +3 -3
  81. package/js/src/gate.d.ts +6 -9
  82. package/js/src/gate.js +2 -0
  83. package/js/src/gemini.d.ts +3 -3
  84. package/js/src/hitbtc.d.ts +5 -15
  85. package/js/src/hitbtc.js +2 -0
  86. package/js/src/hollaex.d.ts +3 -3
  87. package/js/src/htx.d.ts +4 -14
  88. package/js/src/htx.js +2 -0
  89. package/js/src/huobijp.d.ts +2 -2
  90. package/js/src/hyperliquid.d.ts +2 -2
  91. package/js/src/idex.d.ts +3 -3
  92. package/js/src/independentreserve.d.ts +2 -2
  93. package/js/src/kraken.d.ts +3 -10
  94. package/js/src/kucoin.d.ts +3 -10
  95. package/js/src/kucoin.js +39 -15
  96. package/js/src/kuna.d.ts +2 -2
  97. package/js/src/latoken.d.ts +7 -8
  98. package/js/src/latoken.js +4 -0
  99. package/js/src/lbank.d.ts +4 -9
  100. package/js/src/lbank.js +3 -1
  101. package/js/src/luno.d.ts +2 -7
  102. package/js/src/luno.js +2 -0
  103. package/js/src/lykke.d.ts +2 -2
  104. package/js/src/mexc.d.ts +3 -3
  105. package/js/src/mexc.js +54 -6
  106. package/js/src/ndax.d.ts +2 -2
  107. package/js/src/oceanex.d.ts +2 -2
  108. package/js/src/okcoin.d.ts +2 -2
  109. package/js/src/okx.d.ts +4 -14
  110. package/js/src/okx.js +2 -0
  111. package/js/src/onetrading.d.ts +3 -3
  112. package/js/src/phemex.d.ts +2 -2
  113. package/js/src/poloniex.d.ts +3 -3
  114. package/js/src/pro/bitget.js +2 -0
  115. package/js/src/pro/bitvavo.d.ts +2 -2
  116. package/js/src/probit.d.ts +2 -2
  117. package/js/src/timex.d.ts +4 -14
  118. package/js/src/timex.js +2 -0
  119. package/js/src/upbit.d.ts +2 -9
  120. package/js/src/wazirx.d.ts +2 -2
  121. package/js/src/whitebit.d.ts +3 -3
  122. package/js/src/woo.d.ts +3 -3
  123. package/js/src/yobit.d.ts +2 -2
  124. package/package.json +1 -1
  125. package/skip-tests.json +6 -1
package/dist/cjs/ccxt.js CHANGED
@@ -182,7 +182,7 @@ var woo$1 = require('./src/pro/woo.js');
182
182
 
183
183
  //-----------------------------------------------------------------------------
184
184
  // this is updated by vss.js when building
185
- const version = '4.2.88';
185
+ const version = '4.2.89';
186
186
  Exchange["default"].ccxtVersion = version;
187
187
  const exchanges = {
188
188
  'ace': ace,
@@ -1483,6 +1483,8 @@ class ascendex extends ascendex$1 {
1483
1483
  'symbol': symbol,
1484
1484
  'maker': this.safeNumber(takerMaker, 'maker'),
1485
1485
  'taker': this.safeNumber(takerMaker, 'taker'),
1486
+ 'percentage': undefined,
1487
+ 'tierBased': undefined,
1486
1488
  };
1487
1489
  }
1488
1490
  return result;
@@ -109,7 +109,7 @@ class Exchange {
109
109
  this.markets_by_id = undefined;
110
110
  this.symbols = undefined;
111
111
  this.ids = undefined;
112
- this.currencies = undefined;
112
+ this.currencies = {};
113
113
  this.baseCurrencies = undefined;
114
114
  this.quoteCurrencies = undefined;
115
115
  this.currencies_by_id = undefined;
@@ -3788,11 +3788,11 @@ class Exchange {
3788
3788
  if (currencyId !== undefined) {
3789
3789
  code = this.commonCurrencyCode(currencyId.toUpperCase());
3790
3790
  }
3791
- return {
3791
+ return this.safeCurrencyStructure({
3792
3792
  'id': currencyId,
3793
3793
  'code': code,
3794
3794
  'precision': undefined,
3795
- };
3795
+ });
3796
3796
  }
3797
3797
  safeMarket(marketId, market = undefined, delimiter = undefined, marketType = undefined) {
3798
3798
  const result = this.safeMarketStructure({
@@ -4561,11 +4561,18 @@ class Exchange {
4561
4561
  'total': undefined,
4562
4562
  };
4563
4563
  }
4564
- commonCurrencyCode(currency) {
4564
+ commonCurrencyCode(code) {
4565
4565
  if (!this.substituteCommonCurrencyCodes) {
4566
- return currency;
4566
+ return code;
4567
+ }
4568
+ // if the provided code already exists as a value in commonCurrencies dict, then we should not again transform it
4569
+ // more details at: https://github.com/ccxt/ccxt/issues/21112#issuecomment-2031293691
4570
+ const commonCurrencies = Object.values(this.commonCurrencies);
4571
+ const exists = this.inArray(code, commonCurrencies);
4572
+ if (exists) {
4573
+ return code;
4567
4574
  }
4568
- return this.safeString(this.commonCurrencies, currency, currency);
4575
+ return this.safeString(this.commonCurrencies, code, code);
4569
4576
  }
4570
4577
  currency(code) {
4571
4578
  if (this.currencies === undefined) {
@@ -5028,7 +5035,8 @@ class Exchange {
5028
5035
  if (!this.has['fetchTradingFees']) {
5029
5036
  throw new errors.NotSupported(this.id + ' fetchTradingFee() is not supported yet');
5030
5037
  }
5031
- return await this.fetchTradingFees(params);
5038
+ const fees = await this.fetchTradingFees(params);
5039
+ return this.safeDict(fees, symbol);
5032
5040
  }
5033
5041
  parseOpenInterest(interest, market = undefined) {
5034
5042
  throw new errors.NotSupported(this.id + ' parseOpenInterest () is not supported yet');
@@ -8653,6 +8653,8 @@ class binance extends binance$1 {
8653
8653
  'symbol': symbol,
8654
8654
  'maker': this.safeNumber2(fee, 'makerCommission', 'makerCommissionRate'),
8655
8655
  'taker': this.safeNumber2(fee, 'takerCommission', 'takerCommissionRate'),
8656
+ 'percentage': undefined,
8657
+ 'tierBased': undefined,
8656
8658
  };
8657
8659
  }
8658
8660
  async fetchTradingFee(symbol, params = {}) {
@@ -540,6 +540,8 @@ class bitflyer extends bitflyer$1 {
540
540
  'symbol': market['symbol'],
541
541
  'maker': fee,
542
542
  'taker': fee,
543
+ 'percentage': undefined,
544
+ 'tierBased': undefined,
543
545
  };
544
546
  }
545
547
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -2624,7 +2624,11 @@ class bitget extends bitget$1 {
2624
2624
  //
2625
2625
  const marketId = this.safeString(ticker, 'symbol');
2626
2626
  const close = this.safeString(ticker, 'lastPr');
2627
- const timestamp = this.safeInteger(ticker, 'ts');
2627
+ const timestampString = this.omitZero(this.safeString(ticker, 'ts')); // exchange sometimes provided 0
2628
+ let timestamp = undefined;
2629
+ if (timestampString !== undefined) {
2630
+ timestamp = this.parseToInt(timestampString);
2631
+ }
2628
2632
  const change = this.safeString(ticker, 'change24h');
2629
2633
  const open24 = this.safeString(ticker, 'open24');
2630
2634
  const open = this.safeString(ticker, 'open');
@@ -3277,6 +3281,8 @@ class bitget extends bitget$1 {
3277
3281
  'symbol': this.safeSymbol(marketId, market),
3278
3282
  'maker': this.safeNumber(data, 'makerFeeRate'),
3279
3283
  'taker': this.safeNumber(data, 'takerFeeRate'),
3284
+ 'percentage': undefined,
3285
+ 'tierBased': undefined,
3280
3286
  };
3281
3287
  }
3282
3288
  parseOHLCV(ohlcv, market = undefined) {
@@ -2095,6 +2095,8 @@ class bitmart extends bitmart$1 {
2095
2095
  'symbol': symbol,
2096
2096
  'maker': this.safeNumber(fee, 'maker_fee_rate'),
2097
2097
  'taker': this.safeNumber(fee, 'taker_fee_rate'),
2098
+ 'percentage': undefined,
2099
+ 'tierBased': undefined,
2098
2100
  };
2099
2101
  }
2100
2102
  async fetchTradingFee(symbol, params = {}) {
@@ -428,6 +428,30 @@ class bitstamp extends bitstamp$1 {
428
428
  'commonCurrencies': {
429
429
  'UST': 'USTC',
430
430
  },
431
+ // exchange-specific options
432
+ 'options': {
433
+ 'networksById': {
434
+ 'bitcoin-cash': 'BCH',
435
+ 'bitcoin': 'BTC',
436
+ 'ethereum': 'ERC20',
437
+ 'litecoin': 'LTC',
438
+ 'stellar': 'XLM',
439
+ 'xrpl': 'XRP',
440
+ 'tron': 'TRC20',
441
+ 'algorand': 'ALGO',
442
+ 'flare': 'FLR',
443
+ 'hedera': 'HBAR',
444
+ 'cardana': 'ADA',
445
+ 'songbird': 'FLR',
446
+ 'avalanche-c-chain': 'AVAX',
447
+ 'solana': 'SOL',
448
+ 'polkadot': 'DOT',
449
+ 'near': 'NEAR',
450
+ 'doge': 'DOGE',
451
+ 'sui': 'SUI',
452
+ 'casper': 'CSRP',
453
+ },
454
+ },
431
455
  'exceptions': {
432
456
  'exact': {
433
457
  'No permission found': errors.PermissionDenied,
@@ -1200,6 +1224,8 @@ class bitstamp extends bitstamp$1 {
1200
1224
  'symbol': this.safeSymbol(marketId, market),
1201
1225
  'maker': this.safeNumber(fees, 'maker'),
1202
1226
  'taker': this.safeNumber(fees, 'taker'),
1227
+ 'percentage': undefined,
1228
+ 'tierBased': undefined,
1203
1229
  };
1204
1230
  }
1205
1231
  parseTradingFees(fees) {
@@ -1245,60 +1271,41 @@ class bitstamp extends bitstamp$1 {
1245
1271
  * @name bitstamp#fetchTransactionFees
1246
1272
  * @deprecated
1247
1273
  * @description please use fetchDepositWithdrawFees instead
1248
- * @see https://www.bitstamp.net/api/#balance
1274
+ * @see https://www.bitstamp.net/api/#tag/Fees
1249
1275
  * @param {string[]|undefined} codes list of unified currency codes
1250
1276
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1251
1277
  * @returns {object[]} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
1252
1278
  */
1253
1279
  await this.loadMarkets();
1254
- const balance = await this.privatePostBalance(params);
1255
- return this.parseTransactionFees(balance);
1280
+ const response = await this.privatePostFeesWithdrawal(params);
1281
+ //
1282
+ // [
1283
+ // {
1284
+ // "currency": "btc",
1285
+ // "fee": "0.00015000",
1286
+ // "network": "bitcoin"
1287
+ // }
1288
+ // ...
1289
+ // ]
1290
+ //
1291
+ return this.parseTransactionFees(response);
1256
1292
  }
1257
1293
  parseTransactionFees(response, codes = undefined) {
1258
- //
1259
- // {
1260
- // "yfi_available": "0.00000000",
1261
- // "yfi_balance": "0.00000000",
1262
- // "yfi_reserved": "0.00000000",
1263
- // "yfi_withdrawal_fee": "0.00070000",
1264
- // "yfieur_fee": "0.000",
1265
- // "yfiusd_fee": "0.000",
1266
- // "zrx_available": "0.00000000",
1267
- // "zrx_balance": "0.00000000",
1268
- // "zrx_reserved": "0.00000000",
1269
- // "zrx_withdrawal_fee": "12.00000000",
1270
- // "zrxeur_fee": "0.000",
1271
- // "zrxusd_fee": "0.000",
1272
- // ...
1273
- // }
1274
- //
1275
- if (codes === undefined) {
1276
- codes = Object.keys(this.currencies);
1277
- }
1278
1294
  const result = {};
1279
- let mainCurrencyId = undefined;
1280
- const ids = Object.keys(response);
1295
+ const currencies = this.indexBy(response, 'currency');
1296
+ const ids = Object.keys(currencies);
1281
1297
  for (let i = 0; i < ids.length; i++) {
1282
1298
  const id = ids[i];
1283
- const currencyId = id.split('_')[0];
1284
- const code = this.safeCurrencyCode(currencyId);
1285
- if (codes !== undefined && !this.inArray(code, codes)) {
1299
+ const fees = this.safeValue(response, i, {});
1300
+ const code = this.safeCurrencyCode(id);
1301
+ if ((codes !== undefined) && !this.inArray(code, codes)) {
1286
1302
  continue;
1287
1303
  }
1288
- if (id.indexOf('_available') >= 0) {
1289
- mainCurrencyId = currencyId;
1290
- result[code] = {
1291
- 'deposit': undefined,
1292
- 'withdraw': undefined,
1293
- 'info': {},
1294
- };
1295
- }
1296
- if (currencyId === mainCurrencyId) {
1297
- result[code]['info'][id] = this.safeNumber(response, id);
1298
- }
1299
- if (id.indexOf('_withdrawal_fee') >= 0) {
1300
- result[code]['withdraw'] = this.safeNumber(response, id);
1301
- }
1304
+ result[code] = {
1305
+ 'withdraw_fee': this.safeNumber(fees, 'fee'),
1306
+ 'deposit': {},
1307
+ 'info': this.safeDict(currencies, id),
1308
+ };
1302
1309
  }
1303
1310
  return result;
1304
1311
  }
@@ -1313,64 +1320,41 @@ class bitstamp extends bitstamp$1 {
1313
1320
  * @returns {object[]} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
1314
1321
  */
1315
1322
  await this.loadMarkets();
1316
- const response = await this.privatePostBalance(params);
1317
- //
1318
- // {
1319
- // "yfi_available": "0.00000000",
1320
- // "yfi_balance": "0.00000000",
1321
- // "yfi_reserved": "0.00000000",
1322
- // "yfi_withdrawal_fee": "0.00070000",
1323
- // "yfieur_fee": "0.000",
1324
- // "yfiusd_fee": "0.000",
1325
- // "zrx_available": "0.00000000",
1326
- // "zrx_balance": "0.00000000",
1327
- // "zrx_reserved": "0.00000000",
1328
- // "zrx_withdrawal_fee": "12.00000000",
1329
- // "zrxeur_fee": "0.000",
1330
- // "zrxusd_fee": "0.000",
1331
- // ...
1332
- // }
1333
- //
1334
- return this.parseDepositWithdrawFees(response, codes);
1335
- }
1336
- parseDepositWithdrawFees(response, codes = undefined, currencyIdKey = undefined) {
1337
- //
1338
- // {
1339
- // "yfi_available": "0.00000000",
1340
- // "yfi_balance": "0.00000000",
1341
- // "yfi_reserved": "0.00000000",
1342
- // "yfi_withdrawal_fee": "0.00070000",
1343
- // "yfieur_fee": "0.000",
1344
- // "yfiusd_fee": "0.000",
1345
- // "zrx_available": "0.00000000",
1346
- // "zrx_balance": "0.00000000",
1347
- // "zrx_reserved": "0.00000000",
1348
- // "zrx_withdrawal_fee": "12.00000000",
1349
- // "zrxeur_fee": "0.000",
1350
- // "zrxusd_fee": "0.000",
1351
- // ...
1352
- // }
1323
+ const response = await this.privatePostFeesWithdrawal(params);
1353
1324
  //
1354
- const result = {};
1355
- const ids = Object.keys(response);
1356
- for (let i = 0; i < ids.length; i++) {
1357
- const id = ids[i];
1358
- const currencyId = id.split('_')[0];
1359
- const code = this.safeCurrencyCode(currencyId);
1360
- const dictValue = this.safeNumber(response, id);
1361
- if (codes !== undefined && !this.inArray(code, codes)) {
1362
- continue;
1363
- }
1364
- if (id.indexOf('_available') >= 0) {
1365
- result[code] = this.depositWithdrawFee({});
1366
- }
1367
- if (id.indexOf('_withdrawal_fee') >= 0) {
1368
- result[code]['withdraw']['fee'] = dictValue;
1369
- }
1370
- const resultValue = this.safeValue(result, code);
1371
- if (resultValue !== undefined) {
1372
- result[code]['info'][id] = dictValue;
1373
- }
1325
+ // [
1326
+ // {
1327
+ // "currency": "btc",
1328
+ // "fee": "0.00015000",
1329
+ // "network": "bitcoin"
1330
+ // }
1331
+ // ...
1332
+ // ]
1333
+ //
1334
+ const responseByCurrencyId = this.groupBy(response, 'currency');
1335
+ return this.parseDepositWithdrawFees(responseByCurrencyId, codes);
1336
+ }
1337
+ parseDepositWithdrawFee(fee, currency = undefined) {
1338
+ const result = this.depositWithdrawFee(fee);
1339
+ for (let j = 0; j < fee.length; j++) {
1340
+ const networkEntry = fee[j];
1341
+ const networkId = this.safeString(networkEntry, 'network');
1342
+ const networkCode = this.networkIdToCode(networkId);
1343
+ const withdrawFee = this.safeNumber(networkEntry, 'fee');
1344
+ result['withdraw'] = {
1345
+ 'fee': withdrawFee,
1346
+ 'percentage': undefined,
1347
+ };
1348
+ result['networks'][networkCode] = {
1349
+ 'withdraw': {
1350
+ 'fee': withdrawFee,
1351
+ 'percentage': undefined,
1352
+ },
1353
+ 'deposit': {
1354
+ 'fee': undefined,
1355
+ 'percentage': undefined,
1356
+ },
1357
+ };
1374
1358
  }
1375
1359
  return result;
1376
1360
  }
@@ -941,6 +941,8 @@ class blofin extends blofin$1 {
941
941
  // blofin returns the fees as negative values opposed to other exchanges, so the sign needs to be flipped
942
942
  'maker': this.parseNumber(Precise["default"].stringNeg(this.safeString2(fee, 'maker', 'makerU'))),
943
943
  'taker': this.parseNumber(Precise["default"].stringNeg(this.safeString2(fee, 'taker', 'takerU'))),
944
+ 'percentage': undefined,
945
+ 'tierBased': undefined,
944
946
  };
945
947
  }
946
948
  async fetchBalance(params = {}) {
@@ -7264,6 +7264,8 @@ class bybit extends bybit$1 {
7264
7264
  'symbol': symbol,
7265
7265
  'maker': this.safeNumber(fee, 'makerFeeRate'),
7266
7266
  'taker': this.safeNumber(fee, 'takerFeeRate'),
7267
+ 'percentage': undefined,
7268
+ 'tierBased': undefined,
7267
7269
  };
7268
7270
  }
7269
7271
  async fetchTradingFee(symbol, params = {}) {
@@ -1574,6 +1574,8 @@ class coinsph extends coinsph$1 {
1574
1574
  'symbol': symbol,
1575
1575
  'maker': this.safeNumber(fee, 'makerCommission'),
1576
1576
  'taker': this.safeNumber(fee, 'takerCommission'),
1577
+ 'percentage': undefined,
1578
+ 'tierBased': undefined,
1577
1579
  };
1578
1580
  }
1579
1581
  async withdraw(code, amount, address, tag = undefined, params = {}) {
@@ -3366,6 +3366,8 @@ class digifinex extends digifinex$1 {
3366
3366
  'symbol': symbol,
3367
3367
  'maker': this.safeNumber(fee, 'maker_fee_rate'),
3368
3368
  'taker': this.safeNumber(fee, 'taker_fee_rate'),
3369
+ 'percentage': undefined,
3370
+ 'tierBased': undefined,
3369
3371
  };
3370
3372
  }
3371
3373
  async fetchPositions(symbols = undefined, params = {}) {
@@ -2071,6 +2071,8 @@ class gate extends gate$1 {
2071
2071
  'symbol': this.safeString(market, 'symbol'),
2072
2072
  'maker': this.safeNumber(info, makerKey),
2073
2073
  'taker': this.safeNumber(info, takerKey),
2074
+ 'percentage': undefined,
2075
+ 'tierBased': undefined,
2074
2076
  };
2075
2077
  }
2076
2078
  async fetchTransactionFees(codes = undefined, params = {}) {
@@ -1625,6 +1625,8 @@ class hitbtc extends hitbtc$1 {
1625
1625
  'symbol': symbol,
1626
1626
  'taker': taker,
1627
1627
  'maker': maker,
1628
+ 'percentage': undefined,
1629
+ 'tierBased': undefined,
1628
1630
  };
1629
1631
  }
1630
1632
  async fetchTradingFee(symbol, params = {}) {
@@ -1500,6 +1500,8 @@ class htx extends htx$1 {
1500
1500
  'symbol': this.safeSymbol(marketId, market),
1501
1501
  'maker': this.safeNumber(fee, 'actualMakerRate'),
1502
1502
  'taker': this.safeNumber(fee, 'actualTakerRate'),
1503
+ 'percentage': undefined,
1504
+ 'tierBased': undefined,
1503
1505
  };
1504
1506
  }
1505
1507
  async fetchTradingFee(symbol, params = {}) {
@@ -3524,9 +3524,9 @@ class kucoin extends kucoin$1 {
3524
3524
  }
3525
3525
  parseBalanceHelper(entry) {
3526
3526
  const account = this.account();
3527
- account['used'] = this.safeString(entry, 'holdBalance');
3528
- account['free'] = this.safeString(entry, 'availableBalance');
3529
- account['total'] = this.safeString(entry, 'totalBalance');
3527
+ account['used'] = this.safeString2(entry, 'holdBalance', 'hold');
3528
+ account['free'] = this.safeString2(entry, 'availableBalance', 'available');
3529
+ account['total'] = this.safeString2(entry, 'totalBalance', 'total');
3530
3530
  const debt = this.safeString(entry, 'liability');
3531
3531
  const interest = this.safeString(entry, 'interest');
3532
3532
  account['debt'] = Precise["default"].stringAdd(debt, interest);
@@ -3584,7 +3584,7 @@ class kucoin extends kucoin$1 {
3584
3584
  response = await this.privateGetAccounts(this.extend(request, query));
3585
3585
  }
3586
3586
  //
3587
- // Spot and Cross
3587
+ // Spot
3588
3588
  //
3589
3589
  // {
3590
3590
  // "code": "200000",
@@ -3600,35 +3600,59 @@ class kucoin extends kucoin$1 {
3600
3600
  // ]
3601
3601
  // }
3602
3602
  //
3603
+ // Cross
3604
+ //
3605
+ // {
3606
+ // "code": "200000",
3607
+ // "data": {
3608
+ // "debtRatio": "0",
3609
+ // "accounts": [
3610
+ // {
3611
+ // "currency": "USDT",
3612
+ // "totalBalance": "5",
3613
+ // "availableBalance": "5",
3614
+ // "holdBalance": "0",
3615
+ // "liability": "0",
3616
+ // "maxBorrowSize": "20"
3617
+ // },
3618
+ // ]
3619
+ // }
3620
+ // }
3621
+ //
3603
3622
  // Isolated
3604
3623
  //
3605
3624
  // {
3606
3625
  // "code": "200000",
3607
3626
  // "data": {
3608
- // "totalConversionBalance": "0",
3609
- // "liabilityConversionBalance": "0",
3627
+ // "totalAssetOfQuoteCurrency": "0",
3628
+ // "totalLiabilityOfQuoteCurrency": "0",
3629
+ // "timestamp": 1712085661155,
3610
3630
  // "assets": [
3611
3631
  // {
3612
3632
  // "symbol": "MANA-USDT",
3613
- // "status": "CLEAR",
3633
+ // "status": "EFFECTIVE",
3614
3634
  // "debtRatio": "0",
3615
3635
  // "baseAsset": {
3616
3636
  // "currency": "MANA",
3617
- // "totalBalance": "0",
3618
- // "holdBalance": "0",
3619
- // "availableBalance": "0",
3637
+ // "borrowEnabled": true,
3638
+ // "transferInEnabled": true,
3639
+ // "total": "0",
3640
+ // "hold": "0",
3641
+ // "available": "0",
3620
3642
  // "liability": "0",
3621
3643
  // "interest": "0",
3622
- // "borrowableAmount": "0"
3644
+ // "maxBorrowSize": "0"
3623
3645
  // },
3624
3646
  // "quoteAsset": {
3625
3647
  // "currency": "USDT",
3626
- // "totalBalance": "0",
3627
- // "holdBalance": "0",
3628
- // "availableBalance": "0",
3648
+ // "borrowEnabled": true,
3649
+ // "transferInEnabled": true,
3650
+ // "total": "0",
3651
+ // "hold": "0",
3652
+ // "available": "0",
3629
3653
  // "liability": "0",
3630
3654
  // "interest": "0",
3631
- // "borrowableAmount": "0"
3655
+ // "maxBorrowSize": "0"
3632
3656
  // }
3633
3657
  // },
3634
3658
  // ...
@@ -875,6 +875,8 @@ class latoken extends latoken$1 {
875
875
  'symbol': market['symbol'],
876
876
  'maker': this.safeNumber(response, 'makerFee'),
877
877
  'taker': this.safeNumber(response, 'takerFee'),
878
+ 'percentage': undefined,
879
+ 'tierBased': undefined,
878
880
  };
879
881
  }
880
882
  async fetchPrivateTradingFee(symbol, params = {}) {
@@ -898,6 +900,8 @@ class latoken extends latoken$1 {
898
900
  'symbol': market['symbol'],
899
901
  'maker': this.safeNumber(response, 'makerFee'),
900
902
  'taker': this.safeNumber(response, 'takerFee'),
903
+ 'percentage': undefined,
904
+ 'tierBased': undefined,
901
905
  };
902
906
  }
903
907
  async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -1241,6 +1241,8 @@ class lbank extends lbank$1 {
1241
1241
  'symbol': symbol,
1242
1242
  'maker': this.safeNumber(fee, 'makerCommission'),
1243
1243
  'taker': this.safeNumber(fee, 'takerCommission'),
1244
+ 'percentage': undefined,
1245
+ 'tierBased': undefined,
1244
1246
  };
1245
1247
  }
1246
1248
  async fetchTradingFee(symbol, params = {}) {
@@ -1255,7 +1257,7 @@ class lbank extends lbank$1 {
1255
1257
  */
1256
1258
  const market = this.market(symbol);
1257
1259
  const result = await this.fetchTradingFees(this.extend(params, { 'category': market['id'] }));
1258
- return result;
1260
+ return this.safeDict(result, symbol);
1259
1261
  }
1260
1262
  async fetchTradingFees(params = {}) {
1261
1263
  /**
@@ -894,6 +894,8 @@ class luno extends luno$1 {
894
894
  'symbol': symbol,
895
895
  'maker': this.safeNumber(response, 'maker_fee'),
896
896
  'taker': this.safeNumber(response, 'taker_fee'),
897
+ 'percentage': undefined,
898
+ 'tierBased': undefined,
897
899
  };
898
900
  }
899
901
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -4299,8 +4299,9 @@ class mexc extends mexc$1 {
4299
4299
  /**
4300
4300
  * @method
4301
4301
  * @name mexc#fetchLeverageTiers
4302
- * @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
4303
- * @param {string[]|undefined} symbols list of unified market symbols
4302
+ * @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes, if a market has a leverage tier of 0, then the leverage tiers cannot be obtained for this market
4303
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-contract-information
4304
+ * @param {string[]} [symbols] list of unified market symbols
4304
4305
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4305
4306
  * @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
4306
4307
  */
@@ -4356,10 +4357,44 @@ class mexc extends mexc$1 {
4356
4357
  return this.parseLeverageTiers(data, symbols, 'symbol');
4357
4358
  }
4358
4359
  parseMarketLeverageTiers(info, market = undefined) {
4359
- /**
4360
- @param info {object} Exchange response for 1 market
4361
- @param market {object} CCXT market
4362
- */
4360
+ //
4361
+ // {
4362
+ // "symbol": "BTC_USDT",
4363
+ // "displayName": "BTC_USDT永续",
4364
+ // "displayNameEn": "BTC_USDT SWAP",
4365
+ // "positionOpenType": 3,
4366
+ // "baseCoin": "BTC",
4367
+ // "quoteCoin": "USDT",
4368
+ // "settleCoin": "USDT",
4369
+ // "contractSize": 0.0001,
4370
+ // "minLeverage": 1,
4371
+ // "maxLeverage": 125,
4372
+ // "priceScale": 2,
4373
+ // "volScale": 0,
4374
+ // "amountScale": 4,
4375
+ // "priceUnit": 0.5,
4376
+ // "volUnit": 1,
4377
+ // "minVol": 1,
4378
+ // "maxVol": 1000000,
4379
+ // "bidLimitPriceRate": 0.1,
4380
+ // "askLimitPriceRate": 0.1,
4381
+ // "takerFeeRate": 0.0006,
4382
+ // "makerFeeRate": 0.0002,
4383
+ // "maintenanceMarginRate": 0.004,
4384
+ // "initialMarginRate": 0.008,
4385
+ // "riskBaseVol": 10000,
4386
+ // "riskIncrVol": 200000,
4387
+ // "riskIncrMmr": 0.004,
4388
+ // "riskIncrImr": 0.004,
4389
+ // "riskLevelLimit": 5,
4390
+ // "priceCoefficientVariation": 0.1,
4391
+ // "indexOrigin": ["BINANCE","GATEIO","HUOBI","MXC"],
4392
+ // "state": 0, // 0 enabled, 1 delivery, 2 completed, 3 offline, 4 pause
4393
+ // "isNew": false,
4394
+ // "isHot": true,
4395
+ // "isHidden": false
4396
+ // }
4397
+ //
4363
4398
  let maintenanceMarginRate = this.safeString(info, 'maintenanceMarginRate');
4364
4399
  let initialMarginRate = this.safeString(info, 'initialMarginRate');
4365
4400
  const maxVol = this.safeString(info, 'maxVol');
@@ -4369,6 +4404,19 @@ class mexc extends mexc$1 {
4369
4404
  let floor = '0';
4370
4405
  const tiers = [];
4371
4406
  const quoteId = this.safeString(info, 'quoteCoin');
4407
+ if (riskIncrVol === '0') {
4408
+ return [
4409
+ {
4410
+ 'tier': 0,
4411
+ 'currency': this.safeCurrencyCode(quoteId),
4412
+ 'notionalFloor': undefined,
4413
+ 'notionalCap': undefined,
4414
+ 'maintenanceMarginRate': undefined,
4415
+ 'maxLeverage': this.safeNumber(info, 'maxLeverage'),
4416
+ 'info': info,
4417
+ },
4418
+ ];
4419
+ }
4372
4420
  while (Precise["default"].stringLt(floor, maxVol)) {
4373
4421
  const cap = Precise["default"].stringAdd(floor, riskIncrVol);
4374
4422
  tiers.push({