ccxt 4.2.87 → 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 (131) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +4 -5
  3. package/dist/ccxt.browser.js +311 -167
  4. package/dist/ccxt.browser.min.js +3 -3
  5. package/dist/cjs/ccxt.js +6 -1
  6. package/dist/cjs/src/ascendex.js +2 -0
  7. package/dist/cjs/src/base/Exchange.js +41 -9
  8. package/dist/cjs/src/binance.js +12 -6
  9. package/dist/cjs/src/bitflyer.js +2 -0
  10. package/dist/cjs/src/bitget.js +24 -17
  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/cryptocom.js +1 -1
  17. package/dist/cjs/src/digifinex.js +2 -0
  18. package/dist/cjs/src/gate.js +10 -8
  19. package/dist/cjs/src/hitbtc.js +2 -0
  20. package/dist/cjs/src/htx.js +2 -0
  21. package/dist/cjs/src/krakenfutures.js +2 -1
  22. package/dist/cjs/src/kucoin.js +46 -19
  23. package/dist/cjs/src/latoken.js +4 -0
  24. package/dist/cjs/src/lbank.js +3 -1
  25. package/dist/cjs/src/luno.js +2 -0
  26. package/dist/cjs/src/mexc.js +55 -7
  27. package/dist/cjs/src/okx.js +2 -0
  28. package/dist/cjs/src/pro/bitget.js +2 -0
  29. package/dist/cjs/src/timex.js +2 -0
  30. package/examples/js/cli.js +0 -2
  31. package/examples/ts/cli.ts +0 -2
  32. package/js/ccxt.d.ts +3 -3
  33. package/js/ccxt.js +3 -3
  34. package/js/src/ascendex.d.ts +3 -3
  35. package/js/src/ascendex.js +2 -0
  36. package/js/src/base/Exchange.d.ts +9 -8
  37. package/js/src/base/Exchange.js +41 -9
  38. package/js/src/base/types.d.ts +35 -2
  39. package/js/src/bigone.d.ts +2 -2
  40. package/js/src/binance.d.ts +6 -16
  41. package/js/src/binance.js +12 -6
  42. package/js/src/bingx.d.ts +2 -2
  43. package/js/src/bit2c.d.ts +2 -2
  44. package/js/src/bitbank.d.ts +2 -2
  45. package/js/src/bitfinex.d.ts +2 -2
  46. package/js/src/bitfinex2.d.ts +3 -3
  47. package/js/src/bitflyer.d.ts +2 -7
  48. package/js/src/bitflyer.js +2 -0
  49. package/js/src/bitget.d.ts +6 -9
  50. package/js/src/bitget.js +24 -17
  51. package/js/src/bitmart.d.ts +4 -14
  52. package/js/src/bitmart.js +2 -0
  53. package/js/src/bitmex.d.ts +2 -2
  54. package/js/src/bitopro.d.ts +3 -3
  55. package/js/src/bitrue.d.ts +2 -2
  56. package/js/src/bitso.d.ts +2 -2
  57. package/js/src/bitstamp.d.ts +7 -19
  58. package/js/src/bitstamp.js +83 -99
  59. package/js/src/bitteam.d.ts +2 -2
  60. package/js/src/bitvavo.d.ts +3 -3
  61. package/js/src/bl3p.d.ts +2 -2
  62. package/js/src/blockchaincom.d.ts +2 -2
  63. package/js/src/blofin.d.ts +2 -7
  64. package/js/src/blofin.js +2 -0
  65. package/js/src/bybit.d.ts +5 -15
  66. package/js/src/bybit.js +2 -0
  67. package/js/src/cex.d.ts +3 -3
  68. package/js/src/coinbase.d.ts +2 -2
  69. package/js/src/coinbaseinternational.d.ts +2 -2
  70. package/js/src/coinbasepro.d.ts +3 -3
  71. package/js/src/coincheck.d.ts +2 -2
  72. package/js/src/coinex.d.ts +5 -19
  73. package/js/src/coinlist.d.ts +3 -3
  74. package/js/src/coinmate.d.ts +2 -9
  75. package/js/src/coinmetro.d.ts +2 -2
  76. package/js/src/coinone.d.ts +2 -2
  77. package/js/src/coinsph.d.ts +4 -14
  78. package/js/src/coinsph.js +2 -0
  79. package/js/src/cryptocom.js +1 -1
  80. package/js/src/currencycom.d.ts +3 -3
  81. package/js/src/delta.d.ts +2 -2
  82. package/js/src/deribit.d.ts +3 -3
  83. package/js/src/digifinex.d.ts +4 -14
  84. package/js/src/digifinex.js +2 -0
  85. package/js/src/exmo.d.ts +3 -3
  86. package/js/src/gate.d.ts +6 -9
  87. package/js/src/gate.js +10 -8
  88. package/js/src/gemini.d.ts +3 -3
  89. package/js/src/hitbtc.d.ts +5 -15
  90. package/js/src/hitbtc.js +2 -0
  91. package/js/src/hollaex.d.ts +3 -3
  92. package/js/src/htx.d.ts +4 -14
  93. package/js/src/htx.js +2 -0
  94. package/js/src/huobijp.d.ts +2 -2
  95. package/js/src/hyperliquid.d.ts +2 -2
  96. package/js/src/idex.d.ts +3 -3
  97. package/js/src/independentreserve.d.ts +2 -2
  98. package/js/src/kraken.d.ts +3 -10
  99. package/js/src/krakenfutures.js +2 -1
  100. package/js/src/kucoin.d.ts +3 -10
  101. package/js/src/kucoin.js +46 -19
  102. package/js/src/kuna.d.ts +2 -2
  103. package/js/src/latoken.d.ts +7 -8
  104. package/js/src/latoken.js +4 -0
  105. package/js/src/lbank.d.ts +4 -9
  106. package/js/src/lbank.js +3 -1
  107. package/js/src/luno.d.ts +2 -7
  108. package/js/src/luno.js +2 -0
  109. package/js/src/lykke.d.ts +2 -2
  110. package/js/src/mexc.d.ts +3 -3
  111. package/js/src/mexc.js +55 -7
  112. package/js/src/ndax.d.ts +2 -2
  113. package/js/src/oceanex.d.ts +2 -2
  114. package/js/src/okcoin.d.ts +2 -2
  115. package/js/src/okx.d.ts +4 -14
  116. package/js/src/okx.js +2 -0
  117. package/js/src/onetrading.d.ts +3 -3
  118. package/js/src/phemex.d.ts +2 -2
  119. package/js/src/poloniex.d.ts +3 -3
  120. package/js/src/pro/bitget.js +2 -0
  121. package/js/src/pro/bitvavo.d.ts +2 -2
  122. package/js/src/probit.d.ts +2 -2
  123. package/js/src/timex.d.ts +4 -14
  124. package/js/src/timex.js +2 -0
  125. package/js/src/upbit.d.ts +2 -9
  126. package/js/src/wazirx.d.ts +2 -2
  127. package/js/src/whitebit.d.ts +3 -3
  128. package/js/src/woo.d.ts +3 -3
  129. package/js/src/yobit.d.ts +2 -2
  130. package/package.json +1 -1
  131. package/skip-tests.json +6 -1
@@ -5171,6 +5171,8 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
5171
5171
  'symbol': symbol,
5172
5172
  'maker': this.safeNumber(takerMaker, 'maker'),
5173
5173
  'taker': this.safeNumber(takerMaker, 'taker'),
