ccxt 4.2.86 → 4.2.88

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 (103) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +4 -5
  3. package/dist/ccxt.browser.js +748 -169
  4. package/dist/ccxt.browser.min.js +3 -3
  5. package/dist/cjs/ccxt.js +6 -1
  6. package/dist/cjs/src/ascendex.js +11 -1
  7. package/dist/cjs/src/base/Exchange.js +26 -2
  8. package/dist/cjs/src/binance.js +24 -7
  9. package/dist/cjs/src/bingx.js +37 -1
  10. package/dist/cjs/src/bitfinex.js +3 -0
  11. package/dist/cjs/src/bitfinex2.js +16 -1
  12. package/dist/cjs/src/bitflyer.js +19 -0
  13. package/dist/cjs/src/bitget.js +32 -17
  14. package/dist/cjs/src/bitopro.js +3 -0
  15. package/dist/cjs/src/bitrue.js +13 -7
  16. package/dist/cjs/src/bitvavo.js +3 -0
  17. package/dist/cjs/src/btcmarkets.js +1 -1
  18. package/dist/cjs/src/btcturk.js +2 -1
  19. package/dist/cjs/src/coinex.js +182 -54
  20. package/dist/cjs/src/cryptocom.js +1 -1
  21. package/dist/cjs/src/currencycom.js +1 -1
  22. package/dist/cjs/src/delta.js +3 -1
  23. package/dist/cjs/src/digifinex.js +4 -2
  24. package/dist/cjs/src/exmo.js +11 -12
  25. package/dist/cjs/src/gate.js +13 -10
  26. package/dist/cjs/src/hitbtc.js +26 -2
  27. package/dist/cjs/src/htx.js +2 -2
  28. package/dist/cjs/src/huobijp.js +1 -1
  29. package/dist/cjs/src/hyperliquid.js +249 -12
  30. package/dist/cjs/src/idex.js +1 -1
  31. package/dist/cjs/src/krakenfutures.js +4 -7
  32. package/dist/cjs/src/kucoin.js +7 -4
  33. package/dist/cjs/src/lbank.js +3 -0
  34. package/dist/cjs/src/mexc.js +1 -1
  35. package/dist/cjs/src/oceanex.js +1 -1
  36. package/dist/cjs/src/okx.js +24 -10
  37. package/dist/cjs/src/phemex.js +3 -1
  38. package/dist/cjs/src/pro/kucoin.js +11 -6
  39. package/dist/cjs/src/wazirx.js +1 -1
  40. package/dist/cjs/src/zonda.js +3 -0
  41. package/examples/js/benchmark.js +104 -0
  42. package/examples/js/cli.js +0 -2
  43. package/examples/ts/benchmark.ts +134 -0
  44. package/examples/ts/cli.ts +0 -2
  45. package/js/ccxt.d.ts +3 -3
  46. package/js/ccxt.js +3 -3
  47. package/js/src/ascendex.d.ts +5 -12
  48. package/js/src/ascendex.js +11 -1
  49. package/js/src/base/Exchange.d.ts +5 -4
  50. package/js/src/base/Exchange.js +26 -2
  51. package/js/src/base/types.d.ts +12 -1
  52. package/js/src/binance.d.ts +5 -12
  53. package/js/src/binance.js +24 -7
  54. package/js/src/bingx.d.ts +5 -2
  55. package/js/src/bingx.js +37 -1
  56. package/js/src/bitfinex.js +3 -0
  57. package/js/src/bitfinex2.d.ts +3 -17
  58. package/js/src/bitfinex2.js +16 -1
  59. package/js/src/bitflyer.d.ts +1 -0
  60. package/js/src/bitflyer.js +20 -1
  61. package/js/src/bitget.d.ts +5 -12
  62. package/js/src/bitget.js +32 -17
  63. package/js/src/bitopro.js +3 -0
  64. package/js/src/bitrue.d.ts +3 -17
  65. package/js/src/bitrue.js +13 -7
  66. package/js/src/bitvavo.js +3 -0
  67. package/js/src/btcmarkets.js +1 -1
  68. package/js/src/btcturk.js +2 -1
  69. package/js/src/coinex.d.ts +4 -11
  70. package/js/src/coinex.js +182 -54
  71. package/js/src/cryptocom.js +1 -1
  72. package/js/src/currencycom.js +1 -1
  73. package/js/src/delta.d.ts +5 -37
  74. package/js/src/delta.js +3 -1
  75. package/js/src/digifinex.d.ts +5 -13
  76. package/js/src/digifinex.js +4 -2
  77. package/js/src/exmo.d.ts +5 -37
  78. package/js/src/exmo.js +11 -12
  79. package/js/src/gate.d.ts +5 -33
  80. package/js/src/gate.js +13 -10
  81. package/js/src/hitbtc.d.ts +5 -12
  82. package/js/src/hitbtc.js +26 -2
  83. package/js/src/htx.js +2 -2
  84. package/js/src/huobijp.js +1 -1
  85. package/js/src/hyperliquid.d.ts +7 -4
  86. package/js/src/hyperliquid.js +249 -12
  87. package/js/src/idex.js +1 -1
  88. package/js/src/krakenfutures.js +4 -7
  89. package/js/src/kucoin.js +7 -4
  90. package/js/src/kucoinfutures.d.ts +2 -2
  91. package/js/src/lbank.js +3 -0
  92. package/js/src/mexc.d.ts +3 -3
  93. package/js/src/mexc.js +1 -1
  94. package/js/src/oceanex.js +1 -1
  95. package/js/src/okx.d.ts +5 -33
  96. package/js/src/okx.js +24 -10
  97. package/js/src/phemex.d.ts +3 -11
  98. package/js/src/phemex.js +3 -1
  99. package/js/src/pro/kucoin.js +11 -6
  100. package/js/src/wazirx.js +1 -1
  101. package/js/src/zonda.js +3 -0
  102. package/package.json +3 -2
  103. package/skip-tests.json +3 -3
@@ -6561,15 +6561,25 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
6561
6561
  });
6562
6562
  }
6563
6563
  parseMarginModification(data, market = undefined) {
6564
+ //
6565
+ // addMargin/reduceMargin
6566
+ //
6567
+ // {
6568
+ // "code": 0
6569
+ // }
6570
+ //
6564
6571
  const errorCode = this.safeString(data, 'code');
6565
6572
  const status = (errorCode === '0') ? 'ok' : 'failed';
6566
6573
  return {
6567
6574
  'info': data,
6575
+ 'symbol': market['symbol'],
6568
6576
  'type': undefined,
6569
6577
  'amount': undefined,
6578
+ 'total': undefined,
6570
6579
  'code': market['quote'],
6571
- 'symbol': market['symbol'],
6572
6580
  'status': status,
6581
+ 'timestamp': undefined,
6582
+ 'datetime': undefined,
6573
6583
  };
6574
6584
  }
6575
6585
  async reduceMargin(symbol, amount, params = {}) {
@@ -11926,6 +11936,30 @@ class Exchange {
11926
11936
  }
11927
11937
  return parsedPrecision + '1';
11928
11938
  }
11939
+ integerPrecisionToAmount(precision) {
11940
+ /**
11941
+ * @ignore
11942
+ * @method
11943
+ * @description handles positive & negative numbers too. parsePrecision() does not handle negative numbers, but this method handles
11944
+ * @param {string} precision The number of digits to the right of the decimal
11945
+ * @returns {string} a string number equal to 1e-precision
11946
+ */
11947
+ if (precision === undefined) {
11948
+ return undefined;
11949
+ }
11950
+ if (_Precise_js__WEBPACK_IMPORTED_MODULE_10__/* .Precise */ .O.stringGe(precision, '0')) {
11951
+ return this.parsePrecision(precision);
11952
+ }
11953
+ else {
11954
+ const positivePrecisionString = _Precise_js__WEBPACK_IMPORTED_MODULE_10__/* .Precise */ .O.stringAbs(precision);
11955
+ const positivePrecision = parseInt(positivePrecisionString);
11956
+ let parsedPrecision = '1';
11957
+ for (let i = 0; i < positivePrecision - 1; i++) {
11958
+ parsedPrecision = parsedPrecision + '0';
11959
+ }
11960
+ return parsedPrecision + '0';
11961
+ }
11962
+ }
11929
11963
  async loadTimeDifference(params = {}) {
11930
11964
  const serverTime = await this.fetchTime(params);
11931
11965
  const after = this.milliseconds();
@@ -12406,8 +12440,8 @@ class Exchange {
12406
12440
  const entry = responseKeys[i];
12407
12441
  const dictionary = isArray ? entry : response[entry];
12408
12442
  const currencyId = isArray ? this.safeString(dictionary, currencyIdKey) : entry;
12409
- const currency = this.safeValue(this.currencies_by_id, currencyId);
12410
- const code = this.safeString(currency, 'code', currencyId);
12443
+ const currency = this.safeCurrency(currencyId);
12444
+ const code = this.safeString(currency, 'code');
12411
12445
  if ((codes === undefined) || (this.inArray(code, codes))) {
12412
12446
  depositWithdrawFees[code] = this.parseDepositWithdrawFee(dictionary, currency);
12413
12447
  }
@@ -20370,7 +20404,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
20370
20404
  '-4140': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
20371
20405
  '-4141': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OperationRejected,
20372
20406
  '-4144': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol,
20373
- '-4164': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OperationRejected,
20407
+ '-4164': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
20374
20408
  '-4165': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
20375
20409
  '-4167': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
20376
20410
  '-4168': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
@@ -27650,7 +27684,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27650
27684
  'previousFundingDatetime': undefined,
27651
27685
  };
27652
27686
  }
