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.
Files changed (151) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.min.js +15 -15
  3. package/dist/cjs/ccxt.js +6 -6
  4. package/dist/cjs/src/abstract/toobit.js +11 -0
  5. package/dist/cjs/src/abstract/tradeogre.js +1 -1
  6. package/dist/cjs/src/apex.js +2 -2
  7. package/dist/cjs/src/backpack.js +1 -1
  8. package/dist/cjs/src/base/Exchange.js +129 -2
  9. package/dist/cjs/src/bigone.js +4 -4
  10. package/dist/cjs/src/binance.js +82 -20
  11. package/dist/cjs/src/bingx.js +5 -2
  12. package/dist/cjs/src/bitbank.js +1 -0
  13. package/dist/cjs/src/bitbns.js +1 -0
  14. package/dist/cjs/src/bitflyer.js +1 -0
  15. package/dist/cjs/src/bitget.js +16 -9
  16. package/dist/cjs/src/bithumb.js +1 -0
  17. package/dist/cjs/src/bitso.js +1 -0
  18. package/dist/cjs/src/bitvavo.js +26 -40
  19. package/dist/cjs/src/blockchaincom.js +1 -0
  20. package/dist/cjs/src/btcalpha.js +1 -0
  21. package/dist/cjs/src/btcbox.js +1 -0
  22. package/dist/cjs/src/btcmarkets.js +1 -0
  23. package/dist/cjs/src/btcturk.js +1 -0
  24. package/dist/cjs/src/bybit.js +186 -127
  25. package/dist/cjs/src/coinsph.js +4 -1
  26. package/dist/cjs/src/cryptocom.js +6 -3
  27. package/dist/cjs/src/deribit.js +3 -2
  28. package/dist/cjs/src/digifinex.js +1 -1
  29. package/dist/cjs/src/gate.js +9 -13
  30. package/dist/cjs/src/gemini.js +5 -5
  31. package/dist/cjs/src/htx.js +11 -1
  32. package/dist/cjs/src/hyperliquid.js +3 -0
  33. package/dist/cjs/src/independentreserve.js +1 -0
  34. package/dist/cjs/src/indodax.js +17 -6
  35. package/dist/cjs/src/kraken.js +31 -8
  36. package/dist/cjs/src/krakenfutures.js +1 -0
  37. package/dist/cjs/src/kucoin.js +1 -2
  38. package/dist/cjs/src/luno.js +4 -1
  39. package/dist/cjs/src/mercado.js +1 -0
  40. package/dist/cjs/src/mexc.js +84 -37
  41. package/dist/cjs/src/novadax.js +1 -0
  42. package/dist/cjs/src/oceanex.js +1 -0
  43. package/dist/cjs/src/okcoin.js +4 -1
  44. package/dist/cjs/src/okx.js +52 -8
  45. package/dist/cjs/src/phemex.js +1 -1
  46. package/dist/cjs/src/pro/apex.js +8 -4
  47. package/dist/cjs/src/pro/backpack.js +7 -5
  48. package/dist/cjs/src/pro/binance.js +150 -19
  49. package/dist/cjs/src/pro/bingx.js +206 -220
  50. package/dist/cjs/src/pro/bitget.js +332 -76
  51. package/dist/cjs/src/pro/cex.js +1 -0
  52. package/dist/cjs/src/pro/htx.js +1 -1
  53. package/dist/cjs/src/pro/independentreserve.js +1 -0
  54. package/dist/cjs/src/pro/mexc.js +23 -23
  55. package/dist/cjs/src/pro/okx.js +46 -10
  56. package/dist/cjs/src/pro/toobit.js +1163 -0
  57. package/dist/cjs/src/pro/tradeogre.js +1 -1
  58. package/dist/cjs/src/toobit.js +2999 -0
  59. package/dist/cjs/src/tradeogre.js +1 -1
  60. package/dist/cjs/src/upbit.js +1 -0
  61. package/dist/cjs/src/wavesexchange.js +1 -0
  62. package/dist/cjs/src/yobit.js +1 -0
  63. package/dist/cjs/src/zaif.js +1 -0
  64. package/dist/cjs/src/zonda.js +1 -0
  65. package/js/ccxt.d.ts +8 -8
  66. package/js/ccxt.js +6 -6
  67. package/js/src/abstract/mexc.d.ts +1 -0
  68. package/js/src/abstract/myokx.d.ts +1 -0
  69. package/js/src/abstract/okx.d.ts +1 -0
  70. package/js/src/abstract/okxus.d.ts +1 -0
  71. package/js/src/abstract/toobit.d.ts +66 -0
  72. package/js/src/apex.js +2 -2
  73. package/js/src/backpack.js +1 -1
  74. package/js/src/base/Exchange.d.ts +9 -0
  75. package/js/src/base/Exchange.js +129 -2
  76. package/js/src/bigone.js +4 -4
  77. package/js/src/binance.d.ts +9 -0
  78. package/js/src/binance.js +82 -20
  79. package/js/src/bingx.js +5 -2
  80. package/js/src/bitbank.js +1 -0
  81. package/js/src/bitbns.js +1 -0
  82. package/js/src/bitflyer.js +1 -0
  83. package/js/src/bitget.js +16 -9
  84. package/js/src/bithumb.js +1 -0
  85. package/js/src/bitso.js +1 -0
  86. package/js/src/bitvavo.d.ts +0 -2
  87. package/js/src/bitvavo.js +27 -41
  88. package/js/src/blockchaincom.js +1 -0
  89. package/js/src/btcalpha.js +1 -0
  90. package/js/src/btcbox.js +1 -0
  91. package/js/src/btcmarkets.js +1 -0
  92. package/js/src/btcturk.js +1 -0
  93. package/js/src/bybit.d.ts +8 -0
  94. package/js/src/bybit.js +186 -127
  95. package/js/src/coinsph.js +4 -1
  96. package/js/src/cryptocom.js +6 -3
  97. package/js/src/deribit.js +3 -2
  98. package/js/src/digifinex.js +1 -1
  99. package/js/src/gate.d.ts +2 -2
  100. package/js/src/gate.js +9 -13
  101. package/js/src/gemini.js +5 -5
  102. package/js/src/htx.js +11 -1
  103. package/js/src/hyperliquid.js +3 -0
  104. package/js/src/independentreserve.js +1 -0
  105. package/js/src/indodax.js +17 -6
  106. package/js/src/kraken.d.ts +2 -2
  107. package/js/src/kraken.js +31 -8
  108. package/js/src/krakenfutures.js +1 -0
  109. package/js/src/kucoin.js +1 -2
  110. package/js/src/luno.js +4 -1
  111. package/js/src/mercado.js +1 -0
  112. package/js/src/mexc.d.ts +4 -1
  113. package/js/src/mexc.js +84 -37
  114. package/js/src/novadax.js +1 -0
  115. package/js/src/oceanex.js +1 -0
  116. package/js/src/okcoin.js +4 -1
  117. package/js/src/okx.js +52 -8
  118. package/js/src/phemex.js +1 -1
  119. package/js/src/pro/apex.js +8 -4
  120. package/js/src/pro/backpack.d.ts +1 -1
  121. package/js/src/pro/backpack.js +7 -5
  122. package/js/src/pro/binance.d.ts +24 -0
  123. package/js/src/pro/binance.js +150 -19
  124. package/js/src/pro/bingx.d.ts +53 -33
  125. package/js/src/pro/bingx.js +207 -221
  126. package/js/src/pro/bitget.d.ts +6 -0
  127. package/js/src/pro/bitget.js +332 -76
  128. package/js/src/pro/cex.js +1 -0
  129. package/js/src/pro/htx.js +1 -1
  130. package/js/src/pro/independentreserve.js +1 -0
  131. package/js/src/pro/mexc.js +23 -23
  132. package/js/src/pro/okx.d.ts +7 -1
  133. package/js/src/pro/okx.js +46 -10
  134. package/js/src/pro/toobit.d.ts +174 -0
  135. package/js/src/pro/toobit.js +1162 -0
  136. package/js/src/toobit.d.ts +456 -0
  137. package/js/src/toobit.js +2992 -0
  138. package/js/src/upbit.js +1 -0
  139. package/js/src/wavesexchange.js +1 -0
  140. package/js/src/yobit.js +1 -0
  141. package/js/src/zaif.js +1 -0
  142. package/js/src/zonda.js +1 -0
  143. package/package.json +1 -1
  144. package/dist/373.ccxt.browser.js +0 -7630
  145. package/dist/373.ccxt.browser.min.js +0 -1
  146. package/js/src/abstract/tradeogre.d.ts +0 -21
  147. package/js/src/pro/tradeogre.d.ts +0 -49
  148. package/js/src/pro/tradeogre.js +0 -278
  149. package/js/src/tradeogre.d.ts +0 -149
  150. package/js/src/tradeogre.js +0 -872
  151. /package/js/src/abstract/{tradeogre.js → toobit.js} +0 -0