5174
+ 'percentage': undefined,
5175
+ 'tierBased': undefined,
5174
5176
  };
5175
5177
  }
5176
5178
  return result;
@@ -7317,7 +7319,7 @@ class Exchange {
7317
7319
  this.markets_by_id = undefined;
7318
7320
  this.symbols = undefined;
7319
7321
  this.ids = undefined;
7320
- this.currencies = undefined;
7322
+ this.currencies = {};
7321
7323
  this.baseCurrencies = undefined;
7322
7324
  this.quoteCurrencies = undefined;
7323
7325
  this.currencies_by_id = undefined;
@@ -11004,11 +11006,11 @@ class Exchange {
11004
11006
  if (currencyId !== undefined) {
11005
11007
  code = this.commonCurrencyCode(currencyId.toUpperCase());
11006
11008
  }
11007
- return {
11009
+ return this.safeCurrencyStructure({
11008
11010
  'id': currencyId,
11009
11011
  'code': code,
11010
11012
  'precision': undefined,
11011
- };
11013
+ });
11012
11014
  }
11013
11015
  safeMarket(marketId, market = undefined, delimiter = undefined, marketType = undefined) {
11014
11016
  const result = this.safeMarketStructure({
@@ -11777,11 +11779,18 @@ class Exchange {
11777
11779
  'total': undefined,
11778
11780
  };
11779
11781
  }
11780
- commonCurrencyCode(currency) {
11782
+ commonCurrencyCode(code) {
11781
11783
  if (!this.substituteCommonCurrencyCodes) {
11782
- return currency;
11784
+ return code;
11783
11785
  }
11784
- return this.safeString(this.commonCurrencies, currency, currency);
11786
+ // if the provided code already exists as a value in commonCurrencies dict, then we should not again transform it
11787
+ // more details at: https://github.com/ccxt/ccxt/issues/21112#issuecomment-2031293691
11788
+ const commonCurrencies = Object.values(this.commonCurrencies);
11789
+ const exists = this.inArray(code, commonCurrencies);
11790
+ if (exists) {
11791
+ return code;
11792
+ }
11793
+ return this.safeString(this.commonCurrencies, code, code);
11785
11794
  }
11786
11795
  currency(code) {
11787
11796
  if (this.currencies === undefined) {
@@ -11936,6 +11945,30 @@ class Exchange {
11936
11945
  }
11937
11946
  return parsedPrecision + '1';
11938
11947
  }
11948
+ integerPrecisionToAmount(precision) {
11949
+ /**
11950
+ * @ignore
11951
+ * @method
11952
+ * @description handles positive & negative numbers too. parsePrecision() does not handle negative numbers, but this method handles
11953
+ * @param {string} precision The number of digits to the right of the decimal
11954
+ * @returns {string} a string number equal to 1e-precision
11955
+ */
11956
+ if (precision === undefined) {
11957
+ return undefined;
11958
+ }
11959
+ if (_Precise_js__WEBPACK_IMPORTED_MODULE_10__/* .Precise */ .O.stringGe(precision, '0')) {
11960
+ return this.parsePrecision(precision);
11961
+ }
11962
+ else {
11963
+ const positivePrecisionString = _Precise_js__WEBPACK_IMPORTED_MODULE_10__/* .Precise */ .O.stringAbs(precision);
11964
+ const positivePrecision = parseInt(positivePrecisionString);
11965
+ let parsedPrecision = '1';
11966
+ for (let i = 0; i < positivePrecision - 1; i++) {
11967
+ parsedPrecision = parsedPrecision + '0';
11968
+ }
11969
+ return parsedPrecision + '0';
11970
+ }
11971
+ }
11939
11972
  async loadTimeDifference(params = {}) {
11940
11973
  const serverTime = await this.fetchTime(params);
11941
11974
  const after = this.milliseconds();
@@ -12220,7 +12253,8 @@ class Exchange {
12220
12253
  if (!this.has['fetchTradingFees']) {
12221
12254
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchTradingFee() is not supported yet');
12222
12255
  }
12223
- return await this.fetchTradingFees(params);
12256
+ const fees = await this.fetchTradingFees(params);
12257
+ return this.safeDict(fees, symbol);
12224
12258
  }
12225
12259
  parseOpenInterest(interest, market = undefined) {
12226
12260
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseOpenInterest () is not supported yet');
@@ -12416,8 +12450,8 @@ class Exchange {
12416
12450
  const entry = responseKeys[i];
12417
12451
  const dictionary = isArray ? entry : response[entry];
12418
12452
  const currencyId = isArray ? this.safeString(dictionary, currencyIdKey) : entry;
12419
- const currency = this.safeValue(this.currencies_by_id, currencyId);
12420
- const code = this.safeString(currency, 'code', currencyId);
12453
+ const currency = this.safeCurrency(currencyId);
12454
+ const code = this.safeString(currency, 'code');
12421
12455
  if ((codes === undefined) || (this.inArray(code, codes))) {
12422
12456
  depositWithdrawFees[code] = this.parseDepositWithdrawFee(dictionary, currency);
12423
12457
  }
@@ -20380,7 +20414,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
20380
20414
  '-4140': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
20381
20415
  '-4141': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OperationRejected,
20382
20416
  '-4144': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol,
20383
- '-4164': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OperationRejected,
20417
+ '-4164': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
20384
20418
  '-4165': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
20385
20419
  '-4167': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
20386
20420
  '-4168': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
@@ -27173,6 +27207,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27173
27207
  'symbol': symbol,
27174
27208
  'maker': this.safeNumber2(fee, 'makerCommission', 'makerCommissionRate'),
27175
27209
  'taker': this.safeNumber2(fee, 'takerCommission', 'takerCommissionRate'),
27210
+ 'percentage': undefined,
27211
+ 'tierBased': undefined,
27176
27212
  };
27177
27213
  }
27178
27214
  async fetchTradingFee(symbol, params = {}) {
@@ -27660,7 +27696,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27660
27696
  'previousFundingDatetime': undefined,
27661
27697
  };
27662
27698
  }
27663
- parseAccountPositions(account) {
27699
+ parseAccountPositions(account, filterClosed = false) {
27664
27700
  const positions = this.safeList(account, 'positions');
27665
27701
  const assets = this.safeList(account, 'assets', []);
27666
27702
  const balances = {};
@@ -27683,7 +27719,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27683
27719
  const code = market['linear'] ? market['quote'] : market['base'];
27684
27720
  const maintenanceMargin = this.safeString(position, 'maintMargin');
27685
27721
  // check for maintenance margin so empty positions are not returned
27686
- if ((maintenanceMargin !== '0') && (maintenanceMargin !== '0.00000000')) {
27722
+ const isPositionOpen = (maintenanceMargin !== '0') && (maintenanceMargin !== '0.00000000');
27723
+ if (!filterClosed || isPositionOpen) {
27687
27724
  // sometimes not all the codes are correctly returned...
27688
27725
  if (code in balances) {
27689
27726
  const parsed = this.parseAccountPosition(this.extend(position, {
@@ -28525,10 +28562,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
28525
28562
  * @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
28526
28563
  * @see https://binance-docs.github.io/apidocs/pm/en/#get-um-account-detail-user_data
28527
28564
  * @see https://binance-docs.github.io/apidocs/pm/en/#get-cm-account-detail-user_data
28528
- * @param {string[]|undefined} symbols list of unified market symbols
28565
+ * @param {string[]} [symbols] list of unified market symbols
28529
28566
  * @param {object} [params] extra parameters specific to the exchange API endpoint
28530
28567
  * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch positions in a portfolio margin account
28531
28568
  * @param {string} [params.subType] "linear" or "inverse"
28569
+ * @param {boolean} [params.filterClosed] set to true if you would like to filter out closed positions, default is false
28532
28570
  * @returns {object} data on account positions
28533
28571
  */
28534
28572
  if (symbols !== undefined) {
@@ -28565,7 +28603,9 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
28565
28603
  else {
28566
28604
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchPositions() supports linear and inverse contracts only');
28567
28605
  }
28568
- const result = this.parseAccountPositions(response);
28606
+ let filterClosed = undefined;
28607
+ [filterClosed, params] = this.handleOptionAndParams(params, 'fetchAccountPositions', 'filterClosed', false);
28608
+ const result = this.parseAccountPositions(response, filterClosed);
28569
28609
  symbols = this.marketSymbols(symbols);
28570
28610
  return this.filterByArrayPositions(result, 'symbol', symbols, false);
28571
28611
  }
@@ -29703,7 +29743,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
29703
29743
  }
29704
29744
  await this.loadMarkets();
29705
29745
  const market = this.market(symbol);
29706
- amount = this.costToPrecision(symbol, amount);
29746
+ amount = this.amountToPrecision(symbol, amount);
29707
29747
  const request = {
29708
29748
  'type': addOrReduce,
29709
29749
  'symbol': market['id'],
@@ -44960,6 +45000,8 @@ class bitflyer extends _abstract_bitflyer_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
44960
45000
  'symbol': market['symbol'],
44961
45001
  'maker': fee,
44962
45002
  'taker': fee,
45003
+ 'percentage': undefined,
45004
+ 'tierBased': undefined,
44963
45005
  };
44964
45006
  }
44965
45007
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -46790,6 +46832,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
46790
46832
  'commonCurrencies': {
46791
46833
  'JADE': 'Jade Protocol',
46792
46834
  'DEGEN': 'DegenReborn',
46835
+ 'TONCOIN': 'TON',
46793
46836
  },
46794
46837
  'options': {
46795
46838
  'timeframes': {
@@ -47369,8 +47412,8 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
47369
47412
  const data = this.safeValue(response, 'data', []);
47370
47413
  for (let i = 0; i < data.length; i++) {
47371
47414
  const entry = data[i];
47372
- const id = this.safeString(entry, 'coinId');
47373
- const code = this.safeCurrencyCode(this.safeString(entry, 'coin'));
47415
+ const id = this.safeString(entry, 'coin'); // we don't use 'coinId' as it has no use. it is 'coin' field that needs to be used in currency related endpoints (deposit, withdraw, etc..)
47416
+ const code = this.safeCurrencyCode(id);
47374
47417
  const chains = this.safeValue(entry, 'chains', []);
47375
47418
  const networks = {};
47376
47419
  let deposit = false;
@@ -47499,7 +47542,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
47499
47542
  }
47500
47543
  params = this.omit(params, 'code');
47501
47544
  const currency = this.currency(code);
47502
- request['coin'] = currency['code'];
47545
+ request['coin'] = currency['id'];
47503
47546
  response = await this.privateMarginGetV2MarginCrossedTierData(this.extend(request, params));
47504
47547
  }
47505
47548
  else {
@@ -47655,7 +47698,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
47655
47698
  since = this.milliseconds() - 7776000000; // 90 days
47656
47699
  }
47657
47700
  let request = {
47658
- 'coin': currency['code'],
47701
+ 'coin': currency['id'],
47659
47702
  'startTime': since,
47660
47703
  'endTime': this.milliseconds(),
47661
47704
  };
@@ -47714,7 +47757,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
47714
47757
  const currency = this.currency(code);
47715
47758
  const networkId = this.networkCodeToId(chain);
47716
47759
  const request = {
47717
- 'coin': currency['code'],
47760
+ 'coin': currency['id'],
47718
47761
  'address': address,
47719
47762
  'chain': networkId,
47720
47763
  'size': amount,
@@ -47800,7 +47843,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
47800
47843
  since = this.milliseconds() - 7776000000; // 90 days
47801
47844
  }
47802
47845
  let request = {
47803
- 'coin': currency['code'],
47846
+ 'coin': currency['id'],
47804
47847
  'startTime': since,
47805
47848
  'endTime': this.milliseconds(),
47806
47849
  };
@@ -47943,7 +47986,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
47943
47986
  }
47944
47987
  const currency = this.currency(code);
47945
47988
  const request = {
47946
- 'coin': currency['code'],
47989
+ 'coin': currency['id'],
47947
47990
  };
47948
47991
  if (networkId !== undefined) {
47949
47992
  request['chain'] = networkId;
@@ -48118,7 +48161,11 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
48118
48161
  //
48119
48162
  const marketId = this.safeString(ticker, 'symbol');
48120
48163
  const close = this.safeString(ticker, 'lastPr');
48121
- const timestamp = this.safeInteger(ticker, 'ts');
48164
+ const timestampString = this.omitZero(this.safeString(ticker, 'ts')); // exchange sometimes provided 0
48165
+ let timestamp = undefined;
48166
+ if (timestampString !== undefined) {
48167
+ timestamp = this.parseToInt(timestampString);
48168
+ }
48122
48169
  const change = this.safeString(ticker, 'change24h');
48123
48170
  const open24 = this.safeString(ticker, 'open24');
48124
48171
  const open = this.safeString(ticker, 'open');
@@ -48771,6 +48818,8 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
48771
48818
  'symbol': this.safeSymbol(marketId, market),
48772
48819
  'maker': this.safeNumber(data, 'makerFeeRate'),
48773
48820
  'taker': this.safeNumber(data, 'takerFeeRate'),
48821
+ 'percentage': undefined,
48822
+ 'tierBased': undefined,
48774
48823
  };
48775
48824
  }
48776
48825
  parseOHLCV(ohlcv, market = undefined) {
@@ -51396,7 +51445,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
51396
51445
  let request = {};
51397
51446
  if (code !== undefined) {
51398
51447
  currency = this.currency(code);
51399
- request['coin'] = currency['code'];
51448
+ request['coin'] = currency['id'];
51400
51449
  }
51401
51450
  [request, params] = this.handleUntilOption('endTime', request, params);
51402
51451
  if (since !== undefined) {
@@ -52835,7 +52884,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
52835
52884
  type = this.safeString(accountsByType, fromAccount);
52836
52885
  const currency = this.currency(code);
52837
52886
  let request = {
52838
- 'coin': currency['code'],
52887
+ 'coin': currency['id'],
52839
52888
  'fromType': type,
52840
52889
  };
52841
52890
  if (since !== undefined) {
@@ -52894,7 +52943,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
52894
52943
  'fromType': fromType,
52895
52944
  'toType': toType,
52896
52945
  'amount': amount,
52897
- 'coin': currency['code'],
52946
+ 'coin': currency['id'],
52898
52947
  };
52899
52948
  const symbol = this.safeString(params, 'symbol');
52900
52949
  params = this.omit(params, 'symbol');
@@ -53081,7 +53130,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
53081
53130
  await this.loadMarkets();
53082
53131
  const currency = this.currency(code);
53083
53132
  const request = {
53084
- 'coin': currency['code'],
53133
+ 'coin': currency['id'],
53085
53134
  'borrowAmount': this.currencyToPrecision(code, amount),
53086
53135
  };
53087
53136
  const response = await this.privateMarginPostV2MarginCrossedAccountBorrow(this.extend(request, params));
@@ -53116,7 +53165,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
53116
53165
  const currency = this.currency(code);
53117
53166
  const market = this.market(symbol);
53118
53167
  const request = {
53119
- 'coin': currency['code'],
53168
+ 'coin': currency['id'],
53120
53169
  'borrowAmount': this.currencyToPrecision(code, amount),
53121
53170
  'symbol': market['id'],
53122
53171
  };
@@ -53153,7 +53202,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
53153
53202
  const currency = this.currency(code);
53154
53203
  const market = this.market(symbol);
53155
53204
  const request = {
53156
- 'coin': currency['code'],
53205
+ 'coin': currency['id'],
53157
53206
  'repayAmount': this.currencyToPrecision(code, amount),
53158
53207
  'symbol': market['id'],
53159
53208
  };
@@ -53189,7 +53238,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
53189
53238
  await this.loadMarkets();
53190
53239
  const currency = this.currency(code);
53191
53240
  const request = {
53192
- 'coin': currency['code'],
53241
+ 'coin': currency['id'],
53193
53242
  'repayAmount': this.currencyToPrecision(code, amount),
53194
53243
  };
53195
53244
  const response = await this.privateMarginPostV2MarginCrossedAccountRepay(this.extend(request, params));
@@ -53551,7 +53600,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
53551
53600
  await this.loadMarkets();
53552
53601
  const currency = this.currency(code);
53553
53602
  const request = {
53554
- 'coin': currency['code'],
53603
+ 'coin': currency['id'],
53555
53604
  };
53556
53605
  const response = await this.privateMarginGetV2MarginCrossedInterestRateAndLimit(this.extend(request, params));
53557
53606
  //
@@ -53646,7 +53695,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
53646
53695
  let currency = undefined;
53647
53696
  if (code !== undefined) {
53648
53697
  currency = this.currency(code);
53649
- request['coin'] = currency['code'];
53698
+ request['coin'] = currency['id'];
53650
53699
  }
53651
53700
  if (since !== undefined) {
53652
53701
  request['startTime'] = since;
@@ -57252,6 +57301,8 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
57252
57301
  'symbol': symbol,
57253
57302
  'maker': this.safeNumber(fee, 'maker_fee_rate'),
57254
57303
  'taker': this.safeNumber(fee, 'taker_fee_rate'),
57304
+ 'percentage': undefined,
57305
+ 'tierBased': undefined,
57255
57306
  };
57256
57307
  }
57257
57308
  async fetchTradingFee(symbol, params = {}) {
@@ -69843,6 +69894,30 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
69843
69894
  'commonCurrencies': {
69844
69895
  'UST': 'USTC',
69845
69896
  },
69897
+ // exchange-specific options
69898
+ 'options': {
69899
+ 'networksById': {
69900
+ 'bitcoin-cash': 'BCH',
69901
+ 'bitcoin': 'BTC',
69902
+ 'ethereum': 'ERC20',
69903
+ 'litecoin': 'LTC',
69904
+ 'stellar': 'XLM',
69905
+ 'xrpl': 'XRP',
69906
+ 'tron': 'TRC20',
69907
+ 'algorand': 'ALGO',
69908
+ 'flare': 'FLR',
69909
+ 'hedera': 'HBAR',
69910
+ 'cardana': 'ADA',
69911
+ 'songbird': 'FLR',
69912
+ 'avalanche-c-chain': 'AVAX',
69913
+ 'solana': 'SOL',
69914
+ 'polkadot': 'DOT',
69915
+ 'near': 'NEAR',
69916
+ 'doge': 'DOGE',
69917
+ 'sui': 'SUI',
69918
+ 'casper': 'CSRP',
69919
+ },
69920
+ },
69846
69921
  'exceptions': {
69847
69922
  'exact': {
69848
69923
  'No permission found': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied,
@@ -70615,6 +70690,8 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
70615
70690
  'symbol': this.safeSymbol(marketId, market),
70616
70691
  'maker': this.safeNumber(fees, 'maker'),
70617
70692
  'taker': this.safeNumber(fees, 'taker'),
70693
+ 'percentage': undefined,
70694
+ 'tierBased': undefined,
70618
70695
  };
70619
70696
  }
70620
70697
  parseTradingFees(fees) {
@@ -70660,60 +70737,41 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
70660
70737
  * @name bitstamp#fetchTransactionFees
70661
70738
  * @deprecated
70662
70739
  * @description please use fetchDepositWithdrawFees instead
70663
- * @see https://www.bitstamp.net/api/#balance
70740
+ * @see https://www.bitstamp.net/api/#tag/Fees
70664
70741
  * @param {string[]|undefined} codes list of unified currency codes
70665
70742
  * @param {object} [params] extra parameters specific to the exchange API endpoint
70666
70743
  * @returns {object[]} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
70667
70744
  */
70668
70745
  await this.loadMarkets();
70669
- const balance = await this.privatePostBalance(params);
70670
- return this.parseTransactionFees(balance);
70671
- }
70672
- parseTransactionFees(response, codes = undefined) {
70746
+ const response = await this.privatePostFeesWithdrawal(params);
70673
70747
  //
70674
- // {
70675
- // "yfi_available": "0.00000000",
70676
- // "yfi_balance": "0.00000000",
70677
- // "yfi_reserved": "0.00000000",
70678
- // "yfi_withdrawal_fee": "0.00070000",
70679
- // "yfieur_fee": "0.000",
70680
- // "yfiusd_fee": "0.000",
70681
- // "zrx_available": "0.00000000",
70682
- // "zrx_balance": "0.00000000",
70683
- // "zrx_reserved": "0.00000000",
70684
- // "zrx_withdrawal_fee": "12.00000000",
70685
- // "zrxeur_fee": "0.000",
70686
- // "zrxusd_fee": "0.000",
70687
- // ...
70688
- // }
70748
+ // [
70749
+ // {
70750
+ // "currency": "btc",
70751
+ // "fee": "0.00015000",
70752
+ // "network": "bitcoin"
70753
+ // }
70754
+ // ...
70755
+ // ]
70689
70756
  //
70690
- if (codes === undefined) {
70691
- codes = Object.keys(this.currencies);
70692
- }
70757
+ return this.parseTransactionFees(response);
70758
+ }
70759
+ parseTransactionFees(response, codes = undefined) {
70693
70760
  const result = {};
70694
- let mainCurrencyId = undefined;
70695
- const ids = Object.keys(response);
70761
+ const currencies = this.indexBy(response, 'currency');
70762
+ const ids = Object.keys(currencies);
70696
70763
  for (let i = 0; i < ids.length; i++) {
70697
70764
  const id = ids[i];
70698
- const currencyId = id.split('_')[0];
70699
- const code = this.safeCurrencyCode(currencyId);
70700
- if (codes !== undefined && !this.inArray(code, codes)) {
70765
+ const fees = this.safeValue(response, i, {});
70766
+ const code = this.safeCurrencyCode(id);
70767
+ if ((codes !== undefined) && !this.inArray(code, codes)) {
70701
70768
  continue;
70702
70769
  }
70703
- if (id.indexOf('_available') >= 0) {
70704
- mainCurrencyId = currencyId;
70705
- result[code] = {
70706
- 'deposit': undefined,
70707
- 'withdraw': undefined,
70708
- 'info': {},
70709
- };
70710
- }
70711
- if (currencyId === mainCurrencyId) {
70712
- result[code]['info'][id] = this.safeNumber(response, id);
70713
- }
70714
- if (id.indexOf('_withdrawal_fee') >= 0) {
70715
- result[code]['withdraw'] = this.safeNumber(response, id);
70716
- }
70770
+ result[code] = {
70771
+ 'withdraw_fee': this.safeNumber(fees, 'fee'),
70772
+ 'deposit': {},
70773
+ 'info': this.safeDict(currencies, id),
70774
+ };
70717
70775
  }
70718
70776
  return result;
70719
70777
  }
@@ -70728,64 +70786,41 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
70728
70786
  * @returns {object[]} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
70729
70787
  */
70730
70788
  await this.loadMarkets();
70731
- const response = await this.privatePostBalance(params);
70789
+ const response = await this.privatePostFeesWithdrawal(params);
70732
70790
  //
70733
- // {
70734
- // "yfi_available": "0.00000000",
70735
- // "yfi_balance": "0.00000000",
70736
- // "yfi_reserved": "0.00000000",
70737
- // "yfi_withdrawal_fee": "0.00070000",
70738
- // "yfieur_fee": "0.000",
70739
- // "yfiusd_fee": "0.000",
70740
- // "zrx_available": "0.00000000",
70741
- // "zrx_balance": "0.00000000",
70742
- // "zrx_reserved": "0.00000000",
70743
- // "zrx_withdrawal_fee": "12.00000000",
70744
- // "zrxeur_fee": "0.000",
70745
- // "zrxusd_fee": "0.000",
70746
- // ...
70747
- // }
70791
+ // [
70792
+ // {
70793
+ // "currency": "btc",
70794
+ // "fee": "0.00015000",
70795
+ // "network": "bitcoin"
70796
+ // }
70797
+ // ...
70798
+ // ]
70748
70799
  //
70749
- return this.parseDepositWithdrawFees(response, codes);
70800
+ const responseByCurrencyId = this.groupBy(response, 'currency');
70801
+ return this.parseDepositWithdrawFees(responseByCurrencyId, codes);
70750
70802
  }
70751
- parseDepositWithdrawFees(response, codes = undefined, currencyIdKey = undefined) {
70752
- //
70753
- // {
70754
- // "yfi_available": "0.00000000",
70755
- // "yfi_balance": "0.00000000",
70756
- // "yfi_reserved": "0.00000000",
70757
- // "yfi_withdrawal_fee": "0.00070000",
70758
- // "yfieur_fee": "0.000",
70759
- // "yfiusd_fee": "0.000",
70760
- // "zrx_available": "0.00000000",
70761
- // "zrx_balance": "0.00000000",
70762
- // "zrx_reserved": "0.00000000",
70763
- // "zrx_withdrawal_fee": "12.00000000",
70764
- // "zrxeur_fee": "0.000",
70765
- // "zrxusd_fee": "0.000",
70766
- // ...
70767
- // }
70768
- //
70769
- const result = {};
70770
- const ids = Object.keys(response);
70771
- for (let i = 0; i < ids.length; i++) {
70772
- const id = ids[i];
70773
- const currencyId = id.split('_')[0];
70774
- const code = this.safeCurrencyCode(currencyId);
70775
- const dictValue = this.safeNumber(response, id);
70776
- if (codes !== undefined && !this.inArray(code, codes)) {
70777
- continue;
70778
- }
70779
- if (id.indexOf('_available') >= 0) {
70780
- result[code] = this.depositWithdrawFee({});
70781
- }
70782
- if (id.indexOf('_withdrawal_fee') >= 0) {
70783
- result[code]['withdraw']['fee'] = dictValue;
70784
- }
70785
- const resultValue = this.safeValue(result, code);
70786
- if (resultValue !== undefined) {
70787
- result[code]['info'][id] = dictValue;
70788
- }
70803
+ parseDepositWithdrawFee(fee, currency = undefined) {
70804
+ const result = this.depositWithdrawFee(fee);
70805
+ for (let j = 0; j < fee.length; j++) {
70806
+ const networkEntry = fee[j];
70807
+ const networkId = this.safeString(networkEntry, 'network');
70808
+ const networkCode = this.networkIdToCode(networkId);
70809
+ const withdrawFee = this.safeNumber(networkEntry, 'fee');
70810
+ result['withdraw'] = {
70811
+ 'fee': withdrawFee,
70812
+ 'percentage': undefined,
70813
+ };
70814
+ result['networks'][networkCode] = {
70815
+ 'withdraw': {
70816
+ 'fee': withdrawFee,
70817
+ 'percentage': undefined,
70818
+ },
70819
+ 'deposit': {
70820
+ 'fee': undefined,
70821
+ 'percentage': undefined,
70822
+ },
70823
+ };
70789
70824
  }
70790
70825
  return result;
70791
70826
  }
@@ -78781,6 +78816,8 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
78781
78816
  // blofin returns the fees as negative values opposed to other exchanges, so the sign needs to be flipped
78782
78817
  'maker': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringNeg(this.safeString2(fee, 'maker', 'makerU'))),
78783
78818
  'taker': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringNeg(this.safeString2(fee, 'taker', 'takerU'))),
78819
+ 'percentage': undefined,
78820
+ 'tierBased': undefined,
78784
78821
  };
78785
78822
  }
78786
78823
  async fetchBalance(params = {}) {
@@ -91124,6 +91161,8 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
91124
91161
  'symbol': symbol,
91125
91162
  'maker': this.safeNumber(fee, 'makerFeeRate'),
91126
91163
  'taker': this.safeNumber(fee, 'takerFeeRate'),
91164
+ 'percentage': undefined,
91165
+ 'tierBased': undefined,
91127
91166
  };
91128
91167
  }
91129
91168
  async fetchTradingFee(symbol, params = {}) {
@@ -116687,6 +116726,8 @@ class coinsph extends _abstract_coinsph_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
116687
116726
  'symbol': symbol,
116688
116727
  'maker': this.safeNumber(fee, 'makerCommission'),
116689
116728
  'taker': this.safeNumber(fee, 'takerCommission'),
116729
+ 'percentage': undefined,
116730
+ 'tierBased': undefined,
116690
116731
  };
116691
116732
  }
116692
116733
  async withdraw(code, amount, address, tag = undefined, params = {}) {
@@ -120407,7 +120448,7 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
120407
120448
  //
120408
120449
  const result = this.safeDict(response, 'result', {});
120409
120450
  const data = this.safeList(result, 'data', []);
120410
- return this.parsePosition(data[0], market);
120451
+ return this.parsePosition(this.safeDict(data, 0), market);
120411
120452
  }
120412
120453
  async fetchPositions(symbols = undefined, params = {}) {
120413
120454
  /**
@@ -133235,6 +133276,8 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
133235
133276
  'symbol': symbol,
133236
133277
  'maker': this.safeNumber(fee, 'maker_fee_rate'),
133237
133278
  'taker': this.safeNumber(fee, 'taker_fee_rate'),
133279
+ 'percentage': undefined,
133280
+ 'tierBased': undefined,
133238
133281
  };
133239
133282
  }
133240
133283
  async fetchPositions(symbols = undefined, params = {}) {
@@ -138796,7 +138839,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
138796
138839
  await this.loadMarkets();
138797
138840
  const currency = this.currency(code);
138798
138841
  const request = {
138799
- 'currency': currency['id'],
138842
+ 'currency': currency['id'], // todo: currencies have network-junctions
138800
138843
  };
138801
138844
  const response = await this.privateWalletGetDepositAddress(this.extend(request, params));
138802
138845
  const addresses = this.safeValue(response, 'multichain_addresses');
@@ -138847,7 +138890,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
138847
138890
  const rawNetwork = this.safeStringUpper(params, 'network');
138848
138891
  params = this.omit(params, 'network');
138849
138892
  const request = {
138850
- 'currency': currency['id'],
138893
+ 'currency': currency['id'], // todo: currencies have network-junctions
138851
138894
  };
138852
138895
  const response = await this.privateWalletGetDepositAddress(this.extend(request, params));
138853
138896
  //
@@ -139008,6 +139051,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
139008
139051
  'symbol': this.safeString(market, 'symbol'),
139009
139052
  'maker': this.safeNumber(info, makerKey),
139010
139053
  'taker': this.safeNumber(info, takerKey),
139054
+ 'percentage': undefined,
139055
+ 'tierBased': undefined,
139011
139056
  };
139012
139057
  }
139013
139058
  async fetchTransactionFees(codes = undefined, params = {}) {
@@ -140463,7 +140508,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
140463
140508
  let currency = undefined;
140464
140509
  if (code !== undefined) {
140465
140510
  currency = this.currency(code);
140466
- request['currency'] = currency['id'];
140511
+ request['currency'] = currency['id']; // todo: currencies have network-junctions
140467
140512
  }
140468
140513
  if (limit !== undefined) {
140469
140514
  request['limit'] = limit;
@@ -140501,7 +140546,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
140501
140546
  let currency = undefined;
140502
140547
  if (code !== undefined) {
140503
140548
  currency = this.currency(code);
140504
- request['currency'] = currency['id'];
140549
+ request['currency'] = currency['id']; // todo: currencies have network-junctions
140505
140550
  }
140506
140551
  if (limit !== undefined) {
140507
140552
  request['limit'] = limit;
@@ -140548,7 +140593,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
140548
140593
  params = this.omit(params, 'network');
140549
140594
  }
140550
140595
  else {
140551
- request['chain'] = currency['id'];
140596
+ request['chain'] = currency['id']; // todo: currencies have network-junctions
140552
140597
  }
140553
140598
  const response = await this.privateWithdrawalsPostWithdrawals(this.extend(request, params));
140554
140599
  //
@@ -142082,7 +142127,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
142082
142127
  params = this.omit(params, 'symbol');
142083
142128
  }
142084
142129
  if ((toId === 'futures') || (toId === 'delivery') || (fromId === 'futures') || (fromId === 'delivery')) {
142085
- request['settle'] = currency['id'];
142130
+ request['settle'] = currency['id']; // todo: currencies have network-junctions
142086
142131
  }
142087
142132
  const response = await this.privateWalletPostTransfers(this.extend(request, params));
142088
142133
  //
@@ -143390,7 +143435,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
143390
143435
  if ((type === 'spot') || (type === 'margin')) {
143391
143436
  if (code !== undefined) {
143392
143437
  currency = this.currency(code);
143393
- request['currency'] = currency['id'];
143438
+ request['currency'] = currency['id']; // todo: currencies have network-junctions
143394
143439
  }
143395
143440
  }
143396
143441
  if ((type === 'swap') || (type === 'future')) {
@@ -144209,7 +144254,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
144209
144254
  await this.loadMarkets();
144210
144255
  const currency = this.currency(code);
144211
144256
  const request = {
144212
- 'underlying': currency['code'] + '_USDT',
144257
+ 'underlying': currency['code'] + '_USDT', // todo: currency['id'].toUpperCase () & network junctions
144213
144258
  };
144214
144259
  const response = await this.publicOptionsGetContracts(this.extend(request, params));
144215
144260
  //
@@ -147926,6 +147971,8 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
147926
147971
  'symbol': symbol,
147927
147972
  'taker': taker,
147928
147973
  'maker': maker,
147974
+ 'percentage': undefined,
147975
+ 'tierBased': undefined,
147929
147976
  };
147930
147977
  }
147931
147978
  async fetchTradingFee(symbol, params = {}) {
@@ -153450,6 +153497,8 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
153450
153497
  'symbol': this.safeSymbol(marketId, market),
153451
153498
  'maker': this.safeNumber(fee, 'actualMakerRate'),
153452
153499
  'taker': this.safeNumber(fee, 'actualTakerRate'),
153500
+ 'percentage': undefined,
153501
+ 'tierBased': undefined,
153453
153502
  };
153454
153503
  }
153455
153504
  async fetchTradingFee(symbol, params = {}) {
@@ -172734,7 +172783,8 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
172734
172783
  // swap == perpetual
172735
172784
  let settle = undefined;
172736
172785
  let settleId = undefined;
172737
- const amountPrecision = this.parseNumber(this.parsePrecision(this.safeString(market, 'contractValueTradePrecision', '0')));
172786
+ const cvtp = this.safeString(market, 'contractValueTradePrecision');
172787
+ const amountPrecision = this.parseNumber(this.integerPrecisionToAmount(cvtp));
172738
172788
  const pricePrecision = this.safeNumber(market, 'tickSize');
172739
172789
  const contract = (swap || future || index);
172740
172790
  const swapOrFutures = (swap || future);
@@ -178609,9 +178659,9 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
178609
178659
  }
178610
178660
  parseBalanceHelper(entry) {
178611
178661
  const account = this.account();
178612
- account['used'] = this.safeString(entry, 'holdBalance');
178613
- account['free'] = this.safeString(entry, 'availableBalance');
178614
- account['total'] = this.safeString(entry, 'totalBalance');
178662
+ account['used'] = this.safeString2(entry, 'holdBalance', 'hold');
178663
+ account['free'] = this.safeString2(entry, 'availableBalance', 'available');
178664
+ account['total'] = this.safeString2(entry, 'totalBalance', 'total');
178615
178665
  const debt = this.safeString(entry, 'liability');
178616
178666
  const interest = this.safeString(entry, 'interest');
178617
178667
  account['debt'] = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(debt, interest);
@@ -178622,9 +178672,9 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
178622
178672
  * @method
178623
178673
  * @name kucoin#fetchBalance
178624
178674
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
178625
- * @see https://docs.kucoin.com/#list-accounts
178626
178675
  * @see https://www.kucoin.com/docs/rest/account/basic-info/get-account-list-spot-margin-trade_hf
178627
- * @see https://docs.kucoin.com/#query-isolated-margin-account-info
178676
+ * @see https://www.kucoin.com/docs/rest/funding/funding-overview/get-account-detail-margin
178677
+ * @see https://www.kucoin.com/docs/rest/funding/funding-overview/get-account-detail-isolated-margin
178628
178678
  * @param {object} [params] extra parameters specific to the exchange API endpoint
178629
178679
  * @param {object} [params.marginMode] 'cross' or 'isolated', margin type for fetching margin balance
178630
178680
  * @param {object} [params.type] extra parameters specific to the exchange API endpoint
@@ -178651,7 +178701,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
178651
178701
  let response = undefined;
178652
178702
  const request = {};
178653
178703
  const isolated = (marginMode === 'isolated') || (type === 'isolated');
178654
- const cross = (marginMode === 'cross') || (type === 'cross');
178704
+ const cross = (marginMode === 'cross') || (type === 'margin');
178655
178705
  if (isolated) {
178656
178706
  if (currency !== undefined) {
178657
178707
  request['balanceCurrency'] = currency['id'];
@@ -178669,7 +178719,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
178669
178719
  response = await this.privateGetAccounts(this.extend(request, query));
178670
178720
  }
178671
178721
  //
178672
- // Spot and Cross
178722
+ // Spot
178673
178723
  //
178674
178724
  // {
178675
178725
  // "code": "200000",
@@ -178685,35 +178735,59 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
178685
178735
  // ]
178686
178736
  // }
178687
178737
  //
178738
+ // Cross
178739
+ //
178740
+ // {
178741
+ // "code": "200000",
178742
+ // "data": {
178743
+ // "debtRatio": "0",
178744
+ // "accounts": [
178745
+ // {
178746
+ // "currency": "USDT",
178747
+ // "totalBalance": "5",
178748
+ // "availableBalance": "5",
178749
+ // "holdBalance": "0",
178750
+ // "liability": "0",
178751
+ // "maxBorrowSize": "20"
178752
+ // },
178753
+ // ]
178754
+ // }
178755
+ // }
178756
+ //
178688
178757
  // Isolated
178689
178758
  //
178690
178759
  // {
178691
178760
  // "code": "200000",
178692
178761
  // "data": {
178693
- // "totalConversionBalance": "0",
178694
- // "liabilityConversionBalance": "0",
178762
+ // "totalAssetOfQuoteCurrency": "0",
178763
+ // "totalLiabilityOfQuoteCurrency": "0",
178764
+ // "timestamp": 1712085661155,
178695
178765
  // "assets": [
178696
178766
  // {
178697
178767
  // "symbol": "MANA-USDT",
178698
- // "status": "CLEAR",
178768
+ // "status": "EFFECTIVE",
178699
178769
  // "debtRatio": "0",
178700
178770
  // "baseAsset": {
178701
178771
  // "currency": "MANA",
178702
- // "totalBalance": "0",
178703
- // "holdBalance": "0",
178704
- // "availableBalance": "0",
178772
+ // "borrowEnabled": true,
178773
+ // "transferInEnabled": true,
178774
+ // "total": "0",
178775
+ // "hold": "0",
178776
+ // "available": "0",
178705
178777
  // "liability": "0",
178706
178778
  // "interest": "0",
178707
- // "borrowableAmount": "0"
178779
+ // "maxBorrowSize": "0"
178708
178780
  // },
178709
178781
  // "quoteAsset": {
178710
178782
  // "currency": "USDT",
178711
- // "totalBalance": "0",
178712
- // "holdBalance": "0",
178713
- // "availableBalance": "0",
178783
+ // "borrowEnabled": true,
178784
+ // "transferInEnabled": true,
178785
+ // "total": "0",
178786
+ // "hold": "0",
178787
+ // "available": "0",
178714
178788
  // "liability": "0",
178715
178789
  // "interest": "0",
178716
- // "borrowableAmount": "0"
178790
+ // "maxBorrowSize": "0"
178717
178791
  // }
178718
178792
  // },
178719
178793
  // ...
@@ -178721,13 +178795,14 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
178721
178795
  // }
178722
178796
  // }
178723
178797
  //
178724
- const data = this.safeList(response, 'data', []);
178798
+ let data = undefined;
178725
178799
  const result = {
178726
178800
  'info': response,
178727
178801
  'timestamp': undefined,
178728
178802
  'datetime': undefined,
178729
178803
  };
178730
178804
  if (isolated) {
178805
+ data = this.safeDict(response, 'data', {});
178731
178806
  const assets = this.safeValue(data, 'assets', data);
178732
178807
  for (let i = 0; i < assets.length; i++) {
178733
178808
  const entry = assets[i];
@@ -178744,6 +178819,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
178744
178819
  }
178745
178820
  }
178746
178821
  else if (cross) {
178822
+ data = this.safeDict(response, 'data', {});
178747
178823
  const accounts = this.safeList(data, 'accounts', []);
178748
178824
  for (let i = 0; i < accounts.length; i++) {
178749
178825
  const balance = accounts[i];
@@ -178753,6 +178829,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
178753
178829
  }
178754
178830
  }
178755
178831
  else {
178832
+ data = this.safeList(response, 'data', []);
178756
178833
  for (let i = 0; i < data.length; i++) {
178757
178834
  const balance = data[i];
178758
178835
  const balanceType = this.safeString(balance, 'type');
@@ -185352,6 +185429,8 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
185352
185429
  'symbol': market['symbol'],
185353
185430
  'maker': this.safeNumber(response, 'makerFee'),
185354
185431
  'taker': this.safeNumber(response, 'takerFee'),
185432
+ 'percentage': undefined,
185433
+ 'tierBased': undefined,
185355
185434
  };
185356
185435
  }
185357
185436
  async fetchPrivateTradingFee(symbol, params = {}) {
@@ -185375,6 +185454,8 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
185375
185454
  'symbol': market['symbol'],
185376
185455
  'maker': this.safeNumber(response, 'makerFee'),
185377
185456
  'taker': this.safeNumber(response, 'takerFee'),
185457
+ 'percentage': undefined,
185458
+ 'tierBased': undefined,
185378
185459
  };
185379
185460
  }
185380
185461
  async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -187478,6 +187559,8 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
187478
187559
  'symbol': symbol,
187479
187560
  'maker': this.safeNumber(fee, 'makerCommission'),
187480
187561
  'taker': this.safeNumber(fee, 'takerCommission'),
187562
+ 'percentage': undefined,
187563
+ 'tierBased': undefined,
187481
187564
  };
187482
187565
  }
187483
187566
  async fetchTradingFee(symbol, params = {}) {
@@ -187492,7 +187575,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
187492
187575
  */
187493
187576
  const market = this.market(symbol);
187494
187577
  const result = await this.fetchTradingFees(this.extend(params, { 'category': market['id'] }));
187495
- return result;
187578
+ return this.safeDict(result, symbol);
187496
187579
  }
187497
187580
  async fetchTradingFees(params = {}) {
187498
187581
  /**
@@ -189996,6 +190079,8 @@ class luno extends _abstract_luno_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
189996
190079
  'symbol': symbol,
189997
190080
  'maker': this.safeNumber(response, 'maker_fee'),
189998
190081
  'taker': this.safeNumber(response, 'taker_fee'),
190082
+ 'percentage': undefined,
190083
+ 'tierBased': undefined,
189999
190084
  };
190000
190085
  }
190001
190086
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -196796,8 +196881,9 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
196796
196881
  /**
196797
196882
  * @method
196798
196883
  * @name mexc#fetchLeverageTiers
196799
- * @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
196800
- * @param {string[]|undefined} symbols list of unified market symbols
196884
+ * @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
196885
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-contract-information
196886
+ * @param {string[]} [symbols] list of unified market symbols
196801
196887
  * @param {object} [params] extra parameters specific to the exchange API endpoint
196802
196888
  * @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
196803
196889
  */
@@ -196853,10 +196939,44 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
196853
196939
  return this.parseLeverageTiers(data, symbols, 'symbol');
196854
196940
  }
196855
196941
  parseMarketLeverageTiers(info, market = undefined) {
196856
- /**
196857
- @param info {object} Exchange response for 1 market
196858
- @param market {object} CCXT market
196859
- */
196942
+ //
196943
+ // {
196944
+ // "symbol": "BTC_USDT",
196945
+ // "displayName": "BTC_USDT永续",
196946
+ // "displayNameEn": "BTC_USDT SWAP",
196947
+ // "positionOpenType": 3,
196948
+ // "baseCoin": "BTC",
196949
+ // "quoteCoin": "USDT",
196950
+ // "settleCoin": "USDT",
196951
+ // "contractSize": 0.0001,
196952
+ // "minLeverage": 1,
196953
+ // "maxLeverage": 125,
196954
+ // "priceScale": 2,
196955
+ // "volScale": 0,
196956
+ // "amountScale": 4,
196957
+ // "priceUnit": 0.5,
196958
+ // "volUnit": 1,
196959
+ // "minVol": 1,
196960
+ // "maxVol": 1000000,
196961
+ // "bidLimitPriceRate": 0.1,
196962
+ // "askLimitPriceRate": 0.1,
196963
+ // "takerFeeRate": 0.0006,
196964
+ // "makerFeeRate": 0.0002,
196965
+ // "maintenanceMarginRate": 0.004,
196966
+ // "initialMarginRate": 0.008,
196967
+ // "riskBaseVol": 10000,
196968
+ // "riskIncrVol": 200000,
196969
+ // "riskIncrMmr": 0.004,
196970
+ // "riskIncrImr": 0.004,
196971
+ // "riskLevelLimit": 5,
196972
+ // "priceCoefficientVariation": 0.1,
196973
+ // "indexOrigin": ["BINANCE","GATEIO","HUOBI","MXC"],
196974
+ // "state": 0, // 0 enabled, 1 delivery, 2 completed, 3 offline, 4 pause
196975
+ // "isNew": false,
196976
+ // "isHot": true,
196977
+ // "isHidden": false
196978
+ // }
196979
+ //
196860
196980
  let maintenanceMarginRate = this.safeString(info, 'maintenanceMarginRate');
196861
196981
  let initialMarginRate = this.safeString(info, 'initialMarginRate');
196862
196982
  const maxVol = this.safeString(info, 'maxVol');
@@ -196866,6 +196986,19 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
196866
196986
  let floor = '0';
196867
196987
  const tiers = [];
196868
196988
  const quoteId = this.safeString(info, 'quoteCoin');
196989
+ if (riskIncrVol === '0') {
196990
+ return [
196991
+ {
196992
+ 'tier': 0,
196993
+ 'currency': this.safeCurrencyCode(quoteId),
196994
+ 'notionalFloor': undefined,
196995
+ 'notionalCap': undefined,
196996
+ 'maintenanceMarginRate': undefined,
196997
+ 'maxLeverage': this.safeNumber(info, 'maxLeverage'),
196998
+ 'info': info,
196999
+ },
197000
+ ];
197001
+ }
196869
197002
  while (_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringLt(floor, maxVol)) {
196870
197003
  const cap = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(floor, riskIncrVol);
196871
197004
  tiers.push({
@@ -197008,7 +197141,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
197008
197141
  }
197009
197142
  }
197010
197143
  if (result === undefined) {
197011
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidAddress(this.id + ' fetchDepositAddress() cannot find a deposit address for ' + code + ', and network' + network + 'consider creating one using the MEXC platform');
197144
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidAddress(this.id + ' fetchDepositAddress() cannot find a deposit address for ' + code + ', and network' + network + 'consider creating one using .createDepositAddress() method or in MEXC website');
197012
197145
  }
197013
197146
  return result;
197014
197147
  }
@@ -208621,6 +208754,8 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
208621
208754
  // OKX returns the fees as negative values opposed to other exchanges, so the sign needs to be flipped
208622
208755
  'maker': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringNeg(this.safeString2(fee, 'maker', 'makerU'))),
208623
208756
  'taker': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringNeg(this.safeString2(fee, 'taker', 'takerU'))),
208757
+ 'percentage': undefined,
208758
+ 'tierBased': undefined,
208624
208759
  };
208625
208760
  }
208626
208761
  async fetchTradingFee(symbol, params = {}) {
@@ -236431,6 +236566,8 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
236431
236566
  'ordersAlgo': this.handleOrder,
236432
236567
  'account': this.handleBalance,
236433
236568
  'positions': this.handlePositions,
236569
+ 'account-isolated': this.handleBalance,
236570
+ 'account-crossed': this.handleBalance,
236434
236571
  };
236435
236572
  const arg = this.safeValue(message, 'arg', {});
236436
236573
  const topic = this.safeValue(arg, 'channel', '');
@@ -299471,6 +299608,8 @@ class timex extends _abstract_timex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
299471
299608
  'symbol': this.safeSymbol(marketId, market),
299472
299609
  'maker': rate,
299473
299610
  'taker': rate,
299611
+ 'percentage': undefined,
299612
+ 'tierBased': undefined,
299474
299613
  };
299475
299614
  }
299476
299615
  async fetchTradingFee(symbol, params = {}) {
@@ -324170,9 +324309,11 @@ __webpack_require__.r(__webpack_exports__);
324170
324309
  /* harmony export */ BadSymbol: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.BadSymbol),
324171
324310
  /* harmony export */ BaseError: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.BaseError),
324172
324311
  /* harmony export */ CancelPending: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.CancelPending),
324312
+ /* harmony export */ ContractUnavailable: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.ContractUnavailable),
324173
324313
  /* harmony export */ DDoSProtection: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.DDoSProtection),