27653
- parseAccountPositions(account) {
27687
+ parseAccountPositions(account, filterClosed = false) {
27654
27688
  const positions = this.safeList(account, 'positions');
27655
27689
  const assets = this.safeList(account, 'assets', []);
27656
27690
  const balances = {};
@@ -27673,7 +27707,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27673
27707
  const code = market['linear'] ? market['quote'] : market['base'];
27674
27708
  const maintenanceMargin = this.safeString(position, 'maintMargin');
27675
27709
  // check for maintenance margin so empty positions are not returned
27676
- if ((maintenanceMargin !== '0') && (maintenanceMargin !== '0.00000000')) {
27710
+ const isPositionOpen = (maintenanceMargin !== '0') && (maintenanceMargin !== '0.00000000');
27711
+ if (!filterClosed || isPositionOpen) {
27677
27712
  // sometimes not all the codes are correctly returned...
27678
27713
  if (code in balances) {
27679
27714
  const parsed = this.parseAccountPosition(this.extend(position, {
@@ -28515,10 +28550,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
28515
28550
  * @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
28516
28551
  * @see https://binance-docs.github.io/apidocs/pm/en/#get-um-account-detail-user_data
28517
28552
  * @see https://binance-docs.github.io/apidocs/pm/en/#get-cm-account-detail-user_data
28518
- * @param {string[]|undefined} symbols list of unified market symbols
28553
+ * @param {string[]} [symbols] list of unified market symbols
28519
28554
  * @param {object} [params] extra parameters specific to the exchange API endpoint
28520
28555
  * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch positions in a portfolio margin account
28521
28556
  * @param {string} [params.subType] "linear" or "inverse"
28557
+ * @param {boolean} [params.filterClosed] set to true if you would like to filter out closed positions, default is false
28522
28558
  * @returns {object} data on account positions
28523
28559
  */
28524
28560
  if (symbols !== undefined) {
@@ -28555,7 +28591,9 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
28555
28591
  else {
28556
28592
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchPositions() supports linear and inverse contracts only');
28557
28593
  }
28558
- const result = this.parseAccountPositions(response);
28594
+ let filterClosed = undefined;
28595
+ [filterClosed, params] = this.handleOptionAndParams(params, 'fetchAccountPositions', 'filterClosed', false);
28596
+ const result = this.parseAccountPositions(response, filterClosed);
28559
28597
  symbols = this.marketSymbols(symbols);
28560
28598
  return this.filterByArrayPositions(result, 'symbol', symbols, false);
28561
28599
  }
@@ -29693,7 +29731,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
29693
29731
  }
29694
29732
  await this.loadMarkets();
29695
29733
  const market = this.market(symbol);
29696
- amount = this.costToPrecision(symbol, amount);
29734
+ amount = this.amountToPrecision(symbol, amount);
29697
29735
  const request = {
29698
29736
  'type': addOrReduce,
29699
29737
  'symbol': market['id'],
@@ -29722,6 +29760,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
29722
29760
  });
29723
29761
  }
29724
29762
  parseMarginModification(data, market = undefined) {
29763
+ //
29764
+ // add/reduce margin
29765
+ //
29766
+ // {
29767
+ // "code": 200,
29768
+ // "msg": "Successfully modify position margin.",
29769
+ // "amount": 0.001,
29770
+ // "type": 1
29771
+ // }
29772
+ //
29725
29773
  const rawType = this.safeInteger(data, 'type');
29726
29774
  const resultType = (rawType === 1) ? 'add' : 'reduce';
29727
29775
  const resultAmount = this.safeNumber(data, 'amount');
@@ -29729,11 +29777,14 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
29729
29777
  const status = (errorCode === '200') ? 'ok' : 'failed';
29730
29778
  return {
29731
29779
  'info': data,
29780
+ 'symbol': market['symbol'],
29732
29781
  'type': resultType,
29733
29782
  'amount': resultAmount,
29783
+ 'total': undefined,
29734
29784
  'code': undefined,
29735
- 'symbol': market['symbol'],
29736
29785
  'status': status,
29786
+ 'timestamp': undefined,
29787
+ 'datetime': undefined,
29737
29788
  };
29738
29789
  }
29739
29790
  async reduceMargin(symbol, amount, params = {}) {
@@ -31374,6 +31425,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
31374
31425
  'swap': true,
31375
31426
  'future': false,
31376
31427
  'option': false,
31428
+ 'addMargin': true,
31377
31429
  'cancelAllOrders': true,
31378
31430
  'cancelOrder': true,
31379
31431
  'cancelOrders': true,
@@ -31420,6 +31472,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
31420
31472
  'fetchTrades': true,
31421
31473
  'fetchTransfers': true,
31422
31474
  'fetchWithdrawals': true,
31475
+ 'reduceMargin': true,
31423
31476
  'setLeverage': true,
31424
31477
  'setMargin': true,
31425
31478
  'setMarginMode': true,
@@ -34808,6 +34861,18 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
34808
34861
  };
34809
34862
  return await this.swapV2PrivatePostTradeMarginType(this.extend(request, params));
34810
34863
  }
34864
+ async addMargin(symbol, amount, params = {}) {
34865
+ const request = {
34866
+ 'type': 1,
34867
+ };
34868
+ return await this.setMargin(symbol, amount, this.extend(request, params));
34869
+ }
34870
+ async reduceMargin(symbol, amount, params = {}) {
34871
+ const request = {
34872
+ 'type': 2,
34873
+ };
34874
+ return await this.setMargin(symbol, amount, this.extend(request, params));
34875
+ }
34811
34876
  async setMargin(symbol, amount, params = {}) {
34812
34877
  /**
34813
34878
  * @method
@@ -34842,7 +34907,29 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
34842
34907
  // "type": 1
34843
34908
  // }
34844
34909
  //
34845
- return response;
34910
+ return this.parseMarginModification(response, market);
34911
+ }
34912
+ parseMarginModification(data, market = undefined) {
34913
+ //
34914
+ // {
34915
+ // "code": 0,
34916
+ // "msg": "",
34917
+ // "amount": 1,
34918
+ // "type": 1
34919
+ // }
34920
+ //
34921
+ const type = this.safeString(data, 'type');
34922
+ return {
34923
+ 'info': data,
34924
+ 'symbol': this.safeString(market, 'symbol'),
34925
+ 'type': (type === '1') ? 'add' : 'reduce',
34926
+ 'amount': this.safeNumber(data, 'amount'),
34927
+ 'total': this.safeNumber(data, 'margin'),
34928
+ 'code': this.safeString(market, 'settle'),
34929
+ 'status': undefined,
34930
+ 'timestamp': undefined,
34931
+ 'datetime': undefined,
34932
+ };
34846
34933
  }
34847
34934
  async fetchLeverage(symbol, params = {}) {
34848
34935
  /**
@@ -40245,6 +40332,9 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
40245
40332
  if (limit === undefined) {
40246
40333
  limit = 100;
40247
40334
  }
40335
+ else {
40336
+ limit = Math.min(limit, 10000);
40337
+ }
40248
40338
  const market = this.market(symbol);
40249
40339
  const v2id = 't' + market['id'];
40250
40340
  const request = {
@@ -42003,6 +42093,9 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
42003
42093
  if (limit === undefined) {
42004
42094
  limit = 10000;
42005
42095
  }
42096
+ else {
42097
+ limit = Math.min(limit, 10000);
42098
+ }
42006
42099
  let request = {
42007
42100
  'symbol': market['id'],
42008
42101
  'timeframe': this.safeString(this.timeframes, timeframe, timeframe),
@@ -44124,15 +44217,27 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
44124
44217
  return this.parseMarginModification(data, market);
44125
44218
  }
44126
44219
  parseMarginModification(data, market = undefined) {
44220
+ //
44221
+ // setMargin
44222
+ //
44223
+ // [
44224
+ // [
44225
+ // 1
44226
+ // ]
44227
+ // ]
44228
+ //
44127
44229
  const marginStatusRaw = data[0];
44128
44230
  const marginStatus = (marginStatusRaw === 1) ? 'ok' : 'failed';
44129
44231
  return {
44130
44232
  'info': data,
44233
+ 'symbol': market['symbol'],
44131
44234
  'type': undefined,
44132
44235
  'amount': undefined,
44236
+ 'total': undefined,
44133
44237
  'code': undefined,
44134
- 'symbol': market['symbol'],
44135
44238
  'status': marginStatus,
44239
+ 'timestamp': undefined,
44240
+ 'datetime': undefined,
44136
44241
  };
44137
44242
  }
44138
44243
  async fetchOrder(id, symbol = undefined, params = {}) {
@@ -44457,6 +44562,11 @@ class bitflyer extends _abstract_bitflyer_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
44457
44562
  },
44458
44563
  },
44459
44564
  'precisionMode': _base_functions_number_js__WEBPACK_IMPORTED_MODULE_1__/* .TICK_SIZE */ .sh,
44565
+ 'exceptions': {
44566
+ 'exact': {
44567
+ '-2': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OnMaintenance, // {"status":-2,"error_message":"Under maintenance","data":null}
44568
+ },
44569
+ },
44460
44570
  });
44461
44571
  }
44462
44572
  parseExpiryDate(expiry) {
@@ -45384,6 +45494,20 @@ class bitflyer extends _abstract_bitflyer_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
45384
45494
  }
45385
45495
  return { 'url': url, 'method': method, 'body': body, 'headers': headers };
45386
45496
  }
45497
+ handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
45498
+ if (response === undefined) {
45499
+ return undefined; // fallback to the default error handler
45500
+ }
45501
+ const feedback = this.id + ' ' + body;
45502
+ // i.e. {"status":-2,"error_message":"Under maintenance","data":null}
45503
+ const errorMessage = this.safeString(response, 'error_message');
45504
+ const statusCode = this.safeNumber(response, 'status');
45505
+ if (errorMessage !== undefined) {
45506
+ this.throwExactlyMatchedException(this.exceptions['exact'], statusCode, feedback);
45507
+ this.throwBroadlyMatchedException(this.exceptions['broad'], errorMessage, feedback);
45508
+ }
45509
+ return undefined;
45510
+ }
45387
45511
  }
45388
45512
 
45389
45513
 
@@ -46618,6 +46742,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
46618
46742
  '40768': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.OrderNotFound,
46619
46743
  '41114': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.OnMaintenance,
46620
46744
  '43011': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
46745
+ '43012': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InsufficientFunds,
46621
46746
  '43025': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
46622
46747
  '43115': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.OnMaintenance,
46623
46748
  '45110': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
@@ -46693,6 +46818,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
46693
46818
  'commonCurrencies': {
46694
46819
  'JADE': 'Jade Protocol',
46695
46820
  'DEGEN': 'DegenReborn',
46821
+ 'TONCOIN': 'TON',
46696
46822
  },
46697
46823
  'options': {
46698
46824
  'timeframes': {
@@ -47272,8 +47398,8 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
47272
47398
  const data = this.safeValue(response, 'data', []);
47273
47399
  for (let i = 0; i < data.length; i++) {
47274
47400
  const entry = data[i];
47275
- const id = this.safeString(entry, 'coinId');
47276
- const code = this.safeCurrencyCode(this.safeString(entry, 'coin'));
47401
+ 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..)
47402
+ const code = this.safeCurrencyCode(id);
47277
47403
  const chains = this.safeValue(entry, 'chains', []);
47278
47404
  const networks = {};
47279
47405
  let deposit = false;
@@ -47402,7 +47528,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
47402
47528
  }
47403
47529
  params = this.omit(params, 'code');
47404
47530
  const currency = this.currency(code);
47405
- request['coin'] = currency['code'];
47531
+ request['coin'] = currency['id'];
47406
47532
  response = await this.privateMarginGetV2MarginCrossedTierData(this.extend(request, params));
47407
47533
  }
47408
47534
  else {
@@ -47558,7 +47684,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
47558
47684
  since = this.milliseconds() - 7776000000; // 90 days
47559
47685
  }
47560
47686
  let request = {
47561
- 'coin': currency['code'],
47687
+ 'coin': currency['id'],
47562
47688
  'startTime': since,
47563
47689
  'endTime': this.milliseconds(),
47564
47690
  };
@@ -47617,7 +47743,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
47617
47743
  const currency = this.currency(code);
47618
47744
  const networkId = this.networkCodeToId(chain);
