ccxt 4.5.1 → 4.5.3

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 (73) hide show
  1. package/README.md +110 -112
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -9
  4. package/dist/cjs/src/ascendex.js +1 -1
  5. package/dist/cjs/src/base/Exchange.js +11 -0
  6. package/dist/cjs/src/binance.js +25 -25
  7. package/dist/cjs/src/bitget.js +2 -2
  8. package/dist/cjs/src/coincatch.js +2 -2
  9. package/dist/cjs/src/gate.js +27 -12
  10. package/dist/cjs/src/gemini.js +3 -3
  11. package/dist/cjs/src/htx.js +4 -4
  12. package/dist/cjs/src/indodax.js +11 -12
  13. package/dist/cjs/src/kucoinfutures.js +8 -8
  14. package/dist/cjs/src/mexc.js +30 -1
  15. package/dist/cjs/src/okx.js +19 -5
  16. package/dist/cjs/src/poloniex.js +1 -1
  17. package/dist/cjs/src/pro/binance.js +3 -3
  18. package/dist/cjs/src/pro/bitfinex.js +140 -0
  19. package/dist/cjs/src/pro/bitget.js +222 -42
  20. package/dist/cjs/src/pro/bitmart.js +1 -1
  21. package/dist/cjs/src/pro/bybit.js +3 -3
  22. package/dist/cjs/src/pro/gemini.js +7 -2
  23. package/dist/cjs/src/pro/hyperliquid.js +5 -0
  24. package/dist/cjs/src/pro/kraken.js +4 -6
  25. package/dist/cjs/src/pro/kucoin.js +64 -0
  26. package/dist/cjs/src/pro/mexc.js +7 -3
  27. package/dist/cjs/src/zonda.js +12 -0
  28. package/js/ccxt.d.ts +2 -11
  29. package/js/ccxt.js +2 -8
  30. package/js/src/ascendex.js +1 -1
  31. package/js/src/base/Exchange.d.ts +2 -0
  32. package/js/src/base/Exchange.js +11 -0
  33. package/js/src/binance.d.ts +1 -1
  34. package/js/src/binance.js +25 -25
  35. package/js/src/bitget.js +2 -2
  36. package/js/src/coincatch.js +2 -2
  37. package/js/src/gate.js +27 -12
  38. package/js/src/gemini.js +3 -3
  39. package/js/src/htx.js +4 -4
  40. package/js/src/indodax.js +11 -12
  41. package/js/src/kucoinfutures.js +8 -8
  42. package/js/src/mexc.d.ts +3 -0
  43. package/js/src/mexc.js +30 -1
  44. package/js/src/okx.d.ts +4 -2
  45. package/js/src/okx.js +19 -5
  46. package/js/src/poloniex.js +1 -1
  47. package/js/src/pro/binance.js +3 -3
  48. package/js/src/pro/bitfinex.d.ts +30 -0
  49. package/js/src/pro/bitfinex.js +140 -0
  50. package/js/src/pro/bitget.d.ts +10 -0
  51. package/js/src/pro/bitget.js +228 -42
  52. package/js/src/pro/bitmart.js +1 -1
  53. package/js/src/pro/bybit.d.ts +2 -2
  54. package/js/src/pro/bybit.js +3 -3
  55. package/js/src/pro/gemini.d.ts +1 -1
  56. package/js/src/pro/gemini.js +7 -2
  57. package/js/src/pro/hyperliquid.js +5 -0
  58. package/js/src/pro/kraken.js +4 -6
  59. package/js/src/pro/kucoin.d.ts +22 -0
  60. package/js/src/pro/kucoin.js +64 -0
  61. package/js/src/pro/mexc.js +7 -3
  62. package/js/src/zonda.js +12 -0
  63. package/package.json +2 -1
  64. package/js/src/abstract/ellipx.d.ts +0 -28
  65. package/js/src/abstract/ellipx.js +0 -11
  66. package/js/src/abstract/vertex.d.ts +0 -22
  67. package/js/src/abstract/vertex.js +0 -11
  68. package/js/src/ellipx.d.ts +0 -237
  69. package/js/src/ellipx.js +0 -2071
  70. package/js/src/pro/vertex.d.ts +0 -104
  71. package/js/src/pro/vertex.js +0 -999
  72. package/js/src/vertex.d.ts +0 -346
  73. package/js/src/vertex.js +0 -3146
package/dist/cjs/ccxt.js CHANGED
@@ -65,7 +65,6 @@ var delta = require('./src/delta.js');
65
65
  var deribit = require('./src/deribit.js');