324174
324314
  /* harmony export */ DuplicateOrderId: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.DuplicateOrderId),
324175
324315
  /* harmony export */ Exchange: () => (/* reexport safe */ _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__.e),
324316
+ /* harmony export */ ExchangeClosedByUser: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.ExchangeClosedByUser),
324176
324317
  /* harmony export */ ExchangeError: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.ExchangeError),
324177
324318
  /* harmony export */ ExchangeNotAvailable: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.ExchangeNotAvailable),
324178
324319
  /* harmony export */ InsufficientFunds: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.InsufficientFunds),
@@ -324185,12 +324326,15 @@ __webpack_require__.r(__webpack_exports__);
324185
324326
  /* harmony export */ NotSupported: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.NotSupported),
324186
324327
  /* harmony export */ NullResponse: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.NullResponse),
324187
324328
  /* harmony export */ OnMaintenance: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.OnMaintenance),
324329
+ /* harmony export */ OperationFailed: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.OperationFailed),
324330
+ /* harmony export */ OperationRejected: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.OperationRejected),
324188
324331
  /* harmony export */ OrderImmediatelyFillable: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.OrderImmediatelyFillable),
324189
324332
  /* harmony export */ OrderNotCached: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.OrderNotCached),
324190
324333
  /* harmony export */ OrderNotFillable: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.OrderNotFillable),
324191
324334
  /* harmony export */ OrderNotFound: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.OrderNotFound),
324192
324335
  /* harmony export */ PermissionDenied: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.PermissionDenied),
324193
324336
  /* harmony export */ Precise: () => (/* reexport safe */ _src_base_Precise_js__WEBPACK_IMPORTED_MODULE_168__.O),
324337
+ /* harmony export */ ProxyError: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.ProxyError),
324194
324338
  /* harmony export */ RateLimitExceeded: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.RateLimitExceeded),
324195
324339
  /* harmony export */ RequestTimeout: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.RequestTimeout),
324196
324340
  /* harmony export */ ace: () => (/* reexport safe */ _src_ace_js__WEBPACK_IMPORTED_MODULE_1__.Z),
@@ -324508,7 +324652,7 @@ SOFTWARE.
324508
324652
 
324509
324653
  //-----------------------------------------------------------------------------
324510
324654
  // this is updated by vss.js when building
324511
- const version = '4.2.87';
324655
+ const version = '4.2.89';
324512
324656
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
324513
324657
  //-----------------------------------------------------------------------------
324514
324658