47619
47745
  const request = {
47620
- 'coin': currency['code'],
47746
+ 'coin': currency['id'],
47621
47747
  'address': address,
47622
47748
  'chain': networkId,
47623
47749
  'size': amount,
@@ -47703,7 +47829,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
47703
47829
  since = this.milliseconds() - 7776000000; // 90 days
47704
47830
  }
47705
47831
  let request = {
47706
- 'coin': currency['code'],
47832
+ 'coin': currency['id'],
47707
47833
  'startTime': since,
47708
47834
  'endTime': this.milliseconds(),
47709
47835
  };
@@ -47846,7 +47972,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
47846
47972
  }
47847
47973
  const currency = this.currency(code);
47848
47974
  const request = {
47849
- 'coin': currency['code'],
47975
+ 'coin': currency['id'],
47850
47976
  };
47851
47977
  if (networkId !== undefined) {
47852
47978
  request['chain'] = networkId;
@@ -51299,7 +51425,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
51299
51425
  let request = {};
51300
51426
  if (code !== undefined) {
51301
51427
  currency = this.currency(code);
51302
- request['coin'] = currency['code'];
51428
+ request['coin'] = currency['id'];
51303
51429
  }
51304
51430
  [request, params] = this.handleUntilOption('endTime', request, params);
51305
51431
  if (since !== undefined) {
@@ -52359,15 +52485,28 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
52359
52485
  });
52360
52486
  }
52361
52487
  parseMarginModification(data, market = undefined) {
52488
+ //
52489
+ // addMargin/reduceMargin
52490
+ //
52491
+ // {
52492
+ // "code": "00000",
52493
+ // "msg": "success",
52494
+ // "requestTime": 1700813444618,
52495
+ // "data": ""
52496
+ // }
52497
+ //
52362
52498
  const errorCode = this.safeString(data, 'code');
52363
52499
  const status = (errorCode === '00000') ? 'ok' : 'failed';
52364
52500
  return {
52365
52501
  'info': data,
52502
+ 'symbol': market['symbol'],
52366
52503
  'type': undefined,
52367
52504
  'amount': undefined,
52505
+ 'total': undefined,
52368
52506
  'code': market['settle'],
52369
- 'symbol': market['symbol'],
52370
52507
  'status': status,
52508
+ 'timestamp': undefined,
52509
+ 'datetime': undefined,
52371
52510
  };
52372
52511
  }
52373
52512
  async reduceMargin(symbol, amount, params = {}) {
@@ -52725,7 +52864,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
52725
52864
  type = this.safeString(accountsByType, fromAccount);
52726
52865
  const currency = this.currency(code);
52727
52866
  let request = {
52728
- 'coin': currency['code'],
52867
+ 'coin': currency['id'],
52729
52868
  'fromType': type,
52730
52869
  };
52731
52870
  if (since !== undefined) {
@@ -52784,7 +52923,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
52784
52923
  'fromType': fromType,
52785
52924
  'toType': toType,
52786
52925
  'amount': amount,
52787
- 'coin': currency['code'],
52926
+ 'coin': currency['id'],
52788
52927
  };
52789
52928
  const symbol = this.safeString(params, 'symbol');
52790
52929
  params = this.omit(params, 'symbol');
@@ -52971,7 +53110,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
52971
53110
  await this.loadMarkets();
52972
53111
  const currency = this.currency(code);
52973
53112
  const request = {
52974
- 'coin': currency['code'],
53113
+ 'coin': currency['id'],
52975
53114
  'borrowAmount': this.currencyToPrecision(code, amount),
52976
53115
  };
52977
53116
  const response = await this.privateMarginPostV2MarginCrossedAccountBorrow(this.extend(request, params));
@@ -53006,7 +53145,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
53006
53145
  const currency = this.currency(code);
53007
53146
  const market = this.market(symbol);
53008
53147
  const request = {
53009
- 'coin': currency['code'],
53148
+ 'coin': currency['id'],
53010
53149
  'borrowAmount': this.currencyToPrecision(code, amount),
53011
53150
  'symbol': market['id'],
53012
53151
  };
@@ -53043,7 +53182,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
53043
53182
  const currency = this.currency(code);
53044
53183
  const market = this.market(symbol);
53045
53184
  const request = {
53046
- 'coin': currency['code'],
53185
+ 'coin': currency['id'],
53047
53186
  'repayAmount': this.currencyToPrecision(code, amount),
53048
53187
  'symbol': market['id'],
53049
53188
  };
@@ -53079,7 +53218,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
53079
53218
  await this.loadMarkets();
53080
53219
  const currency = this.currency(code);
53081
53220
  const request = {
53082
- 'coin': currency['code'],
53221
+ 'coin': currency['id'],
53083
53222
  'repayAmount': this.currencyToPrecision(code, amount),
53084
53223
  };
53085
53224
  const response = await this.privateMarginPostV2MarginCrossedAccountRepay(this.extend(request, params));
@@ -53441,7 +53580,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
53441
53580
  await this.loadMarkets();
53442
53581
  const currency = this.currency(code);
53443
53582
  const request = {
53444
- 'coin': currency['code'],
53583
+ 'coin': currency['id'],
53445
53584
  };
53446
53585
  const response = await this.privateMarginGetV2MarginCrossedInterestRateAndLimit(this.extend(request, params));
53447
53586
  //
@@ -53536,7 +53675,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
53536
53675
  let currency = undefined;
53537
53676
  if (code !== undefined) {
53538
53677
  currency = this.currency(code);
53539
- request['coin'] = currency['code'];
53678
+ request['coin'] = currency['id'];
53540
53679
  }
53541
53680
  if (since !== undefined) {
53542
53681
  request['startTime'] = since;
@@ -63252,6 +63391,9 @@ class bitopro extends _abstract_bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
63252
63391
  if (limit === undefined) {
63253
63392
  limit = 500;
63254
63393
  }
63394
+ else {
63395
+ limit = Math.min(limit, 75000); // supports slightly more than 75k candles atm, but limit here to avoid errors
63396
+ }
63255
63397
  const timeframeInSeconds = this.parseTimeframe(timeframe);
63256
63398
  let alignedSince = undefined;
63257
63399
  if (since === undefined) {
@@ -65600,9 +65742,6 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
65600
65742
  'interval': this.safeString(timeframesFuture, timeframe, '1min'),
65601
65743
  };
65602
65744
  if (limit !== undefined) {
65603
- if (limit > 300) {
65604
- limit = 300;
65605
- }
65606
65745
  request['limit'] = limit;
65607
65746
  }
65608
65747
  if (market['linear']) {
@@ -65621,9 +65760,6 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
65621
65760
  'scale': this.safeString(timeframesSpot, timeframe, '1m'),
65622
65761
  };
65623
65762
  if (limit !== undefined) {
65624
- if (limit > 1440) {
65625
- limit = 1440;
65626
- }
65627
65763
  request['limit'] = limit;
65628
65764
  }
65629
65765
  if (since !== undefined) {
@@ -67295,13 +67431,25 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
67295
67431
  return response;
67296
67432
  }
67297
67433
  parseMarginModification(data, market = undefined) {
67434
+ //
67435
+ // setMargin
67436
+ //
67437
+ // {
67438
+ // "code": 0,
67439
+ // "msg": "success"
67440
+ // "data": null
67441
+ // }
67442
+ //
67298
67443
  return {
67299
67444
  'info': data,
67445
+ 'symbol': market['symbol'],
67300
67446
  'type': undefined,
67301
67447
  'amount': undefined,
67448
+ 'total': undefined,
67302
67449
  'code': undefined,
67303
- 'symbol': market['symbol'],
67304
67450
  'status': undefined,
67451
+ 'timestamp': undefined,
67452
+ 'datetime': undefined,
67305
67453
  };
67306
67454
  }
67307
67455
  async setMargin(symbol, amount, params = {}) {
@@ -74872,6 +75020,9 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
74872
75020
  if (limit === undefined) {
74873
75021
  limit = 1440;
74874
75022
  }
75023
+ else {
75024
+ limit = Math.min(limit, 1440);
75025
+ }
74875
75026
  request['end'] = this.sum(since, limit * duration * 1000);
74876
75027
  }
74877
75028
  [request, params] = this.handleUntilOption('end', request, params);
@@ -82034,7 +82185,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
82034
82185
  request['from'] = this.iso8601(since);
82035
82186
  }
82036
82187
  if (limit !== undefined) {
82037
- request['limit'] = limit; // default is 10, max 200
82188
+ request['limit'] = Math.min(limit, 200); // default is 10, max 200
82038
82189
  }
82039
82190
  const response = await this.publicGetMarketsMarketIdCandles(this.extend(request, params));
82040
82191
  //
@@ -83363,6 +83514,7 @@ class btcturk extends _abstract_btcturk_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
83363
83514
  limit = 100; // default value
83364
83515
  }
83365
83516
  if (limit !== undefined) {
83517
+ limit = Math.min(limit, 11000); // max 11000 candles diapason can be covered
83366
83518
  if (timeframe === '1y') { // difficult with leap years
83367
83519
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' fetchOHLCV () does not accept a limit parameter when timeframe == "1y"');
83368
83520
  }
@@ -83373,7 +83525,7 @@ class btcturk extends _abstract_btcturk_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
83373
83525
  request['to'] = Math.min(request['to'], to);
83374
83526
  }
83375
83527
  else {
83376
- request['from'] = this.parseToInt(until / 1000) - limitSeconds;
83528
+ request['from'] = this.parseToInt(0 / 1000) - limitSeconds;
83377
83529
  }
83378
83530
  }
83379
83531
  const response = await this.graphGetKlinesHistory(this.extend(request, params));
@@ -103667,19 +103819,22 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
103667
103819
  * @method
103668
103820
  * @name coinex#fetchTime
103669
103821
  * @description fetches the current integer timestamp in milliseconds from the exchange server
103670
- * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http005_system_time
103822
+ * @see https://docs.coinex.com/api/v2/common/http/time
103671
103823
  * @param {object} [params] extra parameters specific to the exchange API endpoint
103672
103824
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
103673
103825
  */
103674
- const response = await this.v1PerpetualPublicGetTime(params);
103826
+ const response = await this.v2PublicGetTime(params);
103675
103827
  //
103676
103828
  // {
103677
- // "code": "0",
103678
- // "data": "1653261274414",
103829
+ // "code": 0,
103830
+ // "data": {
103831
+ // "timestamp": 1711699867777
103832
+ // },
103679
103833
  // "message": "OK"
103680
103834
  // }
103681
103835
  //
103682
- return this.safeInteger(response, 'data');
103836
+ const data = this.safeDict(response, 'data', {});
103837
+ return this.safeInteger(data, 'timestamp');
103683
103838
  }