package/js/src/htx.js CHANGED
@@ -2791,7 +2791,17 @@ export default class htx extends Exchange {
2791
2791
  'currency': feeCurrency,
2792
2792
  };
2793
2793
  }
2794
- const id = this.safeStringN(trade, ['trade_id', 'trade-id', 'id']);
2794
+ // htx's multi-market trade-id is a bit complex to parse accordingly.
2795
+ // - for `id` which contains hyphen, it would be the unique id, eg. xxxxxx-1, xxxxxx-2 (this happens mostly for contract markets)
2796
+ // - otherwise the least priority is given to the `id` key
2797
+ let id = undefined;
2798
+ const safeId = this.safeString(trade, 'id');
2799
+ if (safeId !== undefined && safeId.indexOf('-') >= 0) {
2800
+ id = safeId;
2801
+ }
2802
+ else {
2803
+ id = this.safeStringN(trade, ['trade_id', 'trade-id', 'id']);
2804
+ }
2795
2805
  return this.safeTrade({
2796
2806
  'id': id,
2797
2807
  'info': trade,
@@ -3562,6 +3562,9 @@ export default class hyperliquid extends Exchange {
3562
3562
  }
3563
3563
  const until = this.safeInteger(params, 'until');
3564
3564
  if (until !== undefined) {
3565
+ if (since === undefined) {
3566
+ throw new ArgumentsRequired(this.id + ' fetchDeposits requires since while until is set');
3567
+ }
3565
3568
  request['endTime'] = until;
3566
3569
  params = this.omit(params, ['until']);
3567
3570
  }
@@ -47,6 +47,7 @@ export default class independentreserve extends Exchange {
47
47
  'fetchClosedOrders': true,
48
48
  'fetchCrossBorrowRate': false,
49
49
  'fetchCrossBorrowRates': false,
50
+ 'fetchCurrencies': false,
50
51
  'fetchDepositAddress': true,
51
52
  'fetchDepositAddresses': false,
52
53
  'fetchDepositAddressesByNetwork': false,
package/js/src/indodax.js CHANGED
@@ -51,6 +51,7 @@ export default class indodax extends Exchange {
51
51
  'fetchClosedOrders': true,
52
52
  'fetchCrossBorrowRate': false,
53
53
  'fetchCrossBorrowRates': false,
54
+ 'fetchCurrencies': false,
54
55
  'fetchDeposit': false,
55
56
  'fetchDepositAddress': 'emulated',
56
57
  'fetchDepositAddresses': true,
@@ -360,7 +361,7 @@ export default class indodax extends Exchange {
360
361
  const result = [];
361
362
  for (let i = 0; i < response.length; i++) {
362
363
  const market = response[i];
363
- const id = this.safeString(market, 'ticker_id');
364
+ const id = this.safeString(market, 'id');
364
365
  const baseId = this.safeString(market, 'traded_currency');
365
366
  const quoteId = this.safeString(market, 'base_currency');
366
367
  const base = this.safeCurrencyCode(baseId);
@@ -499,7 +500,7 @@ export default class indodax extends Exchange {
499
500
  await this.loadMarkets();
500
501
  const market = this.market(symbol);
501
502
  const request = {
502
- 'pair': market['base'] + market['quote'],
503
+ 'pair': market['id'],
503
504
  };
504
505
  const orderbook = await this.publicGetApiDepthPair(this.extend(request, params));
505
506
  return this.parseOrderBook(orderbook, market['symbol'], undefined, 'buy', 'sell');
@@ -558,7 +559,7 @@ export default class indodax extends Exchange {
558
559
  await this.loadMarkets();
559
560
  const market = this.market(symbol);
560
561
  const request = {
561
- 'pair': market['base'] + market['quote'],
562
+ 'pair': market['id'],
562
563
  };
563
564
  const response = await this.publicGetApiTickerPair(this.extend(request, params));
564
565
  //
@@ -607,7 +608,17 @@ export default class indodax extends Exchange {
607
608
  //
608
609
  const response = await this.publicGetApiTickerAll(params);
609
610
  const tickers = this.safeDict(response, 'tickers', {});
610
- return this.parseTickers(tickers, symbols);
611
+ const keys = Object.keys(tickers);
612
+ const parsedTickers = {};
613
+ for (let i = 0; i < keys.length; i++) {
614
+ const key = keys[i];
615
+ const rawTicker = tickers[key];
616
+ const marketId = key.replace('_', '');
617
+ const market = this.safeMarket(marketId);
618
+ const parsed = this.parseTicker(rawTicker, market);
619
+ parsedTickers[marketId] = parsed;
620
+ }
621
+ return this.filterByArray(parsedTickers, 'symbol', symbols);
611
622
  }
612
623
  parseTrade(trade, market = undefined) {
613
624
  const timestamp = this.safeTimestamp(trade, 'date');
@@ -642,7 +653,7 @@ export default class indodax extends Exchange {
642
653
  await this.loadMarkets();
643
654
  const market = this.market(symbol);
644
655
  const request = {
645
- 'pair': market['base'] + market['quote'],
656
+ 'pair': market['id'],
646
657
  };
647
658
  const response = await this.publicGetApiTradesPair(this.extend(request, params));
648
659
  return this.parseTrades(response, market, since, limit);
@@ -689,7 +700,7 @@ export default class indodax extends Exchange {
689
700
  const request = {
690
701
  'to': until,
691
702
  'tf': selectedTimeframe,
692
- 'symbol': market['base'] + market['quote'],
703
+ 'symbol': market['id'],
693
704
  };
694
705
  if (limit === undefined) {
695
706
  limit = 1000;
@@ -304,7 +304,7 @@ export default class kraken extends Exchange {
304
304
  * @name kraken#cancelAllOrders
305
305
  * @description cancel all open orders
306
306
  * @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelAllOrders
307
- * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
307
+ * @param {string} symbol unified market symbol, not used by kraken cancelAllOrders (all open orders are cancelled)
308
308
  * @param {object} [params] extra parameters specific to the exchange API endpoint
309
309
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
310
310
  */
@@ -429,7 +429,7 @@ export default class kraken extends Exchange {
429
429
  * @see https://docs.kraken.com/rest/#tag/Funding/operation/withdrawFunds
430
430
  * @param {string} code unified currency code
431
431
  * @param {float} amount the amount to withdraw
432
- * @param {string} address the address to withdraw to
432
+ * @param {string} address the address to withdraw to, not required can be '' or undefined/none/null
433
433
  * @param {string} tag
434
434
  * @param {object} [params] extra parameters specific to the exchange API endpoint
435
435
  * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
package/js/src/kraken.js CHANGED
@@ -231,6 +231,23 @@ export default class kraken extends Exchange {
231
231
  'XBT': 'BTC',
232
232
  'XDG': 'DOGE',
233
233
  'FEE': 'KFEE',
234
+ 'XETC': 'ETC',
235
+ 'XETH': 'ETH',
236
+ 'XLTC': 'LTC',
237
+ 'XMLN': 'MLN',
238
+ 'XREP': 'REP',
239
+ 'XXBT': 'BTC',
240
+ 'XXDG': 'DOGE',
241
+ 'XXLM': 'XLM',
242
+ 'XXMR': 'XMR',
243
+ 'XXRP': 'XRP',
244
+ 'XZEC': 'ZEC',
245
+ 'ZAUD': 'AUD',
246
+ 'ZCAD': 'CAD',
247
+ 'ZEUR': 'EUR',
248
+ 'ZGBP': 'GBP',
249
+ 'ZJPY': 'JPY',
250
+ 'ZUSD': 'USD',
234
251
  },
235
252
  'options': {
236
253
  'timeDifference': 0,
@@ -424,6 +441,7 @@ export default class kraken extends Exchange {
424
441
  'OriginTrail': 'OTP',
425
442
  'Celestia': 'TIA',
426
443
  },
444
+ 'marketHelperProps': ['marketsByAltname', 'delistedMarketsById'], // used by setMarketsFromExchange
427
445
  },
428
446
  'features': {
429
447
  'spot': {
@@ -610,10 +628,12 @@ export default class kraken extends Exchange {
610
628
  for (let i = 0; i < keys.length; i++) {
611
629
  const id = keys[i];
612
630
  const market = markets[id];
613
- const baseId = this.safeString(market, 'base');
614
- const quoteId = this.safeString(market, 'quote');
615
- const base = this.safeCurrencyCode(baseId);
616
- const quote = this.safeCurrencyCode(quoteId);
631
+ const baseIdRaw = this.safeString(market, 'base');
632
+ const quoteIdRaw = this.safeString(market, 'quote');
633
+ const baseId = this.safeCurrencyCode(baseIdRaw);
634
+ const quoteId = this.safeCurrencyCode(quoteIdRaw);
635
+ const base = baseId;
636
+ const quote = quoteId;
617
637
  const makerFees = this.safeList(market, 'fees_maker', []);
618
638
  const firstMakerFee = this.safeList(makerFees, 0, []);
619
639
  const firstMakerFeeRate = this.safeString(firstMakerFee, 1);
@@ -2523,7 +2543,7 @@ export default class kraken extends Exchange {
2523
2543
  * @name kraken#cancelAllOrders
2524
2544
  * @description cancel all open orders
2525
2545
  * @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelAllOrders
2526
- * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
2546
+ * @param {string} symbol unified market symbol, not used by kraken cancelAllOrders (all open orders are cancelled)
2527
2547
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2528
2548
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
2529
2549
  */
@@ -3188,22 +3208,25 @@ export default class kraken extends Exchange {
3188
3208
  * @see https://docs.kraken.com/rest/#tag/Funding/operation/withdrawFunds
3189
3209
  * @param {string} code unified currency code
3190
3210
  * @param {float} amount the amount to withdraw
3191
- * @param {string} address the address to withdraw to
3211
+ * @param {string} address the address to withdraw to, not required can be '' or undefined/none/null
3192
3212
  * @param {string} tag
3193
3213
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3194
3214
  * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
3195
3215
  */
3196
3216
  async withdraw(code, amount, address, tag = undefined, params = {}) {
3197
3217
  [tag, params] = this.handleWithdrawTagAndParams(tag, params);
3198
- this.checkAddress(address);
3199
3218
  if ('key' in params) {
3200
3219
  await this.loadMarkets();
3201
3220
  const currency = this.currency(code);
3202
3221
  const request = {
3203
3222
  'asset': currency['id'],
3204
3223
  'amount': amount,
3205
- 'address': address,
3224
+ // 'address': address,
3206
3225
  };
3226
+ if (address !== undefined && address !== '') {
3227
+ request['address'] = address;
3228
+ this.checkAddress(address);
3229
+ }
3207
3230
  const response = await this.privatePostWithdraw(this.extend(request, params));
3208
3231
  //
3209
3232
  // {
@@ -47,6 +47,7 @@ export default class krakenfutures extends Exchange {
47
47
  'fetchClosedOrders': true,
48
48
  'fetchCrossBorrowRate': false,
49
49
  'fetchCrossBorrowRates': false,
50
+ 'fetchCurrencies': false,
50
51
  'fetchDepositAddress': false,
51
52
  'fetchDepositAddresses': false,
52
53
  'fetchDepositAddressesByNetwork': false,
package/js/src/kucoin.js CHANGED
@@ -1385,7 +1385,6 @@ export default class kucoin extends Exchange {
1385
1385
  //
1386
1386
  const currenciesData = this.safeList(response, 'data', []);
1387
1387
  const brokenCurrencies = this.safeList(this.options, 'brokenCurrencies', ['00', 'OPEN_ERROR', 'HUF', 'BDT']);
1388
- const otherFiats = this.safeList(this.options, 'fiats', ['KWD', 'IRR', 'PKR']);
1389
1388
  const result = {};
1390
1389
  for (let i = 0; i < currenciesData.length; i++) {
1391
1390
  const entry = currenciesData[i];
@@ -1426,7 +1425,7 @@ export default class kucoin extends Exchange {
1426
1425
  // kucoin has determined 'fiat' currencies with below logic
1427
1426
  const rawPrecision = this.safeString(entry, 'precision');
1428
1427
  const precision = this.parseNumber(this.parsePrecision(rawPrecision));
1429
- const isFiat = this.inArray(id, otherFiats) || ((rawPrecision === '2') && (chainsLength === 0));
1428
+ const isFiat = chainsLength === 0;
1430
1429
  result[code] = this.safeCurrencyStructure({
1431
1430
  'id': id,
1432
1431
  'name': this.safeString(entry, 'fullName'),
package/js/src/luno.js CHANGED
@@ -220,6 +220,9 @@ export default class luno extends Exchange {
220
220
  'features': {
221
221
  'spot': {
222
222
  'sandbox': false,
223
+ 'fetchCurrencies': {
224
+ 'private': true,
225
+ },
223
226
  'createOrder': {
224
227
  'marginMode': false,
225
228
  'triggerPrice': true,
@@ -306,7 +309,7 @@ export default class luno extends Exchange {
306
309
  */
307
310
  async fetchCurrencies(params = {}) {
308
311
  if (!this.checkRequiredCredentials(false)) {
309
- return undefined;
312
+ return {};
310
313
  }
311
314
  const response = await this.privateGetSendNetworks(params);
312
315
  //
package/js/src/mercado.js CHANGED
@@ -47,6 +47,7 @@ export default class mercado extends Exchange {
47
47
  'fetchBorrowRatesPerSymbol': false,
48
48
  'fetchCrossBorrowRate': false,
49
49
  'fetchCrossBorrowRates': false,
50
+ 'fetchCurrencies': false,
50
51
  'fetchDepositAddress': false,
51
52
  'fetchDepositAddresses': false,
52
53
  'fetchDepositAddressesByNetwork': false,
package/js/src/mexc.d.ts CHANGED
@@ -624,10 +624,13 @@ export default class mexc extends Exchange {
624
624
  * @description fetch a history of internal transfers made on an account
625
625
  * @see https://mexcdevelop.github.io/apidocs/spot_v2_en/#get-internal-assets-transfer-records
626
626
  * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-user-39-s-asset-transfer-records
627
- * @param {string} code unified currency code of the currency transferred
627
+ * @see https://www.mexc.com/api-docs/spot-v3/wallet-endpoints#query-user-universal-transfer-history * @param {string} code unified currency code of the currency transferred
628
+ * @param code
628
629
  * @param {int} [since] the earliest time in ms to fetch transfers for
629
630
  * @param {int} [limit] the maximum number of transfers structures to retrieve
630
631
  * @param {object} [params] extra parameters specific to the exchange API endpoint
632
+ * @param {string} [params.fromAccountType] 'SPOT' for spot wallet, 'FUTURES' for contract wallet
633
+ * @param {string} [params.toAccountType] 'SPOT' for spot wallet, 'FUTURES' for contract wallet
631
634
  * @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
632
635
  */
633
636
  fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntry[]>;
package/js/src/mexc.js CHANGED
@@ -227,6 +227,7 @@ export default class mexc extends Exchange {
227
227
  'mxDeduct/enable': 1,
228
228
  'userDataStream': 1,
229
229
  'selfSymbols': 1,
230
+ 'asset/internal/transfer/record': 10,
230
231
  },
231
232
  'post': {
232
233
  'order': 1,
@@ -758,6 +759,9 @@ export default class mexc extends Exchange {
758
759
  },
759
760
  'spot': {
760
761
  'extends': 'default',
762
+ 'fetchCurrencies': {
763
+ 'private': true,
764
+ },
761
765
  },
762
766
  'forDerivs': {
763
767
  'extends': 'default',
@@ -1048,7 +1052,7 @@ export default class mexc extends Exchange {
1048
1052
  // therefore we check the keys here
1049
1053
  // and fallback to generating the currencies from the markets
1050
1054
  if (!this.checkRequiredCredentials(false)) {
1051
- return undefined;
1055
+ return {};
1052
1056
  }
1053
1057
  const response = await this.spotPrivateGetCapitalConfigGetall(params);
1054
1058
  //
@@ -5262,7 +5266,7 @@ export default class mexc extends Exchange {
5262
5266
  const request = {
5263
5267
  'transact_id': id,
5264
5268
  };
5265
- const response = await this.spot2PrivateGetAssetInternalTransferInfo(this.extend(request, query));
5269
+ const response = await this.spotPrivateGetAssetInternalTransferRecord(this.extend(request, query));
5266
5270
  //
5267
5271
  // {
5268
5272
  // "code": "200",
@@ -5290,60 +5294,84 @@ export default class mexc extends Exchange {
5290
5294
  * @description fetch a history of internal transfers made on an account
5291
5295
  * @see https://mexcdevelop.github.io/apidocs/spot_v2_en/#get-internal-assets-transfer-records
5292
5296
  * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-user-39-s-asset-transfer-records
5293
- * @param {string} code unified currency code of the currency transferred
5297
+ * @see https://www.mexc.com/api-docs/spot-v3/wallet-endpoints#query-user-universal-transfer-history * @param {string} code unified currency code of the currency transferred
5298
+ * @param code
5294
5299
  * @param {int} [since] the earliest time in ms to fetch transfers for
5295
5300
  * @param {int} [limit] the maximum number of transfers structures to retrieve
5296
5301
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5302
+ * @param {string} [params.fromAccountType] 'SPOT' for spot wallet, 'FUTURES' for contract wallet
5303
+ * @param {string} [params.toAccountType] 'SPOT' for spot wallet, 'FUTURES' for contract wallet
5297
5304
  * @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
5298
5305
  */
5299
5306
  async fetchTransfers(code = undefined, since = undefined, limit = undefined, params = {}) {
5300
- const [marketType, query] = this.handleMarketTypeAndParams('fetchTransfers', undefined, params);
5307
+ let marketType = undefined;
5308
+ [marketType, params] = this.handleMarketTypeAndParams('fetchTransfers', undefined, params);
5301
5309
  await this.loadMarkets();
5302
5310
  const request = {};
5303
5311
  let currency = undefined;
5304
- let resultList = undefined;
5305
5312
  if (code !== undefined) {
5306
5313
  currency = this.currency(code);
5307
- request['currency'] = currency['id'];
5308
5314
  }
5315
+ let fromAccountType = undefined;
5316
+ [fromAccountType, params] = this.handleOptionAndParams(params, 'fetchTransfers', 'fromAccountType');
5317
+ const accountTypes = {
5318
+ 'spot': 'SPOT',
5319
+ 'swap': 'FUTURES',
5320
+ 'futures': 'FUTURES',
5321
+ 'future': 'FUTURES',
5322
+ 'margin': 'SPOT',
5323
+ };
5324
+ if (fromAccountType !== undefined) {
5325
+ request['fromAccountType'] = this.safeString(accountTypes, fromAccountType, fromAccountType);
5326
+ }
5327
+ else {
5328
+ throw new ArgumentsRequired(this.id + ' fetchTransfers() requires a fromAccountType parameter, one of "SPOT", "FUTURES"');
5329
+ }
5330
+ let toAccountType = undefined;
5331
+ [toAccountType, params] = this.handleOptionAndParams(params, 'fetchTransfers', 'toAccountType');
5332
+ if (toAccountType !== undefined) {
5333
+ request['toAccountType'] = this.safeString(accountTypes, toAccountType, toAccountType);
5334
+ }
5335
+ else {
5336
+ throw new ArgumentsRequired(this.id + ' fetchTransfers() requires a toAccountType parameter, one of "SPOT", "FUTURES"');
5337
+ }
5338
+ let resultList = [];
5309
5339
  if (marketType === 'spot') {
5310
5340
  if (since !== undefined) {
5311
- request['start_time'] = since;
5341
+ request['startTime'] = since;
5312
5342
  }
5313
5343
  if (limit !== undefined) {
5314
- if (limit > 50) {
5344
+ if (limit > 100) {
5315
5345
  throw new ExchangeError('This exchange supports a maximum limit of 50');
5316
5346
  }
5317
- request['page-size'] = limit;
5347
+ request['size'] = limit;
5318
5348
  }
5319
- const response = await this.spot2PrivateGetAssetInternalTransferRecord(this.extend(request, query));
5349
+ const response = await this.spotPrivateGetCapitalTransfer(this.extend(request, params));
5320
5350
  //
5321
- // {
5322
- // "code": "200",
5323
- // "data": {
5324
- // "total_page": "1",
5325
- // "total_size": "5",
5326
- // "result_list": [{
5327
- // "currency": "USDT",
5328
- // "amount": "1",
5329
- // "transact_id": "954877a2ef54499db9b28a7cf9ebcf41",
5330
- // "from": "MAIN",
5331
- // "to": "CONTRACT",
5332
- // "transact_state": "SUCCESS"
5333
- // },
5334
- // ...
5335
- // ]
5336
- // }
5337
- // }
5338
5351
  //
5339
- const data = this.safeValue(response, 'data', {});
5340
- resultList = this.safeValue(data, 'result_list', []);
5352
+ // {
5353
+ // "rows": [
5354
+ // {
5355
+ // "tranId": "cdf0d2a618b5458c965baefe6b1d0859",
5356
+ // "clientTranId": null,
5357
+ // "asset": "USDT",
5358
+ // "amount": "1",
5359
+ // "fromAccountType": "FUTURES",
5360
+ // "toAccountType": "SPOT",
5361
+ // "symbol": null,
5362
+ // "status": "SUCCESS",
5363
+ // "timestamp": 1759328309000
5364
+ // }
5365
+ // ],
5366
+ // "total": 1
5367
+ // }
5368
+ resultList = this.safeList(response, 'rows', []);
5341
5369
  }
5342
5370
  else if (marketType === 'swap') {
5343
5371
  if (limit !== undefined) {
5344
5372
  request['page_size'] = limit;
5345
5373
  }
5346
- const response = await this.contractPrivateGetAccountTransferRecord(this.extend(request, query));
5374
+ const response = await this.contractPrivateGetAccountTransferRecord(this.extend(request, params));
5347
5375
  const data = this.safeValue(response, 'data');
5348
5376
  resultList = this.safeValue(data, 'resultList');
5349
5377
  //
@@ -5392,10 +5420,10 @@ export default class mexc extends Exchange {
5392
5420
  const accounts = {
5393
5421
  'spot': 'SPOT',
5394
5422
  'swap': 'FUTURES',
5395
- 'margin': 'ISOLATED_MARGIN',
5423
+ 'future': 'FUTURES',
5396
5424
  };
5397
- const fromId = this.safeString(accounts, fromAccount);
5398
- const toId = this.safeString(accounts, toAccount);
5425
+ const fromId = this.safeString(accounts, fromAccount, fromAccount);
5426
+ const toId = this.safeString(accounts, toAccount, toAccount);
5399
5427
  if (fromId === undefined) {
5400
5428
  const keys = Object.keys(accounts);
5401
5429
  throw new ExchangeError(this.id + ' fromAccount must be one of ' + keys.join(', '));
@@ -5457,6 +5485,17 @@ export default class mexc extends Exchange {
5457
5485
  // "createTime": "1648849076000",
5458
5486
  // "updateTime": "1648849076000"
5459
5487
  // }
5488
+ // {
5489
+ // "tranId": "cdf0d2a618b5458c965baefe6b1d0859",
5490
+ // "clientTranId": null,
5491
+ // "asset": "USDT",
5492
+ // "amount": "1",
5493
+ // "fromAccountType": "FUTURES",
5494
+ // "toAccountType": "SPOT",
5495
+ // "symbol": null,
5496
+ // "status": "SUCCESS",
5497
+ // "timestamp": 1759328309000
5498
+ // }
5460
5499
  //
5461
5500
  // transfer
5462
5501
  //
@@ -5464,14 +5503,20 @@ export default class mexc extends Exchange {
5464
5503
  // "tranId": "ebb06123e6a64f4ab234b396c548d57e"
5465
5504
  // }
5466
5505
  //
5467
- const currencyId = this.safeString(transfer, 'currency');
5506
+ const currencyId = this.safeString2(transfer, 'currency', 'asset');
5468
5507
  const id = this.safeStringN(transfer, ['transact_id', 'txid', 'tranId']);
5469
- const timestamp = this.safeInteger(transfer, 'createTime');
5508
+ const timestamp = this.safeInteger2(transfer, 'createTime', 'timestamp');
5470
5509
  const datetime = (timestamp !== undefined) ? this.iso8601(timestamp) : undefined;
5471
5510
  const direction = this.safeString(transfer, 'type');
5472
5511
  let accountFrom = undefined;
5473
5512
  let accountTo = undefined;
5474
- if (direction !== undefined) {
5513
+ const fromAccountType = this.safeString(transfer, 'fromAccountType');
5514
+ const toAccountType = this.safeString(transfer, 'toAccountType');
5515
+ if ((fromAccountType !== undefined) && (toAccountType !== undefined)) {
5516
+ accountFrom = fromAccountType;
5517
+ accountTo = toAccountType;
5518
+ }
5519
+ else if (direction !== undefined) {
5475
5520
  accountFrom = (direction === 'IN') ? 'MAIN' : 'CONTRACT';
5476
5521
  accountTo = (direction === 'IN') ? 'CONTRACT' : 'MAIN';
5477
5522
  }
@@ -5488,11 +5533,13 @@ export default class mexc extends Exchange {
5488
5533
  'amount': this.safeNumber(transfer, 'amount'),
5489
5534
  'fromAccount': this.parseAccountId(accountFrom),
5490
5535
  'toAccount': this.parseAccountId(accountTo),
5491
- 'status': this.parseTransferStatus(this.safeString2(transfer, 'transact_state', 'state')),
5536
+ 'status': this.parseTransferStatus(this.safeStringN(transfer, ['transact_state', 'state', 'status'])),
5492
5537
  };
5493
5538
  }
5494
5539
  parseAccountId(status) {
5495
5540
  const statuses = {
5541
+ 'SPOT': 'spot',
5542
+ 'FUTURES': 'swap',
5496
5543
  'MAIN': 'spot',
5497
5544
  'CONTRACT': 'swap',
5498
5545
  };
package/js/src/novadax.js CHANGED
@@ -55,6 +55,7 @@ export default class novadax extends Exchange {
55
55
  'fetchClosedOrders': true,
56
56
  'fetchCrossBorrowRate': false,
57
57
  'fetchCrossBorrowRates': false,
58
+ 'fetchCurrencies': false,
58
59
  'fetchDepositAddress': false,
59
60
  'fetchDepositAddresses': false,
60
61
  'fetchDepositAddressesByNetwork': false,
package/js/src/oceanex.js CHANGED
@@ -44,6 +44,7 @@ export default class oceanex extends Exchange {
44
44
  'fetchClosedOrders': true,
45
45
  'fetchCrossBorrowRate': false,
46
46
  'fetchCrossBorrowRates': false,
47
+ 'fetchCurrencies': false,
47
48
  'fetchDepositAddress': 'emulated',
48
49
  'fetchDepositAddresses': undefined,
49
50
  'fetchDepositAddressesByNetwork': true,
package/js/src/okcoin.js CHANGED
@@ -205,6 +205,9 @@ export default class okcoin extends Exchange {
205
205
  'features': {
206
206
  'spot': {
207
207
  'sandbox': false,
208
+ 'fetchCurrencies': {
209
+ 'private': true,
210
+ },
208
211
  'createOrder': {
209
212
  'marginMode': true,
210
213
  'triggerPrice': true,
@@ -819,7 +822,7 @@ export default class okcoin extends Exchange {
819
822
  if (this.options['warnOnFetchCurrenciesWithoutAuthorization']) {
820
823
  throw new ExchangeError(this.id + ' fetchCurrencies() is a private API endpoint that requires authentication with API keys. Set the API keys on the exchange instance or exchange.options["warnOnFetchCurrenciesWithoutAuthorization"] = false to suppress this warning message.');
821
824
  }
822
- return undefined;
825
+ return {};
823
826
  }
824
827
  else {
825
828
  const response = await this.privateGetAssetCurrencies(params);