66
66
  var derive = require('./src/derive.js');
67
67
  var digifinex = require('./src/digifinex.js');
68
- var ellipx = require('./src/ellipx.js');
69
68
  var exmo = require('./src/exmo.js');
70
69
  var fmfwio = require('./src/fmfwio.js');
71
70
  var foxbit = require('./src/foxbit.js');
@@ -110,7 +109,6 @@ var timex = require('./src/timex.js');
110
109
  var tokocrypto = require('./src/tokocrypto.js');
111
110
  var tradeogre = require('./src/tradeogre.js');
112
111
  var upbit = require('./src/upbit.js');
113
- var vertex = require('./src/vertex.js');
114
112
  var wavesexchange = require('./src/wavesexchange.js');
115
113
  var whitebit = require('./src/whitebit.js');
116
114
  var woo = require('./src/woo.js');
@@ -187,7 +185,6 @@ var poloniex$1 = require('./src/pro/poloniex.js');
187
185
  var probit$1 = require('./src/pro/probit.js');
188
186
  var tradeogre$1 = require('./src/pro/tradeogre.js');
189
187
  var upbit$1 = require('./src/pro/upbit.js');
190
- var vertex$1 = require('./src/pro/vertex.js');
191
188
  var whitebit$1 = require('./src/pro/whitebit.js');
192
189
  var woo$1 = require('./src/pro/woo.js');
193
190
  var woofipro$1 = require('./src/pro/woofipro.js');
@@ -195,7 +192,7 @@ var xt$1 = require('./src/pro/xt.js');
195
192
 
196
193
  //-----------------------------------------------------------------------------
197
194
  // this is updated by vss.js when building
198
- const version = '4.5.1';
195
+ const version = '4.5.3';
199
196
  Exchange["default"].ccxtVersion = version;