103684
103839
  async fetchOrderBook(symbol, limit = 20, params = {}) {
103685
103840
  /**
@@ -103939,7 +104094,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
103939
104094
  * @method
103940
104095
  * @name coinex#fetchTradingFee
103941
104096
  * @description fetch the trading fees for a market
103942
- * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market003_single_market_info
104097
+ * @see https://docs.coinex.com/api/v2/spot/market/http/list-market
104098
+ * @see https://docs.coinex.com/api/v2/futures/market/http/list-market
103943
104099
  * @param {string} symbol unified market symbol
103944
104100
  * @param {object} [params] extra parameters specific to the exchange API endpoint
103945
104101
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -103949,67 +104105,132 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
103949
104105
  const request = {
103950
104106
  'market': market['id'],
103951
104107
  };
103952
- const response = await this.v1PublicGetMarketDetail(this.extend(request, params));
103953
- //
103954
- // {
103955
- // "code": 0,
103956
- // "data": {
103957
- // "name": "BTCUSDC",
103958
- // "min_amount": "0.0005",
103959
- // "maker_fee_rate": "0.002",
103960
- // "taker_fee_rate": "0.002",
103961
- // "pricing_name": "USDC",
103962
- // "pricing_decimal": 2,
103963
- // "trading_name": "BTC",
103964
- // "trading_decimal": 8
103965
- // },
103966
- // "message": "OK"
103967
- // }
103968
- //
103969
- const data = this.safeValue(response, 'data', {});
103970
- return this.parseTradingFee(data, market);
104108
+ let response = undefined;
104109
+ if (market['spot']) {
104110
+ response = await this.v2PublicGetSpotMarket(this.extend(request, params));
104111
+ //
104112
+ // {
104113
+ // "code": 0,
104114
+ // "data": [
104115
+ // {
104116
+ // "base_ccy": "BTC",
104117
+ // "base_ccy_precision": 8,
104118
+ // "is_amm_available": false,
104119
+ // "is_margin_available": true,
104120
+ // "maker_fee_rate": "0.002",
104121
+ // "market": "BTCUSDT",
104122
+ // "min_amount": "0.0001",
104123
+ // "quote_ccy": "USDT",
104124
+ // "quote_ccy_precision": 2,
104125
+ // "taker_fee_rate": "0.002"
104126
+ // }
104127
+ // ],
104128
+ // "message": "OK"
104129
+ // }
104130
+ //
104131
+ }
104132
+ else {
104133
+ response = await this.v2PublicGetFuturesMarket(this.extend(request, params));
104134
+ //
104135
+ // {
104136
+ // "code": 0,
104137
+ // "data": [
104138
+ // {
104139
+ // "base_ccy": "BTC",
104140
+ // "base_ccy_precision": 8,
104141
+ // "contract_type": "linear",
104142
+ // "leverage": ["1","2","3","5","8","10","15","20","30","50","100"],
104143
+ // "maker_fee_rate": "0",
104144
+ // "market": "BTCUSDT",
104145
+ // "min_amount": "0.0001",
104146
+ // "open_interest_volume": "185.7498",
104147
+ // "quote_ccy": "USDT",
104148
+ // "quote_ccy_precision": 2,
104149
+ // "taker_fee_rate": "0"
104150
+ // }
104151
+ // ],
104152
+ // "message": "OK"
104153
+ // }
104154
+ //
104155
+ }
104156
+ const data = this.safeList(response, 'data', []);
104157
+ const result = this.safeDict(data, 0, {});
104158
+ return this.parseTradingFee(result, market);
103971
104159
  }
103972
104160
  async fetchTradingFees(params = {}) {
103973
104161
  /**
103974
104162
  * @method
103975
104163
  * @name coinex#fetchTradingFees
103976
104164
  * @description fetch the trading fees for multiple markets
103977
- * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market002_all_market_info
104165
+ * @see https://docs.coinex.com/api/v2/spot/market/http/list-market
104166
+ * @see https://docs.coinex.com/api/v2/futures/market/http/list-market
103978
104167
  * @param {object} [params] extra parameters specific to the exchange API endpoint
103979
104168
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
103980
104169
  */
103981
104170
  await this.loadMarkets();
103982
- const response = await this.v1PublicGetMarketInfo(params);
103983
- //
103984
- // {
103985
- // "code": 0,
103986
- // "data": {
103987
- // "WAVESBTC": {
103988
- // "name": "WAVESBTC",
103989
- // "min_amount": "1",
103990
- // "maker_fee_rate": "0.001",
103991
- // "taker_fee_rate": "0.001",
103992
- // "pricing_name": "BTC",
103993
- // "pricing_decimal": 8,
103994
- // "trading_name": "WAVES",
103995
- // "trading_decimal": 8
103996
- // }
103997
- // ...
103998
- // }
103999
- // }
104000
- //
104001
- const data = this.safeValue(response, 'data', {});
104171
+ let type = undefined;
104172
+ [type, params] = this.handleMarketTypeAndParams('fetchTradingFees', undefined, params);
104173
+ let response = undefined;
104174
+ if (type === 'swap') {
104175
+ response = await this.v2PublicGetFuturesMarket(params);
104176
+ //
104177
+ // {
104178
+ // "code": 0,
104179
+ // "data": [
104180
+ // {
104181
+ // "base_ccy": "BTC",
104182
+ // "base_ccy_precision": 8,
104183
+ // "contract_type": "linear",
104184
+ // "leverage": ["1","2","3","5","8","10","15","20","30","50","100"],
104185
+ // "maker_fee_rate": "0",
104186
+ // "market": "BTCUSDT",
104187
+ // "min_amount": "0.0001",
104188
+ // "open_interest_volume": "185.7498",
104189
+ // "quote_ccy": "USDT",
104190
+ // "quote_ccy_precision": 2,
104191
+ // "taker_fee_rate": "0"
104192
+ // }
104193
+ // ],
104194
+ // "message": "OK"
104195
+ // }
104196
+ //
104197
+ }
104198
+ else {
104199
+ response = await this.v2PublicGetSpotMarket(params);
104200
+ //
104201
+ // {
104202
+ // "code": 0,
104203
+ // "data": [
104204
+ // {
104205
+ // "base_ccy": "BTC",
104206
+ // "base_ccy_precision": 8,
104207
+ // "is_amm_available": false,
104208
+ // "is_margin_available": true,
104209
+ // "maker_fee_rate": "0.002",
104210
+ // "market": "BTCUSDT",
104211
+ // "min_amount": "0.0001",
104212
+ // "quote_ccy": "USDT",
104213
+ // "quote_ccy_precision": 2,
104214
+ // "taker_fee_rate": "0.002"
104215
+ // },
104216
+ // ],
104217
+ // "message": "OK"
104218
+ // }
104219
+ //
104220
+ }
104221
+ const data = this.safeList(response, 'data', []);
104002
104222
  const result = {};
104003
- for (let i = 0; i < this.symbols.length; i++) {
104004
- const symbol = this.symbols[i];
104005
- const market = this.market(symbol);
104006
- const fee = this.safeValue(data, market['id'], {});
104007
- result[symbol] = this.parseTradingFee(fee, market);
104223
+ for (let i = 0; i < data.length; i++) {
104224
+ const entry = data[i];
104225
+ const marketId = this.safeString(entry, 'market');
104226
+ const market = this.safeMarket(marketId, undefined, undefined, type);
104227
+ const symbol = market['symbol'];
104228
+ result[symbol] = this.parseTradingFee(entry, market);
104008
104229
  }
104009
104230
  return result;
104010
104231
  }
104011
104232
  parseTradingFee(fee, market = undefined) {
104012
- const marketId = this.safeValue(fee, 'name');
104233
+ const marketId = this.safeValue(fee, 'market');
104013
104234
  const symbol = this.safeSymbol(marketId, market);
104014
104235
  return {
104015
104236
  'info': fee,
@@ -106781,13 +107002,72 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
106781
107002
  });
106782
107003
  }
106783
107004
  parseMarginModification(data, market = undefined) {
107005
+ //
107006
+ // addMargin/reduceMargin
107007
+ //
107008
+ // {
107009
+ // "adl_sort": 1,
107010
+ // "adl_sort_val": "0.00004320",
107011
+ // "amount": "0.0005",
107012
+ // "amount_max": "0.0005",
107013
+ // "amount_max_margin": "6.57352000000000000000",
107014
+ // "bkr_price": "16294.08000000000000011090",
107015
+ // "bkr_price_imply": "0.00000000000000000000",
107016
+ // "close_left": "0.0005",
107017
+ // "create_time": 1651202571.320778,
107018
+ // "deal_all": "19.72000000000000000000",
107019
+ // "deal_asset_fee": "0.00000000000000000000",
107020
+ // "fee_asset": "",
107021
+ // "finish_type": 1,
107022
+ // "first_price": "39441.12",
107023
+ // "insurance": "0.00000000000000000000",
107024
+ // "latest_price": "39441.12",
107025
+ // "leverage": "3",
107026
+ // "liq_amount": "0.00000000000000000000",
107027
+ // "liq_order_price": "0",
107028
+ // "liq_order_time": 0,
107029
+ // "liq_price": "16491.28560000000000011090",
107030
+ // "liq_price_imply": "0.00000000000000000000",
107031
+ // "liq_profit": "0.00000000000000000000",
107032
+ // "liq_time": 0,
107033
+ // "mainten_margin": "0.005",
107034
+ // "mainten_margin_amount": "0.09860280000000000000",
107035
+ // "maker_fee": "0.00000000000000000000",
107036
+ // "margin_amount": "11.57352000000000000000",
107037
+ // "market": "BTCUSDT",
107038
+ // "open_margin": "0.58687582908396110455",
107039
+ // "open_margin_imply": "0.00000000000000000000",
107040
+ // "open_price": "39441.12000000000000000000",
107041
+ // "open_val": "19.72056000000000000000",
107042
+ // "open_val_max": "19.72056000000000000000",
107043
+ // "position_id": 65171206,
107044
+ // "profit_clearing": "-0.00986028000000000000",
107045
+ // "profit_real": "-0.00986028000000000000",
107046
+ // "profit_unreal": "0.00",
107047
+ // "side": 2,
107048
+ // "stop_loss_price": "0.00000000000000000000",
107049
+ // "stop_loss_type": 0,
107050
+ // "sys": 0,
107051
+ // "take_profit_price": "0.00000000000000000000",
107052
+ // "take_profit_type": 0,
107053
+ // "taker_fee": "0.00000000000000000000",
107054
+ // "total": 3464,
107055
+ // "type": 1,
107056
+ // "update_time": 1651202638.911212,
107057
+ // "user_id": 3620173
107058
+ // }
107059
+ //
107060
+ const timestamp = this.safeIntegerProduct(data, 'update_time', 1000);
106784
107061
  return {
106785
107062
  'info': data,
107063
+ 'symbol': this.safeSymbol(undefined, market),
106786
107064
  'type': undefined,
106787
- 'amount': undefined,
107065
+ 'amount': this.safeNumber(data, 'margin_amount'),
107066
+ 'total': undefined,
106788
107067
  'code': market['quote'],
106789
- 'symbol': this.safeSymbol(undefined, market),
106790
107068
  'status': undefined,
107069
+ 'timestamp': timestamp,
107070
+ 'datetime': this.iso8601(timestamp),
106791
107071
  };
106792
107072
  }
106793
107073
  async addMargin(symbol, amount, params = {}) {
@@ -120156,7 +120436,7 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
120156
120436
  //
120157
120437
  const result = this.safeDict(response, 'result', {});
120158
120438
  const data = this.safeList(result, 'data', []);
120159
- return this.parsePosition(data[0], market);
120439
+ return this.parsePosition(this.safeDict(data, 0), market);
120160
120440
  }
120161
120441
  async fetchPositions(symbols = undefined, params = {}) {
120162
120442
  /**
@@ -121403,7 +121683,7 @@ class currencycom extends _abstract_currencycom_js__WEBPACK_IMPORTED_MODULE_0__/
121403
121683
  request['startTime'] = since;
121404
121684
  }
121405
121685
  if (limit !== undefined) {
121406
- request['limit'] = limit; // default 500, max 1000
121686
+ request['limit'] = Math.min(limit, 1000); // default 500, max 1000
121407
121687
  }
121408
121688
  const response = await this.publicGetV2Klines(this.extend(request, params));
121409
121689
  //
@@ -125138,12 +125418,14 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
125138
125418
  market = this.safeMarket(marketId, market);
125139
125419
  return {
125140
125420
  'info': data,
125421
+ 'symbol': market['symbol'],
125141
125422
  'type': undefined,
125142
125423
  'amount': undefined,
125143
125424
  'total': this.safeNumber(data, 'margin'),
125144
125425
  'code': undefined,
125145
- 'symbol': market['symbol'],
125146
125426
  'status': undefined,
125427
+ 'timestamp': undefined,
125428
+ 'datetime': undefined,
125147
125429
  };
125148
125430
  }
125149
125431
  async fetchOpenInterest(symbol, params = {}) {
@@ -131121,7 +131403,7 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
131121
131403
  request['instrument_id'] = market['id'];
131122
131404
  request['granularity'] = timeframe;
131123
131405
  if (limit !== undefined) {
131124
- request['limit'] = limit;
131406
+ request['limit'] = Math.min(limit, 100);
131125
131407
  }
131126
131408
  response = await this.publicSwapGetPublicCandles(this.extend(request, params));
131127
131409
  }
@@ -133774,12 +134056,14 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
133774
134056
  const rawType = this.safeInteger(data, 'type');
133775
134057
  return {
133776
134058
  'info': data,
134059
+ 'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
133777
134060
  'type': (rawType === 1) ? 'add' : 'reduce',
133778
134061
  'amount': this.safeNumber(data, 'amount'),
133779
134062
  'total': undefined,
133780
134063
  'code': market['settle'],
133781
- 'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
133782
134064
  'status': undefined,
134065
+ 'timestamp': undefined,
134066
+ 'datetime': undefined,
133783
134067
  };
133784
134068
  }
133785
134069
  async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -134228,12 +134512,14 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
134228
134512
  //
134229
134513
  return {
134230
134514
  'info': data,
134515
+ 'symbol': this.safeSymbol(undefined, market),
134231
134516
  'type': undefined,
134232
134517
  'amount': undefined,
134233
- 'code': this.safeValue(market, 'quote'),
134234
- 'symbol': this.safeSymbol(undefined, market),
134235
134518
  'total': undefined,
134519
+ 'code': this.safeValue(market, 'quote'),
134236
134520
  'status': 'ok',
134521
+ 'timestamp': undefined,
134522
+ 'datetime': undefined,
134237
134523
  };
134238
134524
  }
134239
134525
  async reduceMargin(symbol, amount, params = {}) {
@@ -134826,16 +135112,15 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
134826
135112
  'symbol': market['id'],
134827
135113
  'resolution': this.safeString(this.timeframes, timeframe, timeframe),
134828
135114
  };
134829
- const options = this.safeValue(this.options, 'fetchOHLCV');
134830
- const maxLimit = this.safeInteger(options, 'maxLimit', 3000);
135115
+ const maxLimit = 3000;
134831
135116
  const duration = this.parseTimeframe(timeframe);
134832
135117
  const now = this.milliseconds();
134833
135118
  if (since === undefined) {
134834
135119
  if (limit === undefined) {
134835
135120
  limit = 1000; // cap default at generous amount
134836
135121
  }
134837
- if (limit > maxLimit) {
134838
- limit = maxLimit; // avoid exception
135122
+ else {
135123
+ limit = Math.min(limit, maxLimit);
134839
135124
  }
134840
135125
  request['from'] = this.parseToInt(now / 1000) - limit * duration - 1;
134841
135126
  request['to'] = this.parseToInt(now / 1000);
@@ -134843,15 +135128,13 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
134843
135128
  else {
134844
135129
  request['from'] = this.parseToInt(since / 1000) - 1;
134845
135130
  if (limit === undefined) {
134846
- request['to'] = this.parseToInt(now / 1000);
135131
+ limit = maxLimit;
134847
135132
  }
134848
135133
  else {
134849
- if (limit > maxLimit) {
134850
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchOHLCV() will serve ' + maxLimit.toString() + ' candles at most');
134851
- }
134852
- const to = this.sum(since, limit * duration * 1000);
134853
- request['to'] = this.parseToInt(to / 1000);
135134
+ limit = Math.min(limit, maxLimit);
134854
135135
  }
135136
+ const to = this.sum(since, limit * duration * 1000);
135137
+ request['to'] = this.parseToInt(to / 1000);
134855
135138
  }
134856
135139
  const response = await this.publicGetCandlesHistory(this.extend(request, params));
134857
135140
  //
@@ -138542,7 +138825,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
138542
138825
  await this.loadMarkets();
138543
138826
  const currency = this.currency(code);
138544
138827
  const request = {
138545
- 'currency': currency['id'],
138828
+ 'currency': currency['id'], // todo: currencies have network-junctions
138546
138829
  };
138547
138830
  const response = await this.privateWalletGetDepositAddress(this.extend(request, params));
138548
138831
  const addresses = this.safeValue(response, 'multichain_addresses');
@@ -138593,7 +138876,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
138593
138876
  const rawNetwork = this.safeStringUpper(params, 'network');
138594
138877
  params = this.omit(params, 'network');
138595
138878
  const request = {
138596
- 'currency': currency['id'],
138879
+ 'currency': currency['id'], // todo: currencies have network-junctions
138597
138880
  };
138598
138881
  const response = await this.privateWalletGetDepositAddress(this.extend(request, params));
138599
138882
  //
@@ -140209,7 +140492,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
140209
140492
  let currency = undefined;
140210
140493
  if (code !== undefined) {
140211
140494
  currency = this.currency(code);
140212
- request['currency'] = currency['id'];
140495
+ request['currency'] = currency['id']; // todo: currencies have network-junctions
140213
140496
  }
140214
140497
  if (limit !== undefined) {
140215
140498
  request['limit'] = limit;
@@ -140247,7 +140530,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
140247
140530
  let currency = undefined;
140248
140531
  if (code !== undefined) {
140249
140532
  currency = this.currency(code);
140250
- request['currency'] = currency['id'];
140533
+ request['currency'] = currency['id']; // todo: currencies have network-junctions
140251
140534
  }
140252
140535
  if (limit !== undefined) {
140253
140536
  request['limit'] = limit;
@@ -140294,7 +140577,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
140294
140577
  params = this.omit(params, 'network');
140295
140578
  }
140296
140579
  else {
140297
- request['chain'] = currency['id'];
140580
+ request['chain'] = currency['id']; // todo: currencies have network-junctions
140298
140581
  }
140299
140582
  const response = await this.privateWithdrawalsPostWithdrawals(this.extend(request, params));
140300
140583
  //
@@ -141828,7 +142111,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
141828
142111
  params = this.omit(params, 'symbol');
141829
142112
  }
141830
142113
  if ((toId === 'futures') || (toId === 'delivery') || (fromId === 'futures') || (fromId === 'delivery')) {
141831
- request['settle'] = currency['id'];
142114
+ request['settle'] = currency['id']; // todo: currencies have network-junctions
141832
142115
  }
141833
142116
  const response = await this.privateWalletPostTransfers(this.extend(request, params));
141834
142117
  //
@@ -142798,11 +143081,14 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
142798
143081
  const total = this.safeNumber(data, 'margin');
142799
143082
  return {
142800
143083
  'info': data,
142801
- 'amount': undefined,
142802
- 'code': this.safeValue(market, 'quote'),
142803
143084
  'symbol': market['symbol'],
143085
+ 'type': undefined,
143086
+ 'amount': undefined,
142804
143087
  'total': total,
143088
+ 'code': this.safeValue(market, 'quote'),
142805
143089
  'status': 'ok',
143090
+ 'timestamp': undefined,
143091
+ 'datetime': undefined,
142806
143092
  };
142807
143093
  }
142808
143094
  async reduceMargin(symbol, amount, params = {}) {
@@ -143133,7 +143419,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
143133
143419
  if ((type === 'spot') || (type === 'margin')) {
143134
143420
  if (code !== undefined) {
143135
143421
  currency = this.currency(code);
143136
- request['currency'] = currency['id'];
143422
+ request['currency'] = currency['id']; // todo: currencies have network-junctions
143137
143423
  }
143138
143424
  }
143139
143425
  if ((type === 'swap') || (type === 'future')) {
@@ -143952,7 +144238,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
143952
144238
  await this.loadMarkets();
143953
144239
  const currency = this.currency(code);
143954
144240
  const request = {
143955
- 'underlying': currency['code'] + '_USDT',
144241
+ 'underlying': currency['code'] + '_USDT', // todo: currency['id'].toUpperCase () & network junctions
143956
144242
  };
143957
144243
  const response = await this.publicOptionsGetContracts(this.extend(request, params));
143958
144244
  //
@@ -147778,7 +148064,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
147778
148064
  }
147779
148065
  [request, params] = this.handleUntilOption('till', request, params);
147780
148066
  if (limit !== undefined) {
147781
- request['limit'] = limit;
148067
+ request['limit'] = Math.min(limit, 1000);
147782
148068
  }
147783
148069
  const price = this.safeString(params, 'price');
147784
148070
  params = this.omit(params, 'price');
@@ -149336,15 +149622,39 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
149336
149622
  });
149337
149623
  }
149338
149624
  parseMarginModification(data, market = undefined) {
149625
+ //
149626
+ // addMargin/reduceMargin
149627
+ //
149628
+ // {
149629
+ // "symbol": "BTCUSDT_PERP",
149630
+ // "type": "isolated",
149631
+ // "leverage": "8.00",
149632
+ // "created_at": "2022-03-30T23:34:27.161Z",
149633
+ // "updated_at": "2022-03-30T23:34:27.161Z",
149634
+ // "currencies": [
149635
+ // {
149636
+ // "code": "USDT",
149637
+ // "margin_balance": "7.000000000000",
149638
+ // "reserved_orders": "0",
149639
+ // "reserved_positions": "0"
149640
+ // }
149641
+ // ],
149642
+ // "positions": null
149643
+ // }
149644
+ //
149339
149645
  const currencies = this.safeValue(data, 'currencies', []);
149340
149646
  const currencyInfo = this.safeValue(currencies, 0);
149647
+ const datetime = this.safeString(data, 'updated_at');
149341
149648
  return {
149342
149649
  'info': data,
149650
+ 'symbol': market['symbol'],
149343
149651
  'type': undefined,
149344
149652
  'amount': undefined,
149653
+ 'total': undefined,
149345
149654
  'code': this.safeString(currencyInfo, 'code'),
149346
- 'symbol': market['symbol'],
149347
149655
  'status': undefined,
149656
+ 'timestamp': this.parse8601(datetime),
149657
+ 'datetime': datetime,
149348
149658
  };
149349
149659
  }
149350
149660
  async reduceMargin(symbol, amount, params = {}) {
@@ -154631,7 +154941,7 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
154631
154941
  const untilSeconds = (until !== undefined) ? this.parseToInt(until / 1000) : undefined;
154632
154942
  if (market['contract']) {
154633
154943
  if (limit !== undefined) {
154634
- request['size'] = limit; // when using limit: from & to are ignored
154944
+ request['size'] = Math.min(limit, 2000); // when using limit: from & to are ignored
154635
154945
  // https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-kline-data
154636
154946
  }
154637
154947
  else {
@@ -154723,7 +155033,7 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
154723
155033
  [useHistorical, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'useHistoricalEndpointForSpot', true);
154724
155034
  if (!useHistorical) {
154725
155035
  if (limit !== undefined) {
154726
- request['size'] = Math.min(2000, limit); // max 2000
155036
+ request['size'] = Math.min(limit, 2000); // max 2000
154727
155037
  }
154728
155038
  response = await this.spotPublicGetMarketHistoryKline(this.extend(request, params));
154729
155039
  }
@@ -161835,7 +162145,7 @@ class huobijp extends _abstract_huobijp_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
161835
162145
  'period': this.safeString(this.timeframes, timeframe, timeframe),
161836
162146
  };
161837
162147
  if (limit !== undefined) {
161838
- request['size'] = limit;
162148
+ request['size'] = Math.min(limit, 2000);
161839
162149
  }
161840
162150
  const response = await this.marketGetHistoryKline(this.extend(request, params));
161841
162151
  //
@@ -162839,7 +163149,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162839
163149
  'pro': true,
162840
163150
  'has': {
162841
163151
  'CORS': undefined,
162842
- 'spot': false,
163152
+ 'spot': true,
162843
163153
  'margin': false,
162844
163154
  'swap': true,
162845
163155
  'future': true,
@@ -162972,6 +163282,10 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162972
163282
  'taker': this.parseNumber('0.00035'),
162973
163283
  'maker': this.parseNumber('0.0001'),
162974
163284
  },
163285
+ 'spot': {
163286
+ 'taker': this.parseNumber('0.00035'),
163287
+ 'maker': this.parseNumber('0.0001'),
163288
+ },
162975
163289
  },
162976
163290
  'requiredCredentials': {
162977
163291
  'apiKey': false,
@@ -162997,6 +163311,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162997
163311
  'precisionMode': _base_functions_number_js__WEBPACK_IMPORTED_MODULE_2__/* .TICK_SIZE */ .sh,
162998
163312
  'commonCurrencies': {},
162999
163313
  'options': {
163314
+ 'defaultType': 'swap',
163000
163315
  'sandboxMode': false,
163001
163316
  'defaultSlippage': 0.05,
163002
163317
  'zeroAddress': '0x0000000000000000000000000000000000000000',
@@ -163067,6 +163382,24 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163067
163382
  * @param {object} [params] extra parameters specific to the exchange API endpoint
163068
163383
  * @returns {object[]} an array of objects representing market data
163069
163384
  */
163385
+ const rawPromises = [
163386
+ this.fetchSwapMarkets(params),
163387
+ this.fetchSpotMarkets(params),
163388
+ ];
163389
+ const promises = await Promise.all(rawPromises);
163390
+ const swapMarkets = promises[0];
163391
+ const spotMarkets = promises[1];
163392
+ return this.arrayConcat(swapMarkets, spotMarkets);
163393
+ }
163394
+ async fetchSwapMarkets(params = {}) {
163395
+ /**
163396
+ * @method
163397
+ * @name hyperliquid#fetchMarkets
163398
+ * @description retrieves data on all swap markets for hyperliquid
163399
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-asset-contexts-includes-mark-price-current-funding-open-interest-etc
163400
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
163401
+ * @returns {object[]} an array of objects representing market data
163402
+ */
163070
163403
  const request = {
163071
163404
  'type': 'metaAndAssetCtxs',
163072
163405
  };
@@ -163112,6 +163445,132 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163112
163445
  }
163113
163446
  return this.parseMarkets(result);
163114
163447
  }