200
197
  const exchanges = {
201
198
  'alpaca': alpaca["default"],
@@ -251,7 +248,6 @@ const exchanges = {
251
248
  'deribit': deribit["default"],
252
249
  'derive': derive["default"],
253
250
  'digifinex': digifinex["default"],
254
- 'ellipx': ellipx["default"],
255
251
  'exmo': exmo["default"],
256
252
  'fmfwio': fmfwio["default"],
257
253
  'foxbit': foxbit["default"],
@@ -296,7 +292,6 @@ const exchanges = {
296
292
  'tokocrypto': tokocrypto["default"],
297
293
  'tradeogre': tradeogre["default"],
298
294
  'upbit': upbit["default"],
299
- 'vertex': vertex["default"],
300
295
  'wavesexchange': wavesexchange["default"],
301
296
  'whitebit': whitebit["default"],
302
297
  'woo': woo["default"],
@@ -375,7 +370,6 @@ const pro = {
375
370
  'probit': probit$1["default"],
376
371
  'tradeogre': tradeogre$1["default"],
377
372
  'upbit': upbit$1["default"],
378
- 'vertex': vertex$1["default"],
379
373
  'whitebit': whitebit$1["default"],
380
374
  'woo': woo$1["default"],
381
375
  'woofipro': woofipro$1["default"],
@@ -485,7 +479,6 @@ exports.delta = delta["default"];
485
479
  exports.deribit = deribit["default"];
486
480
  exports.derive = derive["default"];
487
481
  exports.digifinex = digifinex["default"];
488
- exports.ellipx = ellipx["default"];
489
482
  exports.exmo = exmo["default"];
490
483
  exports.fmfwio = fmfwio["default"];
491
484
  exports.foxbit = foxbit["default"];
@@ -530,7 +523,6 @@ exports.timex = timex["default"];
530
523
  exports.tokocrypto = tokocrypto["default"];
531
524
  exports.tradeogre = tradeogre["default"];
532
525
  exports.upbit = upbit["default"];
533
- exports.vertex = vertex["default"];
534
526
  exports.wavesexchange = wavesexchange["default"];
535
527
  exports.whitebit = whitebit["default"];
536
528
  exports.woo = woo["default"];
@@ -1631,7 +1631,7 @@ class ascendex extends ascendex$1["default"] {
1631
1631
  // "code": "0",
1632
1632
  // "data": {
1633
1633
  // "domain": "spot",
1634
- // "userUID": "U1479576458",
1634
+ // "userUID": "U1479576457",
1635
1635
  // "vipLevel": "0",
1636
1636
  // "fees": [
1637
1637
  // { symbol: 'HT/USDT', fee: { taker: '0.001', maker: "0.001" } },
@@ -1161,6 +1161,7 @@ class Exchange {
1161
1161
  }
1162
1162
  async close() {
1163
1163
  // test by running ts/src/pro/test/base/test.close.ts
1164
+ await this.sleep(0); // allow other futures to run
1164
1165
  const clients = Object.values(this.clients || {});
1165
1166
  const closedClients = [];
1166
1167
  for (let i = 0; i < clients.length; i++) {
@@ -1199,6 +1200,7 @@ class Exchange {
1199
1200
  }
1200
1201
  client.reject(new errors.ExchangeError(this.id + ' nonce is behind the cache after ' + maxRetries.toString() + ' tries.'), messageHash);
1201
1202
  delete this.clients[client.url];
1203
+ this.orderbooks[symbol] = this.orderBook(); // clear the orderbook and its cache - issue https://github.com/ccxt/ccxt/issues/26753
1202
1204
  }
1203
1205
  catch (e) {
1204
1206
  client.reject(e, messageHash);
@@ -2210,6 +2212,9 @@ class Exchange {
2210
2212
  async unWatchPositions(symbols = undefined, params = {}) {
2211
2213
  throw new errors.NotSupported(this.id + ' unWatchPositions() is not supported yet');
2212
2214
  }
2215
+ async unWatchTicker(symbol, params = {}) {
2216
+ throw new errors.NotSupported(this.id + ' unWatchTicker() is not supported yet');
2217
+ }
2213
2218
  async fetchDepositAddresses(codes = undefined, params = {}) {
2214
2219
  throw new errors.NotSupported(this.id + ' fetchDepositAddresses() is not supported yet');
2215
2220
  }
@@ -4699,6 +4704,12 @@ class Exchange {
4699
4704
  }
4700
4705
  return result;
4701
4706
  }
4707
+ marketOrNull(symbol) {
4708
+ if (symbol === undefined) {
4709
+ return undefined;
4710
+ }
4711
+ return this.market(symbol);
4712
+ }
4702
4713
  checkRequiredCredentials(error = true) {
4703
4714
  /**
4704
4715
  * @ignore
@@ -1287,6 +1287,7 @@ class binance extends binance$1["default"] {
1287
1287
  'defaultSubType': undefined,
1288
1288
  'hasAlreadyAuthenticatedSuccessfully': false,
1289
1289
  'warnOnFetchOpenOrdersWithoutSymbol': true,
1290
+ 'currencyToPrecisionRoundingMode': number.TRUNCATE,
1290
1291
  // not an error
1291
1292
  // https://github.com/ccxt/ccxt/issues/11268
1292
1293
  // https://github.com/ccxt/ccxt/pull/11624
@@ -2754,15 +2755,6 @@ class binance extends binance$1["default"] {
2754
2755
  costToPrecision(symbol, cost) {
2755
2756
  return this.decimalToPrecision(cost, number.TRUNCATE, this.markets[symbol]['precision']['quote'], this.precisionMode, this.paddingMode);
2756
2757
  }
2757
- currencyToPrecision(code, fee, networkCode = undefined) {
2758
- // info is available in currencies only if the user has configured his api keys
2759
- if (this.safeValue(this.currencies[code], 'precision') !== undefined) {
2760
- return this.decimalToPrecision(fee, number.TRUNCATE, this.currencies[code]['precision'], this.precisionMode, this.paddingMode);
2761
- }
2762
- else {
2763
- return this.numberToString(fee);
2764
- }
2765
- }
2766
2758
  nonce() {
2767
2759
  return this.milliseconds() - this.options['timeDifference'];
2768
2760
  }
@@ -6619,19 +6611,13 @@ class binance extends binance$1["default"] {
6619
6611
  }
6620
6612
  }
6621
6613
  if (quantityIsRequired) {
6622
- // portfolio margin has a different amount precision
6623
- if (isPortfolioMargin) {
6624
- request['quantity'] = this.parseToNumeric(amount);
6614
+ const marketAmountPrecision = this.safeString(market['precision'], 'amount');
6615
+ const isPrecisionAvailable = (marketAmountPrecision !== undefined);
6616
+ if (isPrecisionAvailable) {
6617
+ request['quantity'] = this.amountToPrecision(symbol, amount);
6625
6618
  }
6626
6619
  else {
6627
- const marketAmountPrecision = this.safeString(market['precision'], 'amount');
6628
- const isPrecisionAvailable = (marketAmountPrecision !== undefined);
6629
- if (isPrecisionAvailable) {
6630
- request['quantity'] = this.amountToPrecision(symbol, amount);
6631
- }
6632
- else {
6633
- request['quantity'] = this.parseToNumeric(amount); // some options don't have the precision available
6634
- }
6620
+ request['quantity'] = this.parseToNumeric(amount); // some options don't have the precision available
6635
6621
  }
6636
6622
  }
6637
6623
  if (priceIsRequired && !isPriceMatch) {
@@ -7829,6 +7815,7 @@ class binance extends binance$1["default"] {
7829
7815
  * @param {string[]} ids order ids
7830
7816
  * @param {string} [symbol] unified market symbol
7831
7817
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7818
+ * @param {string[]} [params.clientOrderIds] alternative to ids, array of client order ids
7832
7819
  *
7833
7820
  * EXCHANGE SPECIFIC PARAMETERS
7834
7821
  * @param {string[]} [params.origClientOrderIdList] max length 10 e.g. ["my_id_1","my_id_2"], encode the double quotes. No space after comma
@@ -7846,8 +7833,16 @@ class binance extends binance$1["default"] {
7846
7833
  }
7847
7834
  const request = {
7848
7835
  'symbol': market['id'],
7849
- 'orderidlist': ids,
7836
+ // 'orderidlist': ids,
7850
7837
  };
7838
+ const origClientOrderIdList = this.safeList2(params, 'origClientOrderIdList', 'clientOrderIds');
7839
+ if (origClientOrderIdList !== undefined) {
7840
+ params = this.omit(params, ['clientOrderIds']);
7841
+ request['origClientOrderIdList'] = origClientOrderIdList;
7842
+ }
7843
+ else {
7844
+ request['orderidlist'] = ids;
7845
+ }
7851
7846
  let response = undefined;
7852
7847
  if (market['linear']) {
7853
7848
  response = await this.fapiPrivateDeleteBatchOrders(this.extend(request, params));
@@ -9433,7 +9428,6 @@ class binance extends binance$1["default"] {
9433
9428
  const request = {
9434
9429
  'coin': currency['id'],
9435
9430
  'address': address,
9436
- 'amount': this.currencyToPrecision(code, amount),
9437
9431
  // issue sapiGetCapitalConfigGetall () to get networks for withdrawing USDT ERC20 vs USDT Omni
9438
9432
  // 'network': 'ETH', // 'BTC', 'TRX', etc, optional
9439
9433
  };
@@ -9447,6 +9441,7 @@ class binance extends binance$1["default"] {
9447
9441
  request['network'] = network;
9448
9442
  params = this.omit(params, 'network');
9449
9443
  }
9444
+ request['amount'] = this.currencyToPrecision(code, amount, network);
9450
9445
  const response = await this.sapiPostCapitalWithdrawApply(this.extend(request, params));
9451
9446
  // { id: '9a67628b16ba4988ae20d329333f16bc' }
9452
9447
  return this.parseTransaction(response, currency);
@@ -12063,8 +12058,8 @@ class binance extends binance$1["default"] {
12063
12058
  else if ((path === 'batchOrders') || (path.indexOf('sub-account') >= 0) || (path === 'capital/withdraw/apply') || (path.indexOf('staking') >= 0) || (path.indexOf('simple-earn') >= 0)) {
12064
12059
  if ((method === 'DELETE') && (path === 'batchOrders')) {
12065
12060
  const orderidlist = this.safeList(extendedParams, 'orderidlist', []);
12066
- const origclientorderidlist = this.safeList(extendedParams, 'origclientorderidlist', []);
12067
- extendedParams = this.omit(extendedParams, ['orderidlist', 'origclientorderidlist']);
12061
+ const origclientorderidlist = this.safeList2(extendedParams, 'origclientorderidlist', 'origClientOrderIdList', []);
12062
+ extendedParams = this.omit(extendedParams, ['orderidlist', 'origclientorderidlist', 'origClientOrderIdList']);
12068
12063
  query = this.rawencode(extendedParams);
12069
12064
  const orderidlistLength = orderidlist.length;
12070
12065
  const origclientorderidlistLength = origclientorderidlist.length;
@@ -12072,7 +12067,12 @@ class binance extends binance$1["default"] {
12072
12067
  query = query + '&' + 'orderidlist=%5B' + orderidlist.join('%2C') + '%5D';
12073
12068
  }
12074
12069
  if (origclientorderidlistLength > 0) {
12075
- query = query + '&' + 'origclientorderidlist=%5B' + origclientorderidlist.join('%2C') + '%5D';
12070
+ // wrap clientOrderids around ""
12071
+ const newClientOrderIds = [];
12072
+ for (let i = 0; i < origclientorderidlistLength; i++) {
12073
+ newClientOrderIds.push('%22' + origclientorderidlist[i] + '%22');
12074
+ }
12075
+ query = query + '&' + 'origclientorderidlist=%5B' + newClientOrderIds.join('%2C') + '%5D';
12076
12076
  }
12077
12077
  }
12078
12078
  else {
@@ -1918,7 +1918,7 @@ class bitget extends bitget$1["default"] {
1918
1918
  const res = this.safeDict(results, i);
1919
1919
  const data = this.safeList(res, 'data', []);
1920
1920
  const firstData = this.safeDict(data, 0, {});
1921
- const isBorrowable = this.safeString(firstData, 'isBorrowable');
1921
+ const isBorrowable = this.safeBool(firstData, 'isBorrowable');
1922
1922
  if (fetchMargins && isBorrowable !== undefined) {
1923
1923
  const keysList = Object.keys(this.indexBy(data, 'symbol'));
1924
1924
  this.options['crossMarginPairsData'] = keysList;
@@ -7708,7 +7708,7 @@ class bitget extends bitget$1["default"] {
7708
7708
  // "requestTime": 1700802995406,
7709
7709
  // "data": [
7710
7710
  // {
7711
- // "userId": "7264631750",
7711
+ // "userId": "7264631751",
7712
7712
  // "symbol": "BTCUSDT",
7713
7713
  // "orderId": "1098394344925597696",
7714
7714
  // "tradeId": "1098394344974925824",
@@ -610,8 +610,8 @@ class coincatch extends coincatch$1["default"] {
610
610
  for (let j = 0; j < networks.length; j++) {
611
611
  const network = networks[j];
612
612
  const networkId = this.safeString(network, 'chain');
613
- const networkCode = this.networkCodeToId(networkId);
614
- parsedNetworks[networkId] = {
613
+ const networkCode = this.networkIdToCode(networkId);
614
+ parsedNetworks[networkCode] = {
615
615
  'id': networkId,
616
616
  'network': networkCode,
617
617
  'limits': {
@@ -56,14 +56,24 @@ class gate extends gate$1["default"] {
56
56
  },
57
57
  'test': {
58
58
  'public': {
59
- 'futures': 'https://fx-api-testnet.gateio.ws/api/v4',
60
- 'delivery': 'https://fx-api-testnet.gateio.ws/api/v4',
61
- 'options': 'https://fx-api-testnet.gateio.ws/api/v4',
59
+ 'futures': 'https://api-testnet.gateapi.io/api/v4',
60
+ 'delivery': 'https://api-testnet.gateapi.io/api/v4',
61
+ 'options': 'https://api-testnet.gateapi.io/api/v4',
62
+ 'spot': 'https://api-testnet.gateapi.io/api/v4',
63
+ 'wallet': 'https://api-testnet.gateapi.io/api/v4',
64
+ 'margin': 'https://api-testnet.gateapi.io/api/v4',
65
+ 'sub_accounts': 'https://api-testnet.gateapi.io/api/v4',
66
+ 'account': 'https://api-testnet.gateapi.io/api/v4',
62
67
  },
63
68
  'private': {
64
- 'futures': 'https://fx-api-testnet.gateio.ws/api/v4',
65
- 'delivery': 'https://fx-api-testnet.gateio.ws/api/v4',
66
- 'options': 'https://fx-api-testnet.gateio.ws/api/v4',
69
+ 'futures': 'https://api-testnet.gateapi.io/api/v4',
70
+ 'delivery': 'https://api-testnet.gateapi.io/api/v4',
71
+ 'options': 'https://api-testnet.gateapi.io/api/v4',
72
+ 'spot': 'https://api-testnet.gateapi.io/api/v4',
73
+ 'wallet': 'https://api-testnet.gateapi.io/api/v4',
74
+ 'margin': 'https://api-testnet.gateapi.io/api/v4',
75
+ 'sub_accounts': 'https://api-testnet.gateapi.io/api/v4',
76
+ 'account': 'https://api-testnet.gateapi.io/api/v4',
67
77
  },
68
78
  },
69
79
  'referral': {
@@ -1230,16 +1240,15 @@ class gate extends gate$1["default"] {
1230
1240
  await this.loadUnifiedStatus();
1231
1241
  }
1232
1242
  const rawPromises = [];
1233
- const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
1234
1243
  const fetchMarketsOptions = this.safeDict(this.options, 'fetchMarkets');
1235
1244
  const types = this.safeList(fetchMarketsOptions, 'types', ['spot', 'swap', 'future', 'option']);
1236
1245
  for (let i = 0; i < types.length; i++) {
1237
1246
  const marketType = types[i];
1238
1247
  if (marketType === 'spot') {
1239
- if (!sandboxMode) {
1240
- // gate doesn't have a sandbox for spot markets
1241
- rawPromises.push(this.fetchSpotMarkets(params));
1242
- }
1248
+ // if (!sandboxMode) {
1249
+ // gate doesn't have a sandbox for spot markets
1250
+ rawPromises.push(this.fetchSpotMarkets(params));
1251
+ // }
1243
1252
  }
1244
1253
  else if (marketType === 'swap') {
1245
1254
  rawPromises.push(this.fetchSwapMarkets(params));
@@ -1370,7 +1379,10 @@ class gate extends gate$1["default"] {
1370
1379
  }
1371
1380
  async fetchSwapMarkets(params = {}) {
1372
1381
  const result = [];
1373
- const swapSettlementCurrencies = this.getSettlementCurrencies('swap', 'fetchMarkets');
1382
+ let swapSettlementCurrencies = this.getSettlementCurrencies('swap', 'fetchMarkets');
1383
+ if (this.options['sandboxMode']) {
1384
+ swapSettlementCurrencies = ['usdt']; // gate sandbox only has usdt-margined swaps
1385
+ }
1374
1386
  for (let c = 0; c < swapSettlementCurrencies.length; c++) {
1375
1387
  const settleId = swapSettlementCurrencies[c];
1376
1388
  const request = {
@@ -1385,6 +1397,9 @@ class gate extends gate$1["default"] {
1385
1397
  return result;
1386
1398
  }
1387
1399
  async fetchFutureMarkets(params = {}) {
1400
+ if (this.options['sandboxMode']) {
1401
+ return []; // right now sandbox does not have inverse swaps
1402
+ }
1388
1403
  const result = [];
1389
1404
  const futureSettlementCurrencies = this.getSettlementCurrencies('future', 'fetchMarkets');
1390
1405
  for (let c = 0; c < futureSettlementCurrencies.length; c++) {
@@ -693,8 +693,8 @@ class gemini extends gemini$1["default"] {
693
693
  //
694
694
  // [
695
695
  // 'BTCUSD', // symbol
696
- // 2, // priceTickDecimalPlaces
697
- // 8, // quantityTickDecimalPlaces
696
+ // 2, // tick precision (priceTickDecimalPlaces)
697
+ // 8, // amount precision (quantityTickDecimalPlaces)
698
698
  // '0.00001', // quantityMinimum
699
699
  // 10, // quantityRoundDecimalPlaces
700
700
  // true // minimumsAreInclusive
@@ -713,7 +713,7 @@ class gemini extends gemini$1["default"] {
713
713
  // "wrap_enabled": false
714
714
  // "product_type": "swap", // only in perps
715
715
  // "contract_type": "linear", // only in perps
716
- // "contract_price_currency": "GUSD" // only in perps
716
+ // "contract_price_currency": "GUSD"
717
717
  // }
718
718
  //
719
719
  let marketId = undefined;
@@ -663,7 +663,7 @@ class htx extends htx$1["default"] {
663
663
  'api/v1/contract_batchorder': 1,
664
664
  'api/v1/contract_cancel': 1,
665
665
  'api/v1/contract_cancelall': 1,
666
- 'api/v1/contract_switch_lever_rate': 1,
666
+ 'api/v1/contract_switch_lever_rate': 30,
667
667
  'api/v1/lightning_close_position': 1,
668
668
  'api/v1/contract_order_info': 1,
669
669
  'api/v1/contract_order_detail': 1,
@@ -722,7 +722,7 @@ class htx extends htx$1["default"] {
722
722
  'swap-api/v1/swap_cancel': 1,
723
723
  'swap-api/v1/swap_cancelall': 1,
724
724
  'swap-api/v1/swap_lightning_close_position': 1,
725
- 'swap-api/v1/swap_switch_lever_rate': 1,
725
+ 'swap-api/v1/swap_switch_lever_rate': 30,
726
726
  'swap-api/v1/swap_order_info': 1,
727
727
  'swap-api/v1/swap_order_detail': 1,
728
728
  'swap-api/v1/swap_openorders': 1,
@@ -796,8 +796,8 @@ class htx extends htx$1["default"] {
796
796
  'linear-swap-api/v1/swap_cross_cancel': 1,
797
797
  'linear-swap-api/v1/swap_cancelall': 1,
798
798
  'linear-swap-api/v1/swap_cross_cancelall': 1,
799
- 'linear-swap-api/v1/swap_switch_lever_rate': 1,
800
- 'linear-swap-api/v1/swap_cross_switch_lever_rate': 1,
799
+ 'linear-swap-api/v1/swap_switch_lever_rate': 30,
800
+ 'linear-swap-api/v1/swap_cross_switch_lever_rate': 30,
801
801
  'linear-swap-api/v1/swap_lightning_close_position': 1,
802
802
  'linear-swap-api/v1/swap_cross_lightning_close_position': 1,
803
803
  'linear-swap-api/v1/swap_order_info': 1,
@@ -197,6 +197,16 @@ class indodax extends indodax$1["default"] {
197
197
  'Minimum order': errors.InvalidOrder,
198
198
  },
199
199
  },
200
+ 'timeframes': {
201
+ '1m': '1',
202
+ '15m': '15',
203
+ '30m': '30',
204
+ '1h': '60',
205
+ '4h': '240',
206
+ '1d': '1D',
207
+ '3d': '3D',
208
+ '1w': '1W',
209
+ },
200
210
  // exchange-specific options
201
211
  'options': {
202
212
  'recvWindow': 5 * 1000,
@@ -220,16 +230,6 @@ class indodax extends indodax$1["default"] {
220
230
  // 'ETH': 'eth'
221
231
  // 'BASE': 'base'
222
232
  },
223
- 'timeframes': {
224
- '1m': '1',
225
- '15m': '15',
226
- '30m': '30',
227
- '1h': '60',
228
- '4h': '240',
229
- '1d': '1D',
230
- '3d': '3D',
231
- '1w': '1W',
232
- },
233
233
  },
234
234
  'features': {
235
235
  'spot': {
@@ -687,8 +687,7 @@ class indodax extends indodax$1["default"] {
687
687
  async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
688
688
  await this.loadMarkets();
689
689
  const market = this.market(symbol);
690
- const timeframes = this.options['timeframes'];
691
- const selectedTimeframe = this.safeString(timeframes, timeframe, timeframe);
690
+ const selectedTimeframe = this.safeString(this.timeframes, timeframe, timeframe);
692
691
  const now = this.seconds();
693
692
  const until = this.safeInteger(params, 'until', now);
694
693
  params = this.omit(params, ['until']);
@@ -468,7 +468,7 @@ class kucoinfutures extends kucoinfutures$1["default"] {
468
468
  // }
469
469
  // }
470
470
  //
471
- const data = this.safeValue(response, 'data', {});
471
+ const data = this.safeDict(response, 'data', {});
472
472
  const status = this.safeString(data, 'status');
473
473
  return {
474
474
  'status': (status === 'open') ? 'ok' : 'maintenance',
@@ -551,7 +551,7 @@ class kucoinfutures extends kucoinfutures$1["default"] {
551
551
  // }
552
552
  //
553
553
  const result = [];
554
- const data = this.safeValue(response, 'data', []);
554
+ const data = this.safeList(response, 'data', []);
555
555
  for (let i = 0; i < data.length; i++) {
556
556
  const market = data[i];
557
557
  const id = this.safeString(market, 'symbol');
@@ -768,7 +768,7 @@ class kucoinfutures extends kucoinfutures$1["default"] {
768
768
  // }
769
769
  // }
770
770
  //
771
- const data = this.safeValue(response, 'data', {});
771
+ const data = this.safeDict(response, 'data', {});
772
772
  const address = this.safeString(data, 'address');
773
773
  if (currencyId !== 'NIM') {
774
774
  // contains spaces
@@ -832,7 +832,7 @@ class kucoinfutures extends kucoinfutures$1["default"] {
832
832
  // }
833
833
  // }
834
834
  //
835
- const data = this.safeValue(response, 'data', {});
835
+ const data = this.safeDict(response, 'data', {});
836
836
  const timestamp = this.parseToInt(this.safeInteger(data, 'ts') / 1000000);
837
837
  const orderbook = this.parseOrderBook(data, market['symbol'], timestamp, 'bids', 'asks', 0, 1);
838
838
  orderbook['nonce'] = this.safeInteger(data, 'sequence');
@@ -1162,7 +1162,7 @@ class kucoinfutures extends kucoinfutures$1["default"] {
1162
1162
  // }
1163
1163
  //
1164
1164
  const data = this.safeValue(response, 'data');
1165
- const dataList = this.safeValue(data, 'dataList', []);
1165
+ const dataList = this.safeList(data, 'dataList', []);
1166
1166
  const fees = [];
1167
1167
  for (let i = 0; i < dataList.length; i++) {
1168
1168
  const listItem = dataList[i];
@@ -2123,7 +2123,7 @@ class kucoinfutures extends kucoinfutures$1["default"] {
2123
2123
  // }
2124
2124
  // }
2125
2125
  //
2126
- const responseData = this.safeValue(response, 'data', {});
2126
+ const responseData = this.safeDict(response, 'data', {});
2127
2127
  const orders = this.safeList(responseData, 'items', []);
2128
2128
  return this.parseOrders(orders, market, since, limit);
2129
2129
  }
@@ -3051,7 +3051,7 @@ class kucoinfutures extends kucoinfutures$1["default"] {
3051
3051
  // ]
3052
3052
  // }
3053
3053
  //
3054
- const data = this.safeValue(response, 'data');
3054
+ const data = this.safeList(response, 'data', []);
3055
3055
  return this.parseMarketLeverageTiers(data, market);
3056
3056
  }
3057
3057
  parseMarketLeverageTiers(info, market = undefined) {
@@ -3140,7 +3140,7 @@ class kucoinfutures extends kucoinfutures$1["default"] {
3140
3140
  // ]
3141
3141
  // }
3142
3142
  //
3143
- const data = this.safeValue(response, 'data');
3143
+ const data = this.safeList(response, 'data', []);
3144
3144
  return this.parseFundingRateHistories(data, market, since, limit);
3145
3145
  }
3146
3146
  parseFundingRateHistory(info, market = undefined) {
@@ -4996,7 +4996,13 @@ class mexc extends mexc$1["default"] {
4996
4996
  // "id":"25fb2831fb6d4fc7aa4094612a26c81d"
4997
4997
  // }
4998
4998
  //
4999
- const id = this.safeString(transaction, 'id');
4999
+ // internal withdraw (aka internal-transfer)
5000
+ //
5001
+ // {
5002
+ // "tranId":"ad36f0e9c9a24ae794b36fa4f152e471"
5003
+ // }
5004
+ //
5005
+ const id = this.safeString2(transaction, 'id', 'tranId');
5000
5006
  const type = (id === undefined) ? 'deposit' : 'withdrawal';
5001
5007
  const timestamp = this.safeInteger2(transaction, 'insertTime', 'applyTime');
5002
5008
  const updated = this.safeInteger(transaction, 'updateTime');
@@ -5509,17 +5515,40 @@ class mexc extends mexc$1["default"] {
5509
5515
  * @name mexc#withdraw
5510
5516
  * @description make a withdrawal
5511
5517
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#withdraw-new
5518
+ * @see https://www.mexc.com/api-docs/spot-v3/wallet-endpoints#internal-transfer
5512
5519
  * @param {string} code unified currency code
5513
5520
  * @param {float} amount the amount to withdraw
5514
5521
  * @param {string} address the address to withdraw to
5515
5522
  * @param {string} tag
5516
5523
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5524
+ * @param {object} [params.internal] false by default, set to true for an "internal transfer"
5525
+ * @param {object} [params.toAccountType] skipped by default, set to 'EMAIL|UID|MOBILE' when making an "internal transfer"
5517
5526
  * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
5518
5527
  */
5519
5528
  async withdraw(code, amount, address, tag = undefined, params = {}) {
5520
5529
  await this.loadMarkets();
5521
5530
  const currency = this.currency(code);
5522
5531
  [tag, params] = this.handleWithdrawTagAndParams(tag, params);
5532
+ const internal = this.safeBool(params, 'internal', false);
5533
+ if (internal) {
5534
+ params = this.omit(params, 'internal');
5535
+ const requestForInternal = {
5536
+ 'asset': currency['id'],
5537
+ 'amount': amount,
5538
+ 'toAccount': address,
5539
+ };
5540
+ const toAccountType = this.safeString(params, 'toAccountType');
5541
+ if (toAccountType === undefined) {
5542
+ throw new errors.ArgumentsRequired(this.id + ' withdraw() requires a toAccountType parameter for internal transfer to be of: EMAIL | UID | MOBILE');
5543
+ }
5544
+ const responseForInternal = await this.spotPrivatePostCapitalTransferInternal(this.extend(requestForInternal, params));
5545
+ //
5546
+ // {
5547
+ // "id":"7213fea8e94b4a5593d507237e5a555b"
5548
+ // }
5549
+ //
5550
+ return this.parseTransaction(responseForInternal, currency);
5551
+ }
5523
5552
  const networks = this.safeDict(this.options, 'networks', {});
5524
5553
  let network = this.safeString2(params, 'network', 'netWork'); // this line allows the user to specify either ERC20 or ETH
5525
5554
  network = this.safeString(networks, network, network); // handle ETH > ERC-20 alias