163448
+ async fetchSpotMarkets(params = {}) {
163449
+ /**
163450
+ * @method
163451
+ * @name hyperliquid#fetchMarkets
163452
+ * @description retrieves data on all spot markets for hyperliquid
163453
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-asset-contexts-includes-mark-price-current-funding-open-interest-etc
163454
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
163455
+ * @returns {object[]} an array of objects representing market data
163456
+ */
163457
+ const request = {
163458
+ 'type': 'spotMetaAndAssetCtxs',
163459
+ };
163460
+ const response = await this.publicPostInfo(this.extend(request, params));
163461
+ //
163462
+ // [
163463
+ // {
163464
+ // 'tokens': [
163465
+ // {
163466
+ // 'name': 'USDC',
163467
+ // 'szDecimals': '8',
163468
+ // 'weiDecimals': '8',
163469
+ // },
163470
+ // {
163471
+ // 'name': 'PURR',
163472
+ // 'szDecimals': '0',
163473
+ // 'weiDecimals': '5',
163474
+ // },
163475
+ // ],
163476
+ // 'universe': [
163477
+ // {
163478
+ // 'name': 'PURR/USDC',
163479
+ // 'tokens': [
163480
+ // 1,
163481
+ // 0,
163482
+ // ],
163483
+ // },
163484
+ // ],
163485
+ // },
163486
+ // [
163487
+ // {
163488
+ // 'dayNtlVlm': '264250385.14640012',
163489
+ // 'markPx': '0.018314',
163490
+ // 'midPx': '0.0182235',
163491
+ // 'prevDayPx': '0.017427',
163492
+ // },
163493
+ // ],
163494
+ // ];
163495
+ //
163496
+ const first = this.safeDict(response, 0, {});
163497
+ const meta = this.safeList(first, 'universe', []);
163498
+ const tokens = this.safeList(first, 'tokens', []);
163499
+ const markets = [];
163500
+ for (let i = 0; i < meta.length; i++) {
163501
+ const market = this.safeDict(meta, i, {});
163502
+ const marketName = this.safeString(market, 'name');
163503
+ const marketParts = marketName.split('/');
163504
+ const baseName = this.safeString(marketParts, 0);
163505
+ const quoteId = this.safeString(marketParts, 1);
163506
+ const base = this.safeCurrencyCode(baseName);
163507
+ const quote = this.safeCurrencyCode(quoteId);
163508
+ const symbol = base + '/' + quote;
163509
+ const fees = this.safeDict(this.fees, 'spot', {});
163510
+ const taker = this.safeNumber(fees, 'taker');
163511
+ const maker = this.safeNumber(fees, 'maker');
163512
+ const tokensPos = this.safeList(market, 'tokens', []);
163513
+ const baseTokenPos = this.safeInteger(tokensPos, 0);
163514
+ const quoteTokenPos = this.safeInteger(tokensPos, 1);
163515
+ const baseTokenInfo = this.safeDict(tokens, baseTokenPos, {});
163516
+ const quoteTokenInfo = this.safeDict(tokens, quoteTokenPos, {});
163517
+ const baseDecimals = this.safeString(baseTokenInfo, 'szDecimals');
163518
+ const quoteDecimals = this.safeInteger(quoteTokenInfo, 'szDecimals');
163519
+ const baseId = this.numberToString(i + 10000);
163520
+ markets.push(this.safeMarketStructure({
163521
+ 'id': baseId,
163522
+ 'symbol': symbol,
163523
+ 'base': base,
163524
+ 'quote': quote,
163525
+ 'settle': undefined,
163526
+ 'baseId': baseId,
163527
+ 'quoteId': quoteId,
163528
+ 'settleId': undefined,
163529
+ 'type': 'spot',
163530
+ 'spot': true,
163531
+ 'margin': undefined,
163532
+ 'swap': false,
163533
+ 'future': false,
163534
+ 'option': false,
163535
+ 'active': true,
163536
+ 'contract': false,
163537
+ 'linear': true,
163538
+ 'inverse': false,
163539
+ 'taker': taker,
163540
+ 'maker': maker,
163541
+ 'contractSize': undefined,
163542
+ 'expiry': undefined,
163543
+ 'expiryDatetime': undefined,
163544
+ 'strike': undefined,
163545
+ 'optionType': undefined,
163546
+ 'precision': {
163547
+ 'amount': this.parseNumber(this.parsePrecision(baseDecimals)),
163548
+ 'price': quoteDecimals, // significant digits
163549
+ },
163550
+ 'limits': {
163551
+ 'leverage': {
163552
+ 'min': undefined,
163553
+ 'max': undefined,
163554
+ },
163555
+ 'amount': {
163556
+ 'min': undefined,
163557
+ 'max': undefined,
163558
+ },
163559
+ 'price': {
163560
+ 'min': undefined,
163561
+ 'max': undefined,
163562
+ },
163563
+ 'cost': {
163564
+ 'min': undefined,
163565
+ 'max': undefined,
163566
+ },
163567
+ },
163568
+ 'created': undefined,
163569
+ 'info': market,
163570
+ }));
163571
+ }
163572
+ return markets;
163573
+ }
163115
163574
  parseMarket(market) {
163116
163575
  //
163117
163576
  // {
@@ -163210,12 +163669,17 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163210
163669
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-state
163211
163670
  * @param {object} [params] extra parameters specific to the exchange API endpoint
163212
163671
  * @param {string} [params.user] user address, will default to this.walletAddress if not provided
163672
+ * @param {string} [params.type] wallet type, ['spot', 'swap'], defaults to swap
163213
163673
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
163214
163674
  */
163215
163675
  let userAddress = undefined;
163216
163676
  [userAddress, params] = this.handlePublicAddress('fetchBalance', params);
163677
+ let type = undefined;
163678
+ [type, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
163679
+ const isSpot = (type === 'spot');
163680
+ const reqType = (isSpot) ? 'spotClearinghouseState' : 'clearinghouseState';
163217
163681
  const request = {
163218
- 'type': 'clearinghouseState',
163682
+ 'type': reqType,
163219
163683
  'user': userAddress,
163220
163684
  };
163221
163685
  const response = await this.publicPostInfo(this.extend(request, params));
@@ -163238,7 +163702,37 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163238
163702
  // "time": "1704261007014",
163239
163703
  // "withdrawable": "100.0"
163240
163704
  // }
163705
+ // spot
163241
163706
  //
163707
+ // {
163708
+ // "balances":[
163709
+ // {
163710
+ // "coin":"USDC",
163711
+ // "hold":"0.0",
163712
+ // "total":"1481.844"
163713
+ // },
163714
+ // {
163715
+ // "coin":"PURR",
163716
+ // "hold":"0.0",
163717
+ // "total":"999.65004"
163718
+ // }
163719
+ // }
163720
+ //
163721
+ const balances = this.safeList(response, 'balances');
163722
+ if (balances !== undefined) {
163723
+ const spotBalances = { 'info': response };
163724
+ for (let i = 0; i < balances.length; i++) {
163725
+ const balance = balances[i];
163726
+ const code = this.safeCurrencyCode(this.safeString(balance, 'coin'));
163727
+ const account = this.account();
163728
+ const total = this.safeString(balance, 'total');
163729
+ const free = this.safeString(balance, 'hold');
163730
+ account['total'] = total;
163731
+ account['free'] = free;
163732
+ spotBalances[code] = account;
163733
+ }
163734
+ return this.safeBalance(spotBalances);
163735
+ }
163242
163736
  const data = this.safeDict(response, 'marginSummary', {});
163243
163737
  const result = {
163244
163738
  'info': response,
@@ -163764,6 +164258,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163764
164258
  * @param {string} symbol unified symbol of the market the order was made in
163765
164259
  * @param {object} [params] extra parameters specific to the exchange API endpoint
163766
164260
  * @param {string} [params.clientOrderId] client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
164261
+ * @param {string} [params.vaultAddress] the vault address for order
163767
164262
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
163768
164263
  */
163769
164264
  return await this.cancelOrders([id], symbol, params);
@@ -163779,6 +164274,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163779
164274
  * @param {string} [symbol] unified market symbol
163780
164275
  * @param {object} [params] extra parameters specific to the exchange API endpoint
163781
164276
  * @param {string|string[]} [params.clientOrderId] client order ids, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
164277
+ * @param {string} [params.vaultAddress] the vault address
163782
164278
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
163783
164279
  */
163784
164280
  this.checkRequiredCredentials();
@@ -164261,7 +164757,12 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
164261
164757
  const coin = this.safeString(entry, 'coin');
164262
164758
  let marketId = undefined;
164263
164759
  if (coin !== undefined) {
164264
- marketId = coin + '/USDC:USDC';
164760
+ if (coin.indexOf('/') > -1) {
164761
+ marketId = coin;
164762
+ }
164763
+ else {
164764
+ marketId = coin + '/USDC:USDC';
164765
+ }
164265
164766
  }
164266
164767
  if (this.safeString(entry, 'id') === undefined) {
164267
164768
  market = this.safeMarket(marketId, undefined);
@@ -164745,10 +165246,27 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
164745
165246
  // 'status': 'ok'
164746
165247
  // }
164747
165248
  //
164748
- return response;
164749
- // return this.extend (this.parseMarginModification (response, market), {
164750
- // 'code': code,
164751
- // });
165249
+ return this.extend(this.parseMarginModification(response, market), {
165250
+ 'code': this.safeString(response, 'status'),
165251
+ });
165252
+ }
165253
+ parseMarginModification(data, market = undefined) {
165254
+ //
165255
+ // {
165256
+ // 'type': 'default'
165257
+ // }
165258
+ //
165259
+ return {
165260
+ 'info': data,
165261
+ 'symbol': this.safeSymbol(undefined, market),
165262
+ 'type': undefined,
165263
+ 'amount': undefined,
165264
+ 'total': undefined,
165265
+ 'code': this.safeString(market, 'settle'),
165266
+ 'status': undefined,
165267
+ 'timestamp': undefined,
165268
+ 'datetime': undefined,
165269
+ };
164752
165270
  }
164753
165271
  async transfer(code, amount, fromAccount, toAccount, params = {}) {
164754
165272
  /**
@@ -164758,13 +165276,44 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
164758
165276
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#l1-usdc-transfer
164759
165277
  * @param {string} code unified currency code
164760
165278
  * @param {float} amount amount to transfer
164761
- * @param {string} fromAccount account to transfer from
164762
- * @param {string} toAccount account to transfer to
165279
+ * @param {string} fromAccount account to transfer from *spot, swap*
165280
+ * @param {string} toAccount account to transfer to *swap, spot or address*
164763
165281
  * @param {object} [params] extra parameters specific to the exchange API endpoint
165282
+ * @param {string} [params.vaultAddress] the vault address for order
164764
165283
  * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
164765
165284
  */
164766
165285
  this.checkRequiredCredentials();
164767
165286
  await this.loadMarkets();
165287
+ const isSandboxMode = this.safeBool(this.options, 'sandboxMode');
165288
+ const nonce = this.milliseconds();
165289
+ if (this.inArray(fromAccount, ['spot', 'swap', 'perp'])) {
165290
+ // handle swap <> spot account transfer
165291
+ if (!this.inArray(toAccount, ['spot', 'swap', 'perp'])) {
165292
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + 'transfer() only support spot <> swap transfer');
165293
+ }
165294
+ const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
165295
+ params = this.omit(params, 'vaultAddress');
165296
+ const toPerp = (toAccount === 'perp') || (toAccount === 'swap');
165297
+ const action = {
165298
+ 'type': 'spotUser',
165299
+ 'classTransfer': {
165300
+ 'usdc': amount,
165301
+ 'toPerp': toPerp,
165302
+ },
165303
+ };
165304
+ const signature = this.signL1Action(action, nonce, vaultAddress);
165305
+ const innerRequest = {
165306
+ 'action': this.extend(action, params),
165307
+ 'nonce': nonce,
165308
+ 'signature': signature,
165309
+ };
165310
+ if (vaultAddress !== undefined) {
165311
+ innerRequest['vaultAddress'] = vaultAddress;
165312
+ }
165313
+ const transferResponse = await this.privatePostExchange(innerRequest);
165314
+ return transferResponse;
165315
+ }
165316
+ // handle sub-account/different account transfer
164768
165317
  this.checkAddress(toAccount);
164769
165318
  if (code !== undefined) {
164770
165319
  code = code.toUpperCase();
@@ -164772,11 +165321,9 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
164772
165321
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + 'withdraw() only support USDC');
164773
165322
  }
164774
165323
  }
164775
- const isSandboxMode = this.safeBool(this.options, 'sandboxMode');
164776
- const nonce = this.milliseconds();
164777
165324
  const payload = {
164778
165325
  'destination': toAccount,
164779
- 'amount': amount.toString(),
165326
+ 'amount': this.numberToString(amount),
164780
165327
  'time': nonce,
164781
165328
  };
164782
165329
  const sig = this.buildTransferSig(payload);
@@ -165381,7 +165928,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
165381
165928
  request['start'] = since;
165382
165929
  }
165383
165930
  if (limit !== undefined) {
165384
- request['limit'] = limit;
165931
+ request['limit'] = Math.min(limit, 1000);
165385
165932
  }
165386
165933
  const response = await this.publicGetCandles(this.extend(request, params));
165387
165934
  if (Array.isArray(response)) {
@@ -172216,7 +172763,8 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
172216
172763
  // swap == perpetual
172217
172764
  let settle = undefined;
172218
172765
  let settleId = undefined;
172219
- const amountPrecision = this.parseNumber(this.parsePrecision(this.safeString(market, 'contractValueTradePrecision', '0')));
172766
+ const cvtp = this.safeString(market, 'contractValueTradePrecision');
172767
+ const amountPrecision = this.parseNumber(this.integerPrecisionToAmount(cvtp));
172220
172768
  const pricePrecision = this.safeNumber(market, 'tickSize');
172221
172769
  const contract = (swap || future || index);
172222
172770
  const swapOrFutures = (swap || future);
@@ -172505,17 +173053,13 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
172505
173053
  if (limit === undefined) {
172506
173054
  limit = 5000;
172507
173055
  }
172508
- else if (limit > 5000) {
172509
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' fetchOHLCV() limit cannot exceed 5000');
172510
- }
173056
+ limit = Math.min(limit, 5000);
172511
173057
  const toTimestamp = this.sum(request['from'], limit * duration - 1);
172512
173058
  const currentTimestamp = this.seconds();
172513
173059
  request['to'] = Math.min(toTimestamp, currentTimestamp);
172514
173060
  }
172515
173061
  else if (limit !== undefined) {
172516
- if (limit > 5000) {
172517
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' fetchOHLCV() limit cannot exceed 5000');
172518
- }
173062
+ limit = Math.min(limit, 5000);
172519
173063
  const duration = this.parseTimeframe(timeframe);
172520
173064
  request['to'] = this.seconds();
172521
173065
  request['from'] = this.parseToInt(request['to'] - (duration * limit));
@@ -178108,9 +178652,9 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
178108
178652
  * @method
178109
178653
  * @name kucoin#fetchBalance
178110
178654
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
178111
- * @see https://docs.kucoin.com/#list-accounts
178112
178655
  * @see https://www.kucoin.com/docs/rest/account/basic-info/get-account-list-spot-margin-trade_hf
178113
- * @see https://docs.kucoin.com/#query-isolated-margin-account-info
178656
+ * @see https://www.kucoin.com/docs/rest/funding/funding-overview/get-account-detail-margin
178657
+ * @see https://www.kucoin.com/docs/rest/funding/funding-overview/get-account-detail-isolated-margin
178114
178658
  * @param {object} [params] extra parameters specific to the exchange API endpoint
178115
178659
  * @param {object} [params.marginMode] 'cross' or 'isolated', margin type for fetching margin balance
178116
178660
  * @param {object} [params.type] extra parameters specific to the exchange API endpoint
@@ -178137,7 +178681,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
178137
178681
  let response = undefined;
178138
178682
  const request = {};
178139
178683
  const isolated = (marginMode === 'isolated') || (type === 'isolated');
178140
- const cross = (marginMode === 'cross') || (type === 'cross');
178684
+ const cross = (marginMode === 'cross') || (type === 'margin');
178141
178685
  if (isolated) {
178142
178686
  if (currency !== undefined) {
178143
178687
  request['balanceCurrency'] = currency['id'];
@@ -178207,13 +178751,14 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
178207
178751
  // }
178208
178752
  // }
178209
178753
  //
178210
- const data = this.safeList(response, 'data', []);
178754
+ let data = undefined;
178211
178755
  const result = {
178212
178756
  'info': response,
178213
178757
  'timestamp': undefined,
178214
178758
  'datetime': undefined,
178215
178759
  };
178216
178760
  if (isolated) {
178761
+ data = this.safeDict(response, 'data', {});
178217
178762
  const assets = this.safeValue(data, 'assets', data);
178218
178763
  for (let i = 0; i < assets.length; i++) {
178219
178764
  const entry = assets[i];
@@ -178230,6 +178775,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
178230
178775
  }
178231
178776
  }
178232
178777
  else if (cross) {
178778
+ data = this.safeDict(response, 'data', {});
178233
178779
  const accounts = this.safeList(data, 'accounts', []);
178234
178780
  for (let i = 0; i < accounts.length; i++) {
178235
178781
  const balance = accounts[i];
@@ -178239,6 +178785,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
178239
178785
  }
178240
178786
  }
178241
178787
  else {
178788
+ data = this.safeList(response, 'data', []);
178242
178789
  for (let i = 0; i < data.length; i++) {
178243
178790
  const balance = data[i];
178244
178791
  const balanceType = this.safeString(balance, 'type');
@@ -186723,6 +187270,9 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
186723
187270
  if (limit === undefined) {
186724
187271
  limit = 100;
186725
187272
  }
187273
+ else {
187274
+ limit = Math.min(limit, 2000);
187275
+ }
186726
187276
  if (since === undefined) {
186727
187277
  const duration = this.parseTimeframe(timeframe);
186728
187278
  since = this.milliseconds() - duration * 1000 * limit;
@@ -196491,7 +197041,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
196491
197041
  }
196492
197042
  }
196493
197043
  if (result === undefined) {
196494
- 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');
197044
+ 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');
196495
197045
  }
196496
197046
  return result;
196497
197047
  }
@@ -202411,7 +202961,7 @@ class oceanex extends _abstract_oceanex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
202411
202961
  request['timestamp'] = since;
202412
202962
  }
202413
202963
  if (limit !== undefined) {
202414
- request['limit'] = limit;
202964
+ request['limit'] = Math.min(limit, 10000);
202415
202965
  }
202416
202966
  const response = await this.publicPostK(this.extend(request, params));
202417
202967
  const ohlcvs = this.safeList(response, 'data', []);
@@ -212210,26 +212760,40 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
212210
212760
  // "msg": ""
212211
212761
  // }
212212
212762
  //
212213
- return this.parseMarginModification(response, market);
212763
+ const data = this.safeList(response, 'data', []);
212764
+ const errorCode = this.safeString(response, 'code');
212765
+ const item = this.safeDict(data, 0, {});
212766
+ return this.extend(this.parseMarginModification(item, market), {
212767
+ 'status': (errorCode === '0') ? 'ok' : 'failed',
212768
+ });
212214
212769
  }
212215
212770
  parseMarginModification(data, market = undefined) {
212216
- const innerData = this.safeValue(data, 'data', []);
212217
- const entry = this.safeValue(innerData, 0, {});
212218
- const errorCode = this.safeString(data, 'code');
212219
- const status = (errorCode === '0') ? 'ok' : 'failed';
212220
- const amountRaw = this.safeNumber(entry, 'amt');
212221
- const typeRaw = this.safeString(entry, 'type');
212771
+ //
212772
+ // addMargin/reduceMargin
212773
+ //
212774
+ // {
212775
+ // "amt": "0.01",
212776
+ // "instId": "ETH-USD-SWAP",
212777
+ // "posSide": "net",
212778
+ // "type": "reduce"
212779
+ // }
212780
+ //
212781
+ const amountRaw = this.safeNumber(data, 'amt');
212782
+ const typeRaw = this.safeString(data, 'type');
212222
212783
  const type = (typeRaw === 'reduce') ? 'reduce' : 'add';
212223
- const marketId = this.safeString(entry, 'instId');
212784
+ const marketId = this.safeString(data, 'instId');
212224
212785
  const responseMarket = this.safeMarket(marketId, market);
212225
212786
  const code = responseMarket['inverse'] ? responseMarket['base'] : responseMarket['quote'];
212226
212787
  return {
212227
212788
  'info': data,
212789
+ 'symbol': responseMarket['symbol'],
212228
212790
  'type': type,
212229
212791
  'amount': amountRaw,
212792
+ 'total': undefined,
212230
212793
  'code': code,
212231
- 'symbol': responseMarket['symbol'],
212232
- 'status': status,
212794
+ 'status': undefined,
212795
+ 'timestamp': undefined,
212796
+ 'datetime': undefined,
212233
212797
  };
212234
212798
  }
212235
212799
  async reduceMargin(symbol, amount, params = {}) {
@@ -221277,12 +221841,14 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
221277
221841
  const codeCurrency = inverse ? 'base' : 'quote';
221278
221842
  return {
221279
221843
  'info': data,
221844
+ 'symbol': this.safeSymbol(undefined, market),
221280
221845
  'type': 'set',
221281
221846
  'amount': undefined,
221282
221847
  'total': undefined,
221283
221848
  'code': market[codeCurrency],
221284
- 'symbol': this.safeSymbol(undefined, market),
221285
221849
  'status': this.parseMarginStatus(this.safeString(data, 'code')),
221850
+ 'timestamp': undefined,
221851
+ 'datetime': undefined,
221286
221852
  };
221287
221853
  }
221288
221854
  async setMarginMode(marginMode, symbol = undefined, params = {}) {
@@ -266108,17 +266674,22 @@ class kucoin extends _kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
266108
266674
  const marketId = this.safeString(data, 'symbol', topicSymbol);
266109
266675
  const symbol = this.safeSymbol(marketId, undefined, '-');
266110
266676
  const messageHash = 'orderbook:' + symbol;
266111
- let orderbook = this.safeDict(this.orderbooks, symbol);
266677
+ // let orderbook = this.safeDict (this.orderbooks, symbol);
266112
266678
  if (subject === 'level2') {
266113
- if (orderbook === undefined) {
266114
- orderbook = this.orderBook();
266679
+ if (!(symbol in this.orderbooks)) {
266680
+ this.orderbooks[symbol] = this.orderBook();
266115
266681
  }
266116
266682
  else {
266683
+ const orderbook = this.orderbooks[symbol];
266117
266684
  orderbook.reset();
266118
266685
  }
266119
- orderbook['symbol'] = symbol;
266686
+ this.orderbooks[symbol]['symbol'] = symbol;
266120
266687
  }
266121
266688
  else {
266689
+ if (!(symbol in this.orderbooks)) {
266690
+ this.orderbooks[symbol] = this.orderBook();
266691
+ }
266692
+ const orderbook = this.orderbooks[symbol];
266122
266693
  const nonce = this.safeInteger(orderbook, 'nonce');
266123
266694
  const deltaEnd = this.safeInteger2(data, 'sequenceEnd', 'timestamp');
266124
266695
  if (nonce === undefined) {
@@ -266144,8 +266715,8 @@ class kucoin extends _kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
266144
266715
  return;
266145
266716
  }
266146
266717
  }
266147
- this.handleDelta(orderbook, data);
266148
- client.resolve(orderbook, messageHash);
266718
+ this.handleDelta(this.orderbooks[symbol], data);
266719
+ client.resolve(this.orderbooks[symbol], messageHash);
266149
266720
  }
266150
266721
  getCacheIndex(orderbook, cache) {
266151
266722
  const firstDelta = this.safeValue(cache, 0);
@@ -307543,7 +308114,7 @@ class wazirx extends _abstract_wazirx_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
307543
308114
  'interval': this.safeString(this.timeframes, timeframe, timeframe),
307544
308115
  };
307545
308116
  if (limit !== undefined) {
307546
- request['limit'] = limit;
308117
+ request['limit'] = Math.min(limit, 2000);
307547
308118
  }
307548
308119
  const until = this.safeInteger(params, 'until');
307549
308120
  params = this.omit(params, ['until']);
@@ -317144,6 +317715,9 @@ class zonda extends _abstract_zonda_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
317144
317715
  if (limit === undefined) {
317145
317716
  limit = 100;
317146
317717
  }
317718
+ else {
317719
+ limit = Math.min(limit, 11000); // supports up to 11k candles diapason
317720
+ }
317147
317721
  const duration = this.parseTimeframe(timeframe);
317148
317722
  const timerange = limit * duration * 1000;
317149
317723
  if (since === undefined) {
@@ -323629,9 +324203,11 @@ __webpack_require__.r(__webpack_exports__);
323629
324203
  /* harmony export */ BadSymbol: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.BadSymbol),
323630
324204
  /* harmony export */ BaseError: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.BaseError),
323631
324205
  /* harmony export */ CancelPending: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.CancelPending),
324206
+ /* harmony export */ ContractUnavailable: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.ContractUnavailable),
323632
324207
  /* harmony export */ DDoSProtection: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.DDoSProtection),
323633
324208
  /* harmony export */ DuplicateOrderId: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.DuplicateOrderId),
323634
324209
  /* harmony export */ Exchange: () => (/* reexport safe */ _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__.e),
324210
+ /* harmony export */ ExchangeClosedByUser: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.ExchangeClosedByUser),
323635
324211
  /* harmony export */ ExchangeError: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.ExchangeError),
323636
324212
  /* harmony export */ ExchangeNotAvailable: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.ExchangeNotAvailable),
323637
324213
  /* harmony export */ InsufficientFunds: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.InsufficientFunds),
@@ -323644,12 +324220,15 @@ __webpack_require__.r(__webpack_exports__);
323644
324220
  /* harmony export */ NotSupported: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.NotSupported),
323645
324221
  /* harmony export */ NullResponse: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.NullResponse),
323646
324222
  /* harmony export */ OnMaintenance: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.OnMaintenance),
324223
+ /* harmony export */ OperationFailed: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.OperationFailed),
324224
+ /* harmony export */ OperationRejected: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.OperationRejected),
323647
324225
  /* harmony export */ OrderImmediatelyFillable: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.OrderImmediatelyFillable),
323648
324226
  /* harmony export */ OrderNotCached: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.OrderNotCached),
323649
324227
  /* harmony export */ OrderNotFillable: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.OrderNotFillable),
323650
324228
  /* harmony export */ OrderNotFound: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.OrderNotFound),
323651
324229
  /* harmony export */ PermissionDenied: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.PermissionDenied),
323652
324230
  /* harmony export */ Precise: () => (/* reexport safe */ _src_base_Precise_js__WEBPACK_IMPORTED_MODULE_168__.O),
324231
+ /* harmony export */ ProxyError: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.ProxyError),
323653
324232
  /* harmony export */ RateLimitExceeded: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.RateLimitExceeded),
323654
324233
  /* harmony export */ RequestTimeout: () => (/* reexport safe */ _src_base_errors_js__WEBPACK_IMPORTED_MODULE_170__.RequestTimeout),
323655
324234
  /* harmony export */ ace: () => (/* reexport safe */ _src_ace_js__WEBPACK_IMPORTED_MODULE_1__.Z),
@@ -323967,7 +324546,7 @@ SOFTWARE.
323967
324546
 
323968
324547
  //-----------------------------------------------------------------------------
323969
324548
  // this is updated by vss.js when building
323970
- const version = '4.2.86';
324549
+ const version = '4.2.88';
323971
324550
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
323972
324551
  //-----------------------------------------------------------------------------
323973
324552