ccxt 4.2.85 → 4.2.87

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 (99) hide show
  1. package/README.md +5 -5
  2. package/dist/ccxt.browser.js +1132 -432
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/ascendex.js +11 -1
  6. package/dist/cjs/src/binance.js +14 -1
  7. package/dist/cjs/src/bingx.js +71 -20
  8. package/dist/cjs/src/bitbank.js +19 -23
  9. package/dist/cjs/src/bitfinex.js +3 -0
  10. package/dist/cjs/src/bitfinex2.js +16 -1
  11. package/dist/cjs/src/bitflyer.js +19 -0
  12. package/dist/cjs/src/bitget.js +15 -1
  13. package/dist/cjs/src/bitopro.js +3 -0
  14. package/dist/cjs/src/bitrue.js +13 -7
  15. package/dist/cjs/src/bitvavo.js +3 -0
  16. package/dist/cjs/src/btcmarkets.js +1 -1
  17. package/dist/cjs/src/btcturk.js +2 -1
  18. package/dist/cjs/src/coinex.js +576 -302
  19. package/dist/cjs/src/currencycom.js +1 -1
  20. package/dist/cjs/src/delta.js +3 -1
  21. package/dist/cjs/src/digifinex.js +4 -2
  22. package/dist/cjs/src/exmo.js +11 -12
  23. package/dist/cjs/src/gate.js +5 -2
  24. package/dist/cjs/src/hitbtc.js +26 -2
  25. package/dist/cjs/src/htx.js +2 -2
  26. package/dist/cjs/src/huobijp.js +1 -1
  27. package/dist/cjs/src/hyperliquid.js +249 -12
  28. package/dist/cjs/src/idex.js +11 -12
  29. package/dist/cjs/src/krakenfutures.js +2 -6
  30. package/dist/cjs/src/lbank.js +3 -0
  31. package/dist/cjs/src/oceanex.js +1 -1
  32. package/dist/cjs/src/okcoin.js +3 -1
  33. package/dist/cjs/src/okx.js +24 -10
  34. package/dist/cjs/src/phemex.js +3 -1
  35. package/dist/cjs/src/pro/bitget.js +1 -0
  36. package/dist/cjs/src/pro/kucoin.js +11 -6
  37. package/dist/cjs/src/wazirx.js +1 -1
  38. package/dist/cjs/src/zonda.js +3 -0
  39. package/examples/js/benchmark.js +104 -0
  40. package/examples/ts/benchmark.ts +134 -0
  41. package/js/ccxt.d.ts +1 -1
  42. package/js/ccxt.js +1 -1
  43. package/js/src/abstract/coinex.d.ts +232 -123
  44. package/js/src/ascendex.d.ts +5 -12
  45. package/js/src/ascendex.js +11 -1
  46. package/js/src/base/Exchange.d.ts +13 -13
  47. package/js/src/base/types.d.ts +11 -0
  48. package/js/src/binance.d.ts +4 -11
  49. package/js/src/binance.js +14 -1
  50. package/js/src/bingx.d.ts +5 -2
  51. package/js/src/bingx.js +71 -20
  52. package/js/src/bitbank.js +19 -23
  53. package/js/src/bitfinex.js +3 -0
  54. package/js/src/bitfinex2.d.ts +3 -17
  55. package/js/src/bitfinex2.js +16 -1
  56. package/js/src/bitflyer.d.ts +1 -0
  57. package/js/src/bitflyer.js +20 -1
  58. package/js/src/bitget.d.ts +5 -12
  59. package/js/src/bitget.js +15 -1
  60. package/js/src/bitopro.js +3 -0
  61. package/js/src/bitrue.d.ts +3 -17
  62. package/js/src/bitrue.js +13 -7
  63. package/js/src/bitvavo.js +3 -0
  64. package/js/src/btcmarkets.js +1 -1
  65. package/js/src/btcturk.js +2 -1
  66. package/js/src/coinex.d.ts +5 -12
  67. package/js/src/coinex.js +576 -302
  68. package/js/src/currencycom.js +1 -1
  69. package/js/src/delta.d.ts +5 -37
  70. package/js/src/delta.js +3 -1
  71. package/js/src/digifinex.d.ts +5 -13
  72. package/js/src/digifinex.js +4 -2
  73. package/js/src/exmo.d.ts +5 -37
  74. package/js/src/exmo.js +11 -12
  75. package/js/src/gate.d.ts +5 -33
  76. package/js/src/gate.js +5 -2
  77. package/js/src/hitbtc.d.ts +5 -12
  78. package/js/src/hitbtc.js +26 -2
  79. package/js/src/htx.js +2 -2
  80. package/js/src/huobijp.js +1 -1
  81. package/js/src/hyperliquid.d.ts +7 -4
  82. package/js/src/hyperliquid.js +249 -12
  83. package/js/src/idex.js +11 -12
  84. package/js/src/krakenfutures.js +2 -6
  85. package/js/src/kucoinfutures.d.ts +2 -2
  86. package/js/src/lbank.js +3 -0
  87. package/js/src/mexc.d.ts +3 -3
  88. package/js/src/oceanex.js +1 -1
  89. package/js/src/okcoin.js +3 -1
  90. package/js/src/okx.d.ts +5 -33
  91. package/js/src/okx.js +24 -10
  92. package/js/src/phemex.d.ts +3 -11
  93. package/js/src/phemex.js +3 -1
  94. package/js/src/pro/bitget.js +1 -0
  95. package/js/src/pro/kucoin.js +11 -6
  96. package/js/src/wazirx.js +1 -1
  97. package/js/src/zonda.js +3 -0
  98. package/package.json +3 -2
  99. package/skip-tests.json +7 -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 = {}) {
@@ -29722,6 +29732,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
29722
29732
  });
29723
29733
  }
29724
29734
  parseMarginModification(data, market = undefined) {
29735
+ //
29736
+ // add/reduce margin
29737
+ //
29738
+ // {
29739
+ // "code": 200,
29740
+ // "msg": "Successfully modify position margin.",
29741
+ // "amount": 0.001,
29742
+ // "type": 1
29743
+ // }
29744
+ //
29725
29745
  const rawType = this.safeInteger(data, 'type');
29726
29746
  const resultType = (rawType === 1) ? 'add' : 'reduce';
29727
29747
  const resultAmount = this.safeNumber(data, 'amount');
@@ -29729,11 +29749,14 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
29729
29749
  const status = (errorCode === '200') ? 'ok' : 'failed';
29730
29750
  return {
29731
29751
  'info': data,
29752
+ 'symbol': market['symbol'],
29732
29753
  'type': resultType,
29733
29754
  'amount': resultAmount,
29755
+ 'total': undefined,
29734
29756
  'code': undefined,
29735
- 'symbol': market['symbol'],
29736
29757
  'status': status,
29758
+ 'timestamp': undefined,
29759
+ 'datetime': undefined,
29737
29760
  };
29738
29761
  }
29739
29762
  async reduceMargin(symbol, amount, params = {}) {
@@ -31374,6 +31397,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
31374
31397
  'swap': true,
31375
31398
  'future': false,
31376
31399
  'option': false,
31400
+ 'addMargin': true,
31377
31401
  'cancelAllOrders': true,
31378
31402
  'cancelOrder': true,
31379
31403
  'cancelOrders': true,
@@ -31420,6 +31444,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
31420
31444
  'fetchTrades': true,
31421
31445
  'fetchTransfers': true,
31422
31446
  'fetchWithdrawals': true,
31447
+ 'reduceMargin': true,
31423
31448
  'setLeverage': true,
31424
31449
  'setMargin': true,
31425
31450
  'setMarginMode': true,
@@ -31973,7 +31998,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
31973
31998
  symbol += ':' + settle;
31974
31999
  }
31975
32000
  const fees = this.safeDict(this.fees, type, {});
31976
- const contractSize = this.safeNumber(market, 'size');
32001
+ const contractSize = (swap) ? this.parseNumber('1') : undefined;
31977
32002
  const isActive = this.safeString(market, 'status') === '1';
31978
32003
  const isInverse = (spot) ? undefined : false;
31979
32004
  const isLinear = (spot) ? undefined : swap;
@@ -32014,7 +32039,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
32014
32039
  'max': this.safeInteger(market, 'maxLongLeverage'),
32015
32040
  },
32016
32041
  'amount': {
32017
- 'min': this.safeNumber(market, 'minQty'),
32042
+ 'min': this.safeNumber2(market, 'minQty', 'tradeMinQuantity'),
32018
32043
  'max': this.safeNumber(market, 'maxQty'),
32019
32044
  },
32020
32045
  'price': {
@@ -32022,7 +32047,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
32022
32047
  'max': undefined,
32023
32048
  },
32024
32049
  'cost': {
32025
- 'min': this.safeNumber(market, 'minNotional'),
32050
+ 'min': this.safeNumber2(market, 'minNotional', 'tradeMinUSDT'),
32026
32051
  'max': this.safeNumber(market, 'maxNotional'),
32027
32052
  },
32028
32053
  },
@@ -32379,6 +32404,13 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
32379
32404
  if (isMaker !== undefined) {
32380
32405
  takeOrMaker = isMaker ? 'maker' : 'taker';
32381
32406
  }
32407
+ let amount = this.safeStringN(trade, ['qty', 'amount', 'q']);
32408
+ if ((market !== undefined) && market['swap'] && ('volume' in trade)) {
32409
+ // private trade returns num of contracts instead of base currency (as the order-related methods do)
32410
+ const contractSize = this.safeString(market['info'], 'tradeMinQuantity');
32411
+ const volume = this.safeString(trade, 'volume');
32412
+ amount = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(volume, contractSize);
32413
+ }
32382
32414
  return this.safeTrade({
32383
32415
  'id': this.safeStringN(trade, ['id', 't']),
32384
32416
  'info': trade,
@@ -32390,7 +32422,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
32390
32422
  'side': this.parseOrderSide(side),
32391
32423
  'takerOrMaker': takeOrMaker,
32392
32424
  'price': this.safeString2(trade, 'price', 'p'),
32393
- 'amount': this.safeStringN(trade, ['qty', 'volume', 'amount', 'q']),
32425
+ 'amount': amount,
32394
32426
  'cost': cost,
32395
32427
  'fee': {
32396
32428
  'cost': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(this.safeString2(trade, 'commission', 'n'))),
@@ -33022,19 +33054,27 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
33022
33054
  }
33023
33055
  parsePosition(position, market = undefined) {
33024
33056
  //
33025
- // {
33026
- // "symbol": "BTC-USDT",
33027
- // "positionId": "12345678",
33028
- // "positionSide": "LONG",
33029
- // "isolated": true,
33030
- // "positionAmt": "123.33",
33031
- // "availableAmt": "128.99",
33032
- // "unrealizedProfit": "1.22",
33033
- // "realisedProfit": "8.1",
33034
- // "initialMargin": "123.33",
33035
- // "avgPrice": "2.2",
33036
- // "leverage": 10,
33037
- // }
33057
+ // {
33058
+ // "positionId":"1773122376147623936",
33059
+ // "symbol":"XRP-USDT",
33060
+ // "currency":"USDT",
33061
+ // "positionAmt":"3",
33062
+ // "availableAmt":"3",
33063
+ // "positionSide":"LONG",
33064
+ // "isolated":false,
33065
+ // "avgPrice":"0.6139",
33066
+ // "initialMargin":"0.0897",
33067
+ // "leverage":20,
33068
+ // "unrealizedProfit":"-0.0023",
33069
+ // "realisedProfit":"-0.0009",
33070
+ // "liquidationPrice":0,
33071
+ // "pnlRatio":"-0.0260",
33072
+ // "maxMarginReduction":"",
33073
+ // "riskRate":"",
33074
+ // "markPrice":"",
33075
+ // "positionValue":"",
33076
+ // "onlyOnePosition":false
33077
+ // }
33038
33078
  //
33039
33079
  // standard position
33040
33080
  //
@@ -33061,7 +33101,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
33061
33101
  'info': position,
33062
33102
  'id': this.safeString(position, 'positionId'),
33063
33103
  'symbol': this.safeSymbol(marketId, market, '-', 'swap'),
33064
- 'notional': this.safeNumber(position, 'positionAmt'),
33104
+ 'notional': this.safeNumber(position, 'positionValue'),
33065
33105
  'marginMode': marginMode,
33066
33106
  'liquidationPrice': undefined,
33067
33107
  'entryPrice': this.safeNumber2(position, 'avgPrice', 'entryPrice'),
@@ -33079,7 +33119,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
33079
33119
  'lastUpdateTimestamp': undefined,
33080
33120
  'maintenanceMargin': undefined,
33081
33121
  'maintenanceMarginPercentage': undefined,
33082
- 'collateral': this.safeNumber(position, 'positionAmt'),
33122
+ 'collateral': undefined,
33083
33123
  'initialMargin': this.safeNumber(position, 'initialMargin'),
33084
33124
  'initialMarginPercentage': undefined,
33085
33125
  'leverage': this.safeNumber(position, 'leverage'),
@@ -34793,6 +34833,18 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
34793
34833
  };
34794
34834
  return await this.swapV2PrivatePostTradeMarginType(this.extend(request, params));
34795
34835
  }
34836
+ async addMargin(symbol, amount, params = {}) {
34837
+ const request = {
34838
+ 'type': 1,
34839
+ };
34840
+ return await this.setMargin(symbol, amount, this.extend(request, params));
34841
+ }
34842
+ async reduceMargin(symbol, amount, params = {}) {
34843
+ const request = {
34844
+ 'type': 2,
34845
+ };
34846
+ return await this.setMargin(symbol, amount, this.extend(request, params));
34847
+ }
34796
34848
  async setMargin(symbol, amount, params = {}) {
34797
34849
  /**
34798
34850
  * @method
@@ -34827,7 +34879,29 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
34827
34879
  // "type": 1
34828
34880
  // }
34829
34881
  //
34830
- return response;
34882
+ return this.parseMarginModification(response, market);
34883
+ }
34884
+ parseMarginModification(data, market = undefined) {
34885
+ //
34886
+ // {
34887
+ // "code": 0,
34888
+ // "msg": "",
34889
+ // "amount": 1,
34890
+ // "type": 1
34891
+ // }
34892
+ //
34893
+ const type = this.safeString(data, 'type');
34894
+ return {
34895
+ 'info': data,
34896
+ 'symbol': this.safeString(market, 'symbol'),
34897
+ 'type': (type === '1') ? 'add' : 'reduce',
34898
+ 'amount': this.safeNumber(data, 'amount'),
34899
+ 'total': this.safeNumber(data, 'margin'),
34900
+ 'code': this.safeString(market, 'settle'),
34901
+ 'status': undefined,
34902
+ 'timestamp': undefined,
34903
+ 'datetime': undefined,
34904
+ };
34831
34905
  }
34832
34906
  async fetchLeverage(symbol, params = {}) {
34833
34907
  /**
@@ -36761,21 +36835,23 @@ class bitbank extends _abstract_bitbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
36761
36835
  },
36762
36836
  'precisionMode': _base_functions_number_js__WEBPACK_IMPORTED_MODULE_1__/* .TICK_SIZE */ .sh,
36763
36837
  'exceptions': {
36764
- '20001': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError,
36765
- '20002': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError,
36766
- '20003': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError,
36767
- '20005': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError,
36768
- '20004': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidNonce,
36769
- '40020': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
36770
- '40021': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
36771
- '40025': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
36772
- '40013': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
36773
- '40014': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
36774
- '50008': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied,
36775
- '50009': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
36776
- '50010': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
36777
- '60001': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
36778
- '60005': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
36838
+ 'exact': {
36839
+ '20001': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError,
36840
+ '20002': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError,
36841
+ '20003': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError,
36842
+ '20005': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError,
36843
+ '20004': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidNonce,
36844
+ '40020': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
36845
+ '40021': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
36846
+ '40025': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
36847
+ '40013': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
36848
+ '40014': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
36849
+ '50008': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied,
36850
+ '50009': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
36851
+ '50010': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
36852
+ '60001': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
36853
+ '60005': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
36854
+ },
36779
36855
  },
36780
36856
  });
36781
36857
  }
@@ -37606,16 +37682,10 @@ class bitbank extends _abstract_bitbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
37606
37682
  '70009': 'We are currently temporarily restricting orders to be carried out. Please use the limit order.',
37607
37683
  '70010': 'We are temporarily raising the minimum order quantity as the system load is now rising.',
37608
37684
  };
37609
- const errorClasses = this.exceptions;
37610
37685
  const code = this.safeString(data, 'code');
37611
37686
  const message = this.safeString(errorMessages, code, 'Error');
37612
- const ErrorClass = this.safeValue(errorClasses, code);
37613
- if (ErrorClass !== undefined) {
37614
- throw new errorClasses[code](message);
37615
- }
37616
- else {
37617
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' ' + this.json(response));
37618
- }
37687
+ this.throwExactlyMatchedException(this.exceptions['exact'], code, message);
37688
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' ' + this.json(response));
37619
37689
  }
37620
37690
  return undefined;
37621
37691
  }
@@ -40234,6 +40304,9 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
40234
40304
  if (limit === undefined) {
40235
40305
  limit = 100;
40236
40306
  }
40307
+ else {
40308
+ limit = Math.min(limit, 10000);
40309
+ }
40237
40310
  const market = this.market(symbol);
40238
40311
  const v2id = 't' + market['id'];
40239
40312
  const request = {
@@ -41992,6 +42065,9 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
41992
42065
  if (limit === undefined) {
41993
42066
  limit = 10000;
41994
42067
  }
42068
+ else {
42069
+ limit = Math.min(limit, 10000);
42070
+ }
41995
42071
  let request = {
41996
42072
  'symbol': market['id'],
41997
42073
  'timeframe': this.safeString(this.timeframes, timeframe, timeframe),
@@ -44113,15 +44189,27 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
44113
44189
  return this.parseMarginModification(data, market);
44114
44190
  }
44115
44191
  parseMarginModification(data, market = undefined) {
44192
+ //
44193
+ // setMargin
44194
+ //
44195
+ // [
44196
+ // [
44197
+ // 1
44198
+ // ]
44199
+ // ]
44200
+ //
44116
44201
  const marginStatusRaw = data[0];
44117
44202
  const marginStatus = (marginStatusRaw === 1) ? 'ok' : 'failed';
44118
44203
  return {
44119
44204
  'info': data,
44205
+ 'symbol': market['symbol'],
44120
44206
  'type': undefined,
44121
44207
  'amount': undefined,
44208
+ 'total': undefined,
44122
44209
  'code': undefined,
44123
- 'symbol': market['symbol'],
44124
44210
  'status': marginStatus,
44211
+ 'timestamp': undefined,
44212
+ 'datetime': undefined,
44125
44213
  };
44126
44214
  }
44127
44215
  async fetchOrder(id, symbol = undefined, params = {}) {
@@ -44446,6 +44534,11 @@ class bitflyer extends _abstract_bitflyer_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
44446
44534
  },
44447
44535
  },
44448
44536
  'precisionMode': _base_functions_number_js__WEBPACK_IMPORTED_MODULE_1__/* .TICK_SIZE */ .sh,
44537
+ 'exceptions': {
44538
+ 'exact': {
44539
+ '-2': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OnMaintenance, // {"status":-2,"error_message":"Under maintenance","data":null}
44540
+ },
44541
+ },
44449
44542
  });
44450
44543
  }
44451
44544
  parseExpiryDate(expiry) {
@@ -45373,6 +45466,20 @@ class bitflyer extends _abstract_bitflyer_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
45373
45466
  }
45374
45467
  return { 'url': url, 'method': method, 'body': body, 'headers': headers };
45375
45468
  }
45469
+ handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
45470
+ if (response === undefined) {
45471
+ return undefined; // fallback to the default error handler
45472
+ }
45473
+ const feedback = this.id + ' ' + body;
45474
+ // i.e. {"status":-2,"error_message":"Under maintenance","data":null}
45475
+ const errorMessage = this.safeString(response, 'error_message');
45476
+ const statusCode = this.safeNumber(response, 'status');
45477
+ if (errorMessage !== undefined) {
45478
+ this.throwExactlyMatchedException(this.exceptions['exact'], statusCode, feedback);
45479
+ this.throwBroadlyMatchedException(this.exceptions['broad'], errorMessage, feedback);
45480
+ }
45481
+ return undefined;
45482
+ }
45376
45483
  }
45377
45484
 
45378
45485
 
@@ -46607,6 +46714,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
46607
46714
  '40768': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.OrderNotFound,
46608
46715
  '41114': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.OnMaintenance,
46609
46716
  '43011': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
46717
+ '43012': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InsufficientFunds,
46610
46718
  '43025': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
46611
46719
  '43115': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.OnMaintenance,
46612
46720
  '45110': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
@@ -52348,15 +52456,28 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
52348
52456
  });
52349
52457
  }
52350
52458
  parseMarginModification(data, market = undefined) {
52459
+ //
52460
+ // addMargin/reduceMargin
52461
+ //
52462
+ // {
52463
+ // "code": "00000",
52464
+ // "msg": "success",
52465
+ // "requestTime": 1700813444618,
52466
+ // "data": ""
52467
+ // }
52468
+ //
52351
52469
  const errorCode = this.safeString(data, 'code');
52352
52470
  const status = (errorCode === '00000') ? 'ok' : 'failed';
52353
52471
  return {
52354
52472
  'info': data,
52473
+ 'symbol': market['symbol'],
52355
52474
  'type': undefined,
52356
52475
  'amount': undefined,
52476
+ 'total': undefined,
52357
52477
  'code': market['settle'],
52358
- 'symbol': market['symbol'],
52359
52478
  'status': status,
52479
+ 'timestamp': undefined,
52480
+ 'datetime': undefined,
52360
52481
  };
52361
52482
  }
52362
52483
  async reduceMargin(symbol, amount, params = {}) {
@@ -63241,6 +63362,9 @@ class bitopro extends _abstract_bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
63241
63362
  if (limit === undefined) {
63242
63363
  limit = 500;
63243
63364
  }
63365
+ else {
63366
+ limit = Math.min(limit, 75000); // supports slightly more than 75k candles atm, but limit here to avoid errors
63367
+ }
63244
63368
  const timeframeInSeconds = this.parseTimeframe(timeframe);
63245
63369
  let alignedSince = undefined;
63246
63370
  if (since === undefined) {
@@ -65589,9 +65713,6 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
65589
65713
  'interval': this.safeString(timeframesFuture, timeframe, '1min'),
65590
65714
  };
65591
65715
  if (limit !== undefined) {
65592
- if (limit > 300) {
65593
- limit = 300;
65594
- }
65595
65716
  request['limit'] = limit;
65596
65717
  }
65597
65718
  if (market['linear']) {
@@ -65610,9 +65731,6 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
65610
65731
  'scale': this.safeString(timeframesSpot, timeframe, '1m'),
65611
65732
  };
65612
65733
  if (limit !== undefined) {
65613
- if (limit > 1440) {
65614
- limit = 1440;
65615
- }
65616
65734
  request['limit'] = limit;
65617
65735
  }
65618
65736
  if (since !== undefined) {
@@ -67284,13 +67402,25 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
67284
67402
  return response;
67285
67403
  }
67286
67404
  parseMarginModification(data, market = undefined) {
67405
+ //
67406
+ // setMargin
67407
+ //
67408
+ // {
67409
+ // "code": 0,
67410
+ // "msg": "success"
67411
+ // "data": null
67412
+ // }
67413
+ //
67287
67414
  return {
67288
67415
  'info': data,
67416
+ 'symbol': market['symbol'],
67289
67417
  'type': undefined,
67290
67418
  'amount': undefined,
67419
+ 'total': undefined,
67291
67420
  'code': undefined,
67292
- 'symbol': market['symbol'],
67293
67421
  'status': undefined,
67422
+ 'timestamp': undefined,
67423
+ 'datetime': undefined,
67294
67424
  };
67295
67425
  }
67296
67426
  async setMargin(symbol, amount, params = {}) {
@@ -74861,6 +74991,9 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
74861
74991
  if (limit === undefined) {
74862
74992
  limit = 1440;
74863
74993
  }
74994
+ else {
74995
+ limit = Math.min(limit, 1440);
74996
+ }
74864
74997
  request['end'] = this.sum(since, limit * duration * 1000);
74865
74998
  }
74866
74999
  [request, params] = this.handleUntilOption('end', request, params);
@@ -82023,7 +82156,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
82023
82156
  request['from'] = this.iso8601(since);
82024
82157
  }
82025
82158
  if (limit !== undefined) {
82026
- request['limit'] = limit; // default is 10, max 200
82159
+ request['limit'] = Math.min(limit, 200); // default is 10, max 200
82027
82160
  }
82028
82161
  const response = await this.publicGetMarketsMarketIdCandles(this.extend(request, params));
82029
82162
  //
@@ -83352,6 +83485,7 @@ class btcturk extends _abstract_btcturk_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
83352
83485
  limit = 100; // default value
83353
83486
  }
83354
83487
  if (limit !== undefined) {
83488
+ limit = Math.min(limit, 11000); // max 11000 candles diapason can be covered
83355
83489
  if (timeframe === '1y') { // difficult with leap years
83356
83490
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' fetchOHLCV () does not accept a limit parameter when timeframe == "1y"');
83357
83491
  }
@@ -83362,7 +83496,7 @@ class btcturk extends _abstract_btcturk_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
83362
83496
  request['to'] = Math.min(request['to'], to);
83363
83497
  }
83364
83498
  else {
83365
- request['from'] = this.parseToInt(until / 1000) - limitSeconds;
83499
+ request['from'] = this.parseToInt(0 / 1000) - limitSeconds;
83366
83500
  }
83367
83501
  }
83368
83502
  const response = await this.graphGetKlinesHistory(this.extend(request, params));
@@ -102619,6 +102753,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
102619
102753
  // 60 per 2 seconds => 30 per second => weight = 13.334
102620
102754
  // 40 per 2 seconds => 20 per second => weight = 20
102621
102755
  // 20 per 2 seconds => 10 per second => weight = 40
102756
+ // v1 is per 2 seconds and v2 is per 1 second
102622
102757
  'rateLimit': 2.5,
102623
102758
  'pro': true,
102624
102759
  'certified': true,
@@ -102725,156 +102860,279 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
102725
102860
  'perpetualPrivate': 'https://api.coinex.com/perpetual',
102726
102861
  },
102727
102862
  'www': 'https://www.coinex.com',
102728
- 'doc': 'https://viabtc.github.io/coinex_api_en_doc',
102863
+ 'doc': 'https://docs.coinex.com/api/v2',
102729
102864
  'fees': 'https://www.coinex.com/fees',
102730
102865
  'referral': 'https://www.coinex.com/register?refer_code=yw5fz',
102731
102866
  },
102732
102867
  'api': {
102733
- 'public': {
102734
- 'get': {
102735
- 'amm/market': 1,
102736
- 'common/currency/rate': 1,
102737
- 'common/asset/config': 1,
102738
- 'common/maintain/info': 1,
102739
- 'common/temp-maintain/info': 1,
102740
- 'margin/market': 1,
102741
- 'market/info': 1,
102742
- 'market/list': 1,
102743
- 'market/ticker': 1,
102744
- 'market/ticker/all': 1,
102745
- 'market/depth': 1,
102746
- 'market/deals': 1,
102747
- 'market/kline': 1,
102748
- 'market/detail': 1,
102749
- },
102750
- },
102751
- 'private': {
102752
- 'get': {
102753
- 'account/amm/balance': 40,
102754
- 'account/investment/balance': 40,
102755
- 'account/balance/history': 40,
102756
- 'account/market/fee': 40,
102757
- 'balance/coin/deposit': 40,
102758
- 'balance/coin/withdraw': 40,
102759
- 'balance/info': 40,
102760
- 'balance/deposit/address/{coin_type}': 40,
102761
- 'contract/transfer/history': 40,
102762
- 'credit/info': 40,
102763
- 'credit/balance': 40,
102764
- 'investment/transfer/history': 40,
102765
- 'margin/account': 1,
102766
- 'margin/config': 1,
102767
- 'margin/loan/history': 40,
102768
- 'margin/transfer/history': 40,
102769
- 'order/deals': 40,
102770
- 'order/finished': 40,
102771
- 'order/pending': 8,
102772
- 'order/status': 8,
102773
- 'order/status/batch': 8,
102774
- 'order/user/deals': 40,
102775
- 'order/stop/finished': 40,
102776
- 'order/stop/pending': 8,
102777
- 'order/user/trade/fee': 1,
102778
- 'order/market/trade/info': 1,
102779
- 'sub_account/balance': 1,
102780
- 'sub_account/transfer/history': 40,
102781
- 'sub_account/auth/api': 40,
102782
- 'sub_account/auth/api/{user_auth_id}': 40,
102783
- },
102784
- 'post': {
102785
- 'balance/coin/withdraw': 40,
102786
- 'contract/balance/transfer': 40,
102787
- 'margin/flat': 40,
102788
- 'margin/loan': 40,
102789
- 'margin/transfer': 40,
102790
- 'order/limit/batch': 40,
102791
- 'order/ioc': 13.334,
102792
- 'order/limit': 13.334,
102793
- 'order/market': 13.334,
102794
- 'order/modify': 13.334,
102795
- 'order/stop/limit': 13.334,
102796
- 'order/stop/market': 13.334,
102797
- 'order/stop/modify': 13.334,
102798
- 'sub_account/transfer': 40,
102799
- 'sub_account/register': 1,
102800
- 'sub_account/unfrozen': 40,
102801
- 'sub_account/frozen': 40,
102802
- 'sub_account/auth/api': 40,
102868
+ 'v1': {
102869
+ 'public': {
102870
+ 'get': {
102871
+ 'amm/market': 1,
102872
+ 'common/currency/rate': 1,
102873
+ 'common/asset/config': 1,
102874
+ 'common/maintain/info': 1,
102875
+ 'common/temp-maintain/info': 1,
102876
+ 'margin/market': 1,
102877
+ 'market/info': 1,
102878
+ 'market/list': 1,
102879
+ 'market/ticker': 1,
102880
+ 'market/ticker/all': 1,
102881
+ 'market/depth': 1,
102882
+ 'market/deals': 1,
102883
+ 'market/kline': 1,
102884
+ 'market/detail': 1,
102885
+ },
102803
102886
  },
102804
- 'put': {
102805
- 'balance/deposit/address/{coin_type}': 40,
102806
- 'sub_account/unfrozen': 40,
102807
- 'sub_account/frozen': 40,
102808
- 'sub_account/auth/api/{user_auth_id}': 40,
102809
- 'v1/account/settings': 40,
102887
+ 'private': {
102888
+ 'get': {
102889
+ 'account/amm/balance': 40,
102890
+ 'account/investment/balance': 40,
102891
+ 'account/balance/history': 40,
102892
+ 'account/market/fee': 40,
102893
+ 'balance/coin/deposit': 40,
102894
+ 'balance/coin/withdraw': 40,
102895
+ 'balance/info': 40,
102896
+ 'balance/deposit/address/{coin_type}': 40,
102897
+ 'contract/transfer/history': 40,
102898
+ 'credit/info': 40,
102899
+ 'credit/balance': 40,
102900
+ 'investment/transfer/history': 40,
102901
+ 'margin/account': 1,
102902
+ 'margin/config': 1,
102903
+ 'margin/loan/history': 40,
102904
+ 'margin/transfer/history': 40,
102905
+ 'order/deals': 40,
102906
+ 'order/finished': 40,
102907
+ 'order/pending': 8,
102908
+ 'order/status': 8,
102909
+ 'order/status/batch': 8,
102910
+ 'order/user/deals': 40,
102911
+ 'order/stop/finished': 40,
102912
+ 'order/stop/pending': 8,
102913
+ 'order/user/trade/fee': 1,
102914
+ 'order/market/trade/info': 1,
102915
+ 'sub_account/balance': 1,
102916
+ 'sub_account/transfer/history': 40,
102917
+ 'sub_account/auth/api': 40,
102918
+ 'sub_account/auth/api/{user_auth_id}': 40,
102919
+ },
102920
+ 'post': {
102921
+ 'balance/coin/withdraw': 40,
102922
+ 'contract/balance/transfer': 40,
102923
+ 'margin/flat': 40,
102924
+ 'margin/loan': 40,
102925
+ 'margin/transfer': 40,
102926
+ 'order/limit/batch': 40,
102927
+ 'order/ioc': 13.334,
102928
+ 'order/limit': 13.334,
102929
+ 'order/market': 13.334,
102930
+ 'order/modify': 13.334,
102931
+ 'order/stop/limit': 13.334,
102932
+ 'order/stop/market': 13.334,
102933
+ 'order/stop/modify': 13.334,
102934
+ 'sub_account/transfer': 40,
102935
+ 'sub_account/register': 1,
102936
+ 'sub_account/unfrozen': 40,
102937
+ 'sub_account/frozen': 40,
102938
+ 'sub_account/auth/api': 40,
102939
+ },
102940
+ 'put': {
102941
+ 'balance/deposit/address/{coin_type}': 40,
102942
+ 'sub_account/unfrozen': 40,
102943
+ 'sub_account/frozen': 40,
102944
+ 'sub_account/auth/api/{user_auth_id}': 40,
102945
+ 'v1/account/settings': 40,
102946
+ },
102947
+ 'delete': {
102948
+ 'balance/coin/withdraw': 40,
102949
+ 'order/pending/batch': 40,
102950
+ 'order/pending': 13.334,
102951
+ 'order/stop/pending': 40,
102952
+ 'order/stop/pending/{id}': 13.334,
102953
+ 'order/pending/by_client_id': 40,
102954
+ 'order/stop/pending/by_client_id': 40,
102955
+ 'sub_account/auth/api/{user_auth_id}': 40,
102956
+ 'sub_account/authorize/{id}': 40,
102957
+ },
102810
102958
  },
102811
- 'delete': {
102812
- 'balance/coin/withdraw': 40,
102813
- 'order/pending/batch': 40,
102814
- 'order/pending': 13.334,
102815
- 'order/stop/pending': 40,
102816
- 'order/stop/pending/{id}': 13.334,
102817
- 'order/pending/by_client_id': 40,
102818
- 'order/stop/pending/by_client_id': 40,
102819
- 'sub_account/auth/api/{user_auth_id}': 40,
102820
- 'sub_account/authorize/{id}': 40,
102959
+ 'perpetualPublic': {
102960
+ 'get': {
102961
+ 'ping': 1,
102962
+ 'time': 1,
102963
+ 'market/list': 1,
102964
+ 'market/limit_config': 1,
102965
+ 'market/ticker': 1,
102966
+ 'market/ticker/all': 1,
102967
+ 'market/depth': 1,
102968
+ 'market/deals': 1,
102969
+ 'market/funding_history': 1,
102970
+ 'market/kline': 1,
102971
+ },
102821
102972
  },
102822
- },
102823
- 'perpetualPublic': {
102824
- 'get': {
102825
- 'ping': 1,
102826
- 'time': 1,
102827
- 'market/list': 1,
102828
- 'market/limit_config': 1,
102829
- 'market/ticker': 1,
102830
- 'market/ticker/all': 1,
102831
- 'market/depth': 1,
102832
- 'market/deals': 1,
102833
- 'market/funding_history': 1,
102834
- 'market/kline': 1,
102973
+ 'perpetualPrivate': {
102974
+ 'get': {
102975
+ 'market/user_deals': 1,
102976
+ 'asset/query': 40,
102977
+ 'order/pending': 8,
102978
+ 'order/finished': 40,
102979
+ 'order/stop_finished': 40,
102980
+ 'order/stop_pending': 8,
102981
+ 'order/status': 8,
102982
+ 'order/stop_status': 8,
102983
+ 'position/finished': 40,
102984
+ 'position/pending': 40,
102985
+ 'position/funding': 40,
102986
+ 'position/adl_history': 40,
102987
+ 'market/preference': 40,
102988
+ 'position/margin_history': 40,
102989
+ 'position/settle_history': 40,
102990
+ },
102991
+ 'post': {
102992
+ 'market/adjust_leverage': 1,
102993
+ 'market/position_expect': 1,
102994
+ 'order/put_limit': 20,
102995
+ 'order/put_market': 20,
102996
+ 'order/put_stop_limit': 20,
102997
+ 'order/put_stop_market': 20,
102998
+ 'order/modify': 20,
102999
+ 'order/modify_stop': 20,
103000
+ 'order/cancel': 20,
103001
+ 'order/cancel_all': 40,
103002
+ 'order/cancel_batch': 40,
103003
+ 'order/cancel_stop': 20,
103004
+ 'order/cancel_stop_all': 40,
103005
+ 'order/close_limit': 20,
103006
+ 'order/close_market': 20,
103007
+ 'position/adjust_margin': 20,
103008
+ 'position/stop_loss': 20,
103009
+ 'position/take_profit': 20,
103010
+ 'position/market_close': 20,
103011
+ 'order/cancel/by_client_id': 20,
103012
+ 'order/cancel_stop/by_client_id': 20,
103013
+ 'market/preference': 20,
103014
+ },
102835
103015
  },
102836
103016
  },
102837
- 'perpetualPrivate': {
102838
- 'get': {
102839
- 'market/user_deals': 1,
102840
- 'asset/query': 40,
102841
- 'order/pending': 8,
102842
- 'order/finished': 40,
102843
- 'order/stop_finished': 40,
102844
- 'order/stop_pending': 8,
102845
- 'order/status': 8,
102846
- 'order/stop_status': 8,
102847
- 'position/finished': 40,
102848
- 'position/pending': 40,
102849
- 'position/funding': 40,
102850
- 'position/adl_history': 40,
102851
- 'market/preference': 40,
102852
- 'position/margin_history': 40,
102853
- 'position/settle_history': 40,
103017
+ 'v2': {
103018
+ 'public': {
103019
+ 'get': {
103020
+ 'maintain-info': 1,
103021
+ 'ping': 1,
103022
+ 'time': 1,
103023
+ 'spot/market': 1,
103024
+ 'spot/ticker': 1,
103025
+ 'spot/depth': 1,
103026
+ 'spot/deals': 1,
103027
+ 'spot/kline': 1,
103028
+ 'spot/index': 1,
103029
+ 'futures/market': 1,
103030
+ 'futures/ticker': 1,
103031
+ 'futures/depth': 1,
103032
+ 'futures/deals': 1,
103033
+ 'futures/kline': 1,
103034
+ 'futures/index': 1,
103035
+ 'futures/funding-rate': 1,
103036
+ 'futures/funding-rate-history': 1,
103037
+ 'futures/position-level': 1,
103038
+ 'futures/liquidation-history': 1,
103039
+ 'futures/basis-history': 1,
103040
+ },
102854
103041
  },
102855
- 'post': {
102856
- 'market/adjust_leverage': 1,
102857
- 'market/position_expect': 1,
102858
- 'order/put_limit': 20,
102859
- 'order/put_market': 20,
102860
- 'order/put_stop_limit': 20,
102861
- 'order/put_stop_market': 20,
102862
- 'order/modify': 20,
102863
- 'order/modify_stop': 20,
102864
- 'order/cancel': 20,
102865
- 'order/cancel_all': 40,
102866
- 'order/cancel_batch': 40,
102867
- 'order/cancel_stop': 20,
102868
- 'order/cancel_stop_all': 40,
102869
- 'order/close_limit': 20,
102870
- 'order/close_market': 20,
102871
- 'position/adjust_margin': 20,
102872
- 'position/stop_loss': 20,
102873
- 'position/take_profit': 20,
102874
- 'position/market_close': 20,
102875
- 'order/cancel/by_client_id': 20,
102876
- 'order/cancel_stop/by_client_id': 20,
102877
- 'market/preference': 20,
103042
+ 'private': {
103043
+ 'get': {
103044
+ 'account/subs': 1,
103045
+ 'account/subs/api-detail': 40,
103046
+ 'account/subs/info': 1,
103047
+ 'account/subs/api': 40,
103048
+ 'account/subs/transfer-history': 40,
103049
+ 'account/subs/spot-balance': 1,
103050
+ 'account/trade-fee-rate': 40,
103051
+ 'assets/spot/balance': 40,
103052
+ 'assets/futures/balance': 40,
103053
+ 'assets/margin/balance': 1,
103054
+ 'assets/financial/balance': 40,
103055
+ 'assets/amm/liquidity': 40,
103056
+ 'assets/credit/info': 40,
103057
+ 'assets/margin/borrow-history': 40,
103058
+ 'assets/margin/interest-limit': 1,
103059
+ 'assets/deposit-address': 40,
103060
+ 'assets/deposit-history': 40,
103061
+ 'assets/withdraw': 40,
103062
+ 'assets/deposit-withdraw-config': 1,
103063
+ 'assets/transfer-history': 40,
103064
+ 'spot/order-status': 8,
103065
+ 'spot/batch-order-status': 8,
103066
+ 'spot/pending-order': 8,
103067
+ 'spot/finished-order': 40,
103068
+ 'spot/pending-stop-order': 8,
103069
+ 'spot/finished-stop-order': 40,
103070
+ 'spot/user-deals': 40,
103071
+ 'spot/order-deals': 40,
103072
+ 'futures/order-status': 8,
103073
+ 'futures/batch-order-status': 1,
103074
+ 'futures/pending-order': 8,
103075
+ 'futures/finished-order': 40,
103076
+ 'futures/pending-stop-order': 8,
103077
+ 'futures/finished-stop-order': 40,
103078
+ 'futures/user-deals': 1,
103079
+ 'futures/order-deals': 1,
103080
+ 'futures/pending-position': 40,
103081
+ 'futures/finished-position': 1,
103082
+ 'futures/position-margin-history': 1,
103083
+ 'futures/position-funding-history': 40,
103084
+ 'futures/position-adl-history': 1,
103085
+ 'futures/position-settle-history': 1,
103086
+ },
103087
+ 'post': {
103088
+ 'account/subs': 40,
103089
+ 'account/subs/frozen': 40,
103090
+ 'account/subs/unfrozen': 40,
103091
+ 'account/subs/api': 40,
103092
+ 'account/subs/edit-api': 40,
103093
+ 'account/subs/delete-api': 40,
103094
+ 'account/subs/transfer': 40,
103095
+ 'account/settings': 40,
103096
+ 'assets/margin/borrow': 40,
103097
+ 'assets/margin/repay': 40,
103098
+ 'assets/renewal-deposit-address': 40,
103099
+ 'assets/withdraw': 40,
103100
+ 'assets/cancel-withdraw': 40,
103101
+ 'assets/transfer': 40,
103102
+ 'assets/amm/add-liquidity': 1,
103103
+ 'assets/amm/remove-liquidity': 1,
103104
+ 'spot/order': 13.334,
103105
+ 'spot/stop-order': 13.334,
103106
+ 'spot/batch-order': 40,
103107
+ 'spot/batch-stop-order': 1,
103108
+ 'spot/modify-order': 13.334,
103109
+ 'spot/modify-stop-order': 13.334,
103110
+ 'spot/cancel-all-order': 1,
103111
+ 'spot/cancel-order': 6.667,
103112
+ 'spot/cancel-stop-order': 6.667,
103113
+ 'spot/cancel-batch-order': 10,
103114
+ 'spot/cancel-batch-stop-order': 10,
103115
+ 'spot/cancel-order-by-client-id': 1,
103116
+ 'spot/cancel-stop-order-by-client-id': 1,
103117
+ 'futures/order': 20,
103118
+ 'futures/stop-order': 20,
103119
+ 'futures/batch-order': 1,
103120
+ 'futures/batch-stop-order': 1,
103121
+ 'futures/modify-order': 20,
103122
+ 'futures/modify-stop-order': 20,
103123
+ 'futures/cancel-all-order': 1,
103124
+ 'futures/cancel-order': 10,
103125
+ 'futures/cancel-stop-order': 10,
103126
+ 'futures/cancel-batch-order': 20,
103127
+ 'futures/cancel-batch-stop-order': 20,
103128
+ 'futures/cancel-order-by-client-id': 1,
103129
+ 'futures/cancel-stop-order-by-client-id': 1,
103130
+ 'futures/close-position': 20,
103131
+ 'futures/adjust-position-margin': 20,
103132
+ 'futures/adjust-position-leverage': 20,
103133
+ 'futures/set-position-stop-loss': 20,
103134
+ 'futures/set-position-take-profit': 20,
103135
+ },
102878
103136
  },
102879
103137
  },
102880
103138
  },
@@ -102945,7 +103203,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
102945
103203
  });
102946
103204
  }
102947
103205
  async fetchCurrencies(params = {}) {
102948
- const response = await this.publicGetCommonAssetConfig(params);
103206
+ const response = await this.v1PublicGetCommonAssetConfig(params);
102949
103207
  // {
102950
103208
  // "code": 0,
102951
103209
  // "data": {
@@ -103093,7 +103351,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
103093
103351
  return this.arrayConcat(spotMarkets, swapMarkets);
103094
103352
  }
103095
103353
  async fetchSpotMarkets(params) {
103096
- const response = await this.publicGetMarketInfo(params);
103354
+ const response = await this.v1PublicGetMarketInfo(params);
103097
103355
  //
103098
103356
  // {
103099
103357
  // "code": 0,
@@ -103182,7 +103440,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
103182
103440
  return result;
103183
103441
  }
103184
103442
  async fetchContractMarkets(params) {
103185
- const response = await this.perpetualPublicGetMarketList(params);
103443
+ const response = await this.v1PerpetualPublicGetMarketList(params);
103186
103444
  //
103187
103445
  // {
103188
103446
  // "code": 0,
@@ -103364,10 +103622,10 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
103364
103622
  };
103365
103623
  let response = undefined;
103366
103624
  if (market['swap']) {
103367
- response = await this.perpetualPublicGetMarketTicker(this.extend(request, params));
103625
+ response = await this.v1PerpetualPublicGetMarketTicker(this.extend(request, params));
103368
103626
  }
103369
103627
  else {
103370
- response = await this.publicGetMarketTicker(this.extend(request, params));
103628
+ response = await this.v1PublicGetMarketTicker(this.extend(request, params));
103371
103629
  }
103372
103630
  //
103373
103631
  // Spot
@@ -103446,10 +103704,10 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
103446
103704
  const [marketType, query] = this.handleMarketTypeAndParams('fetchTickers', market, params);
103447
103705
  let response = undefined;
103448
103706
  if (marketType === 'swap') {
103449
- response = await this.perpetualPublicGetMarketTickerAll(query);
103707
+ response = await this.v1PerpetualPublicGetMarketTickerAll(query);
103450
103708
  }
103451
103709
  else {
103452
- response = await this.publicGetMarketTickerAll();
103710
+ response = await this.v1PublicGetMarketTickerAll();
103453
103711
  }
103454
103712
  //
103455
103713
  // Spot
@@ -103532,19 +103790,22 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
103532
103790
  * @method
103533
103791
  * @name coinex#fetchTime
103534
103792
  * @description fetches the current integer timestamp in milliseconds from the exchange server
103535
- * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http005_system_time
103793
+ * @see https://docs.coinex.com/api/v2/common/http/time
103536
103794
  * @param {object} [params] extra parameters specific to the exchange API endpoint
103537
103795
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
103538
103796
  */
103539
- const response = await this.perpetualPublicGetTime(params);
103797
+ const response = await this.v2PublicGetTime(params);
103540
103798
  //
103541
103799
  // {
103542
- // "code": "0",
103543
- // "data": "1653261274414",
103800
+ // "code": 0,
103801
+ // "data": {
103802
+ // "timestamp": 1711699867777
103803
+ // },
103544
103804
  // "message": "OK"
103545
103805
  // }
103546
103806
  //
103547
- return this.safeInteger(response, 'data');
103807
+ const data = this.safeDict(response, 'data', {});
103808
+ return this.safeInteger(data, 'timestamp');
103548
103809
  }
103549
103810
  async fetchOrderBook(symbol, limit = 20, params = {}) {
103550
103811
  /**
@@ -103570,10 +103831,10 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
103570
103831
  };
103571
103832
  let response = undefined;
103572
103833
  if (market['swap']) {
103573
- response = await this.perpetualPublicGetMarketDepth(this.extend(request, params));
103834
+ response = await this.v1PerpetualPublicGetMarketDepth(this.extend(request, params));
103574
103835
  }
103575
103836
  else {
103576
- response = await this.publicGetMarketDepth(this.extend(request, params));
103837
+ response = await this.v1PublicGetMarketDepth(this.extend(request, params));
103577
103838
  }
103578
103839
  //
103579
103840
  // Spot
@@ -103774,10 +104035,10 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
103774
104035
  }
103775
104036
  let response = undefined;
103776
104037
  if (market['swap']) {
103777
- response = await this.perpetualPublicGetMarketDeals(this.extend(request, params));
104038
+ response = await this.v1PerpetualPublicGetMarketDeals(this.extend(request, params));
103778
104039
  }
103779
104040
  else {
103780
- response = await this.publicGetMarketDeals(this.extend(request, params));
104041
+ response = await this.v1PublicGetMarketDeals(this.extend(request, params));
103781
104042
  }
103782
104043
  //
103783
104044
  // Spot and Swap
@@ -103804,7 +104065,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
103804
104065
  * @method
103805
104066
  * @name coinex#fetchTradingFee
103806
104067
  * @description fetch the trading fees for a market
103807
- * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market003_single_market_info
104068
+ * @see https://docs.coinex.com/api/v2/spot/market/http/list-market
104069
+ * @see https://docs.coinex.com/api/v2/futures/market/http/list-market
103808
104070
  * @param {string} symbol unified market symbol
103809
104071
  * @param {object} [params] extra parameters specific to the exchange API endpoint
103810
104072
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -103814,67 +104076,132 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
103814
104076
  const request = {
103815
104077
  'market': market['id'],
103816
104078
  };
103817
- const response = await this.publicGetMarketDetail(this.extend(request, params));
103818
- //
103819
- // {
103820
- // "code": 0,
103821
- // "data": {
103822
- // "name": "BTCUSDC",
103823
- // "min_amount": "0.0005",
103824
- // "maker_fee_rate": "0.002",
103825
- // "taker_fee_rate": "0.002",
103826
- // "pricing_name": "USDC",
103827
- // "pricing_decimal": 2,
103828
- // "trading_name": "BTC",
103829
- // "trading_decimal": 8
103830
- // },
103831
- // "message": "OK"
103832
- // }
103833
- //
103834
- const data = this.safeValue(response, 'data', {});
103835
- return this.parseTradingFee(data, market);
104079
+ let response = undefined;
104080
+ if (market['spot']) {
104081
+ response = await this.v2PublicGetSpotMarket(this.extend(request, params));
104082
+ //
104083
+ // {
104084
+ // "code": 0,
104085
+ // "data": [
104086
+ // {
104087
+ // "base_ccy": "BTC",
104088
+ // "base_ccy_precision": 8,
104089
+ // "is_amm_available": false,
104090
+ // "is_margin_available": true,
104091
+ // "maker_fee_rate": "0.002",
104092
+ // "market": "BTCUSDT",
104093
+ // "min_amount": "0.0001",
104094
+ // "quote_ccy": "USDT",
104095
+ // "quote_ccy_precision": 2,
104096
+ // "taker_fee_rate": "0.002"
104097
+ // }
104098
+ // ],
104099
+ // "message": "OK"
104100
+ // }
104101
+ //
104102
+ }
104103
+ else {
104104
+ response = await this.v2PublicGetFuturesMarket(this.extend(request, params));
104105
+ //
104106
+ // {
104107
+ // "code": 0,
104108
+ // "data": [
104109
+ // {
104110
+ // "base_ccy": "BTC",
104111
+ // "base_ccy_precision": 8,
104112
+ // "contract_type": "linear",
104113
+ // "leverage": ["1","2","3","5","8","10","15","20","30","50","100"],
104114
+ // "maker_fee_rate": "0",
104115
+ // "market": "BTCUSDT",
104116
+ // "min_amount": "0.0001",
104117
+ // "open_interest_volume": "185.7498",
104118
+ // "quote_ccy": "USDT",
104119
+ // "quote_ccy_precision": 2,
104120
+ // "taker_fee_rate": "0"
104121
+ // }
104122
+ // ],
104123
+ // "message": "OK"
104124
+ // }
104125
+ //
104126
+ }
104127
+ const data = this.safeList(response, 'data', []);
104128
+ const result = this.safeDict(data, 0, {});
104129
+ return this.parseTradingFee(result, market);
103836
104130
  }
103837
104131
  async fetchTradingFees(params = {}) {
103838
104132
  /**
103839
104133
  * @method
103840
104134
  * @name coinex#fetchTradingFees
103841
104135
  * @description fetch the trading fees for multiple markets
103842
- * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market002_all_market_info
104136
+ * @see https://docs.coinex.com/api/v2/spot/market/http/list-market
104137
+ * @see https://docs.coinex.com/api/v2/futures/market/http/list-market
103843
104138
  * @param {object} [params] extra parameters specific to the exchange API endpoint
103844
104139
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
103845
104140
  */
103846
104141
  await this.loadMarkets();
103847
- const response = await this.publicGetMarketInfo(params);
103848
- //
103849
- // {
103850
- // "code": 0,
103851
- // "data": {
103852
- // "WAVESBTC": {
103853
- // "name": "WAVESBTC",
103854
- // "min_amount": "1",
103855
- // "maker_fee_rate": "0.001",
103856
- // "taker_fee_rate": "0.001",
103857
- // "pricing_name": "BTC",
103858
- // "pricing_decimal": 8,
103859
- // "trading_name": "WAVES",
103860
- // "trading_decimal": 8
103861
- // }
103862
- // ...
103863
- // }
103864
- // }
103865
- //
103866
- const data = this.safeValue(response, 'data', {});
104142
+ let type = undefined;
104143
+ [type, params] = this.handleMarketTypeAndParams('fetchTradingFees', undefined, params);
104144
+ let response = undefined;
104145
+ if (type === 'swap') {
104146
+ response = await this.v2PublicGetFuturesMarket(params);
104147
+ //
104148
+ // {
104149
+ // "code": 0,
104150
+ // "data": [
104151
+ // {
104152
+ // "base_ccy": "BTC",
104153
+ // "base_ccy_precision": 8,
104154
+ // "contract_type": "linear",
104155
+ // "leverage": ["1","2","3","5","8","10","15","20","30","50","100"],
104156
+ // "maker_fee_rate": "0",
104157
+ // "market": "BTCUSDT",
104158
+ // "min_amount": "0.0001",
104159
+ // "open_interest_volume": "185.7498",
104160
+ // "quote_ccy": "USDT",
104161
+ // "quote_ccy_precision": 2,
104162
+ // "taker_fee_rate": "0"
104163
+ // }
104164
+ // ],
104165
+ // "message": "OK"
104166
+ // }
104167
+ //
104168
+ }
104169
+ else {
104170
+ response = await this.v2PublicGetSpotMarket(params);
104171
+ //
104172
+ // {
104173
+ // "code": 0,
104174
+ // "data": [
104175
+ // {
104176
+ // "base_ccy": "BTC",
104177
+ // "base_ccy_precision": 8,
104178
+ // "is_amm_available": false,
104179
+ // "is_margin_available": true,
104180
+ // "maker_fee_rate": "0.002",
104181
+ // "market": "BTCUSDT",
104182
+ // "min_amount": "0.0001",
104183
+ // "quote_ccy": "USDT",
104184
+ // "quote_ccy_precision": 2,
104185
+ // "taker_fee_rate": "0.002"
104186
+ // },
104187
+ // ],
104188
+ // "message": "OK"
104189
+ // }
104190
+ //
104191
+ }
104192
+ const data = this.safeList(response, 'data', []);
103867
104193
  const result = {};
103868
- for (let i = 0; i < this.symbols.length; i++) {
103869
- const symbol = this.symbols[i];
103870
- const market = this.market(symbol);
103871
- const fee = this.safeValue(data, market['id'], {});
103872
- result[symbol] = this.parseTradingFee(fee, market);
104194
+ for (let i = 0; i < data.length; i++) {
104195
+ const entry = data[i];
104196
+ const marketId = this.safeString(entry, 'market');
104197
+ const market = this.safeMarket(marketId, undefined, undefined, type);
104198
+ const symbol = market['symbol'];
104199
+ result[symbol] = this.parseTradingFee(entry, market);
103873
104200
  }
103874
104201
  return result;
103875
104202
  }
103876
104203
  parseTradingFee(fee, market = undefined) {
103877
- const marketId = this.safeValue(fee, 'name');
104204
+ const marketId = this.safeValue(fee, 'market');
103878
104205
  const symbol = this.safeSymbol(marketId, market);
103879
104206
  return {
103880
104207
  'info': fee,
@@ -103932,10 +104259,10 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
103932
104259
  }
103933
104260
  let response = undefined;
103934
104261
  if (market['swap']) {
103935
- response = await this.perpetualPublicGetMarketKline(this.extend(request, params));
104262
+ response = await this.v1PerpetualPublicGetMarketKline(this.extend(request, params));
103936
104263
  }
103937
104264
  else {
103938
- response = await this.publicGetMarketKline(this.extend(request, params));
104265
+ response = await this.v1PublicGetMarketKline(this.extend(request, params));
103939
104266
  }
103940
104267
  //
103941
104268
  // Spot
@@ -103981,7 +104308,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
103981
104308
  const request = {
103982
104309
  'market': marketId,
103983
104310
  };
103984
- const response = await this.privateGetMarginAccount(this.extend(request, params));
104311
+ const response = await this.v1PrivateGetMarginAccount(this.extend(request, params));
103985
104312
  //
103986
104313
  // {
103987
104314
  // "code": 0,
@@ -104048,7 +104375,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
104048
104375
  }
104049
104376
  async fetchSpotBalance(params = {}) {
104050
104377
  await this.loadMarkets();
104051
- const response = await this.privateGetBalanceInfo(params);
104378
+ const response = await this.v1PrivateGetBalanceInfo(params);
104052
104379
  //
104053
104380
  // {
104054
104381
  // "code": 0,
@@ -104085,7 +104412,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
104085
104412
  }
104086
104413
  async fetchSwapBalance(params = {}) {
104087
104414
  await this.loadMarkets();
104088
- const response = await this.perpetualPrivateGetAssetQuery(params);
104415
+ const response = await this.v1PerpetualPrivateGetAssetQuery(params);
104089
104416
  //
104090
104417
  // {
104091
104418
  // "code": 0,
@@ -104119,7 +104446,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
104119
104446
  }
104120
104447
  async fetchFinancialBalance(params = {}) {
104121
104448
  await this.loadMarkets();
104122
- const response = await this.privateGetAccountInvestmentBalance(params);
104449
+ const response = await this.v1PrivateGetAccountInvestmentBalance(params);
104123
104450
  //
104124
104451
  // {
104125
104452
  // "code": 0,
@@ -104759,53 +105086,53 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
104759
105086
  if (market['spot']) {
104760
105087
  if (isTriggerOrder) {
104761
105088
  if (type === 'limit') {
104762
- response = await this.privatePostOrderStopLimit(request);
105089
+ response = await this.v1PrivatePostOrderStopLimit(request);
104763
105090
  }
104764
105091
  else {
104765
- response = await this.privatePostOrderStopMarket(request);
105092
+ response = await this.v1PrivatePostOrderStopMarket(request);
104766
105093
  }
104767
105094
  }
104768
105095
  else {
104769
105096
  if (type === 'limit') {
104770
- response = await this.privatePostOrderLimit(request);
105097
+ response = await this.v1PrivatePostOrderLimit(request);
104771
105098
  }
104772
105099
  else {
104773
- response = await this.privatePostOrderMarket(request);
105100
+ response = await this.v1PrivatePostOrderMarket(request);
104774
105101
  }
104775
105102
  }
104776
105103
  }
104777
105104
  else {
104778
105105
  if (isTriggerOrder) {
104779
105106
  if (type === 'limit') {
104780
- response = await this.perpetualPrivatePostOrderPutStopLimit(request);
105107
+ response = await this.v1PerpetualPrivatePostOrderPutStopLimit(request);
104781
105108
  }
104782
105109
  else {
104783
- response = await this.perpetualPrivatePostOrderPutStopMarket(request);
105110
+ response = await this.v1PerpetualPrivatePostOrderPutStopMarket(request);
104784
105111
  }
104785
105112
  }
104786
105113
  else if (isStopLossOrTakeProfitTrigger) {
104787
105114
  if (isStopLossTriggerOrder) {
104788
- response = await this.perpetualPrivatePostPositionStopLoss(request);
105115
+ response = await this.v1PerpetualPrivatePostPositionStopLoss(request);
104789
105116
  }
104790
105117
  else if (isTakeProfitTriggerOrder) {
104791
- response = await this.perpetualPrivatePostPositionTakeProfit(request);
105118
+ response = await this.v1PerpetualPrivatePostPositionTakeProfit(request);
104792
105119
  }
104793
105120
  }
104794
105121
  else {
104795
105122
  if (reduceOnly) {
104796
105123
  if (type === 'limit') {
104797
- response = await this.perpetualPrivatePostOrderCloseLimit(request);
105124
+ response = await this.v1PerpetualPrivatePostOrderCloseLimit(request);
104798
105125
  }
104799
105126
  else {
104800
- response = await this.perpetualPrivatePostOrderCloseMarket(request);
105127
+ response = await this.v1PerpetualPrivatePostOrderCloseMarket(request);
104801
105128
  }
104802
105129
  }
104803
105130
  else {
104804
105131
  if (type === 'limit') {
104805
- response = await this.perpetualPrivatePostOrderPutLimit(request);
105132
+ response = await this.v1PerpetualPrivatePostOrderPutLimit(request);
104806
105133
  }
104807
105134
  else {
104808
- response = await this.perpetualPrivatePostOrderPutMarket(request);
105135
+ response = await this.v1PerpetualPrivatePostOrderPutMarket(request);
104809
105136
  }
104810
105137
  }
104811
105138
  }
@@ -104933,7 +105260,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
104933
105260
  'market': market['id'],
104934
105261
  'batch_orders': this.json(ordersRequests),
104935
105262
  };
104936
- const response = await this.privatePostOrderLimitBatch(request);
105263
+ const response = await this.v1PrivatePostOrderLimitBatch(request);
104937
105264
  //
104938
105265
  // {
104939
105266
  // "code": 0,
@@ -105016,11 +105343,11 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
105016
105343
  let response = undefined;
105017
105344
  if (market['spot']) {
105018
105345
  request['batch_ids'] = idsString;
105019
- response = await this.privateDeleteOrderPendingBatch(this.extend(request, params));
105346
+ response = await this.v1PrivateDeleteOrderPendingBatch(this.extend(request, params));
105020
105347
  }
105021
105348
  else {
105022
105349
  request['order_ids'] = idsString;
105023
- response = await this.perpetualPrivatePostOrderCancelBatch(this.extend(request, params));
105350
+ response = await this.v1PerpetualPrivatePostOrderCancelBatch(this.extend(request, params));
105024
105351
  }
105025
105352
  //
105026
105353
  // spot
@@ -105157,7 +105484,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
105157
105484
  if (price !== undefined) {
105158
105485
  request['price'] = this.priceToPrecision(symbol, price);
105159
105486
  }
105160
- const response = await this.privatePostOrderModify(this.extend(request, params));
105487
+ const response = await this.v1PrivatePostOrderModify(this.extend(request, params));
105161
105488
  //
105162
105489
  // {
105163
105490
  // "code": 0,
@@ -105238,18 +105565,18 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
105238
105565
  request['client_id'] = clientOrderId;
105239
105566
  if (stop) {
105240
105567
  if (swap) {
105241
- response = await this.perpetualPrivatePostOrderCancelStopByClientId(this.extend(request, query));
105568
+ response = await this.v1PerpetualPrivatePostOrderCancelStopByClientId(this.extend(request, query));
105242
105569
  }
105243
105570
  else {
105244
- response = await this.privateDeleteOrderStopPendingByClientId(this.extend(request, query));
105571
+ response = await this.v1PrivateDeleteOrderStopPendingByClientId(this.extend(request, query));
105245
105572
  }
105246
105573
  }
105247
105574
  else {
105248
105575
  if (swap) {
105249
- response = await this.perpetualPrivatePostOrderCancelByClientId(this.extend(request, query));
105576
+ response = await this.v1PerpetualPrivatePostOrderCancelByClientId(this.extend(request, query));
105250
105577
  }
105251
105578
  else {
105252
- response = await this.privateDeleteOrderPendingByClientId(this.extend(request, query));
105579
+ response = await this.v1PrivateDeleteOrderPendingByClientId(this.extend(request, query));
105253
105580
  }
105254
105581
  }
105255
105582
  }
@@ -105258,18 +105585,18 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
105258
105585
  request[idRequest] = id;
105259
105586
  if (stop) {
105260
105587
  if (swap) {
105261
- response = await this.perpetualPrivatePostOrderCancelStop(this.extend(request, query));
105588
+ response = await this.v1PerpetualPrivatePostOrderCancelStop(this.extend(request, query));
105262
105589
  }
105263
105590
  else {
105264
- response = await this.privateDeleteOrderStopPendingId(this.extend(request, query));
105591
+ response = await this.v1PrivateDeleteOrderStopPendingId(this.extend(request, query));
105265
105592
  }
105266
105593
  }
105267
105594
  else {
105268
105595
  if (swap) {
105269
- response = await this.perpetualPrivatePostOrderCancel(this.extend(request, query));
105596
+ response = await this.v1PerpetualPrivatePostOrderCancel(this.extend(request, query));
105270
105597
  }
105271
105598
  else {
105272
- response = await this.privateDeleteOrderPending(this.extend(request, query));
105599
+ response = await this.v1PrivateDeleteOrderPending(this.extend(request, query));
105273
105600
  }
105274
105601
  }
105275
105602
  }
@@ -105413,19 +105740,19 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
105413
105740
  let response = undefined;
105414
105741
  if (swap) {
105415
105742
  if (stop) {
105416
- response = await this.perpetualPrivatePostOrderCancelStopAll(this.extend(request, params));
105743
+ response = await this.v1PerpetualPrivatePostOrderCancelStopAll(this.extend(request, params));
105417
105744
  }
105418
105745
  else {
105419
- response = await this.perpetualPrivatePostOrderCancelAll(this.extend(request, params));
105746
+ response = await this.v1PerpetualPrivatePostOrderCancelAll(this.extend(request, params));
105420
105747
  }
105421
105748
  }
105422
105749
  else {
105423
105750
  request['account_id'] = accountId;
105424
105751
  if (stop) {
105425
- response = await this.privateDeleteOrderStopPending(this.extend(request, params));
105752
+ response = await this.v1PrivateDeleteOrderStopPending(this.extend(request, params));
105426
105753
  }
105427
105754
  else {
105428
- response = await this.privateDeleteOrderPending(this.extend(request, params));
105755
+ response = await this.v1PrivateDeleteOrderPending(this.extend(request, params));
105429
105756
  }
105430
105757
  }
105431
105758
  //
@@ -105469,14 +105796,14 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
105469
105796
  let response = undefined;
105470
105797
  if (swap) {
105471
105798
  if (stop) {
105472
- response = await this.perpetualPrivateGetOrderStopStatus(this.extend(request, params));
105799
+ response = await this.v1PerpetualPrivateGetOrderStopStatus(this.extend(request, params));
105473
105800
  }
105474
105801
  else {
105475
- response = await this.perpetualPrivateGetOrderStatus(this.extend(request, params));
105802
+ response = await this.v1PerpetualPrivateGetOrderStatus(this.extend(request, params));
105476
105803
  }
105477
105804
  }
105478
105805
  else {
105479
- response = await this.privateGetOrderStatus(this.extend(request, params));
105806
+ response = await this.v1PrivateGetOrderStatus(this.extend(request, params));
105480
105807
  }
105481
105808
  //
105482
105809
  // Spot
@@ -105620,14 +105947,14 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
105620
105947
  }
105621
105948
  request['offset'] = 0;
105622
105949
  if (stop) {
105623
- response = await this.perpetualPrivateGetOrderStopPending(this.extend(request, params));
105950
+ response = await this.v1PerpetualPrivateGetOrderStopPending(this.extend(request, params));
105624
105951
  }
105625
105952
  else {
105626
105953
  if (status === 'finished') {
105627
- response = await this.perpetualPrivateGetOrderFinished(this.extend(request, params));
105954
+ response = await this.v1PerpetualPrivateGetOrderFinished(this.extend(request, params));
105628
105955
  }
105629
105956
  else if (status === 'pending') {
105630
- response = await this.perpetualPrivateGetOrderPending(this.extend(request, params));
105957
+ response = await this.v1PerpetualPrivateGetOrderPending(this.extend(request, params));
105631
105958
  }
105632
105959
  }
105633
105960
  }
@@ -105635,18 +105962,18 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
105635
105962
  request['page'] = 1;
105636
105963
  if (status === 'finished') {
105637
105964
  if (stop) {
105638
- response = await this.privateGetOrderStopFinished(this.extend(request, params));
105965
+ response = await this.v1PrivateGetOrderStopFinished(this.extend(request, params));
105639
105966
  }
105640
105967
  else {
105641
- response = await this.privateGetOrderFinished(this.extend(request, params));
105968
+ response = await this.v1PrivateGetOrderFinished(this.extend(request, params));
105642
105969
  }
105643
105970
  }
105644
105971
  else if (status === 'pending') {
105645
105972
  if (stop) {
105646
- response = await this.privateGetOrderStopPending(this.extend(request, params));
105973
+ response = await this.v1PrivateGetOrderStopPending(this.extend(request, params));
105647
105974
  }
105648
105975
  else {
105649
- response = await this.privateGetOrderPending(this.extend(request, params));
105976
+ response = await this.v1PrivateGetOrderPending(this.extend(request, params));
105650
105977
  }
105651
105978
  }
105652
105979
  }
@@ -105858,7 +106185,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
105858
106185
  params = this.omit(params, 'network');
105859
106186
  request['smart_contract_name'] = network;
105860
106187
  }
105861
- const response = await this.privatePutBalanceDepositAddressCoinType(this.extend(request, params));
106188
+ const response = await this.v1PrivatePutBalanceDepositAddressCoinType(this.extend(request, params));
105862
106189
  //
105863
106190
  // {
105864
106191
  // "code": 0,
@@ -105902,7 +106229,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
105902
106229
  if (network !== undefined) {
105903
106230
  request['smart_contract_name'] = network;
105904
106231
  }
105905
- const response = await this.privateGetBalanceDepositAddressCoinType(this.extend(request, params));
106232
+ const response = await this.v1PrivateGetBalanceDepositAddressCoinType(this.extend(request, params));
105906
106233
  //
105907
106234
  // {
105908
106235
  // "code": 0,
@@ -106018,11 +106345,11 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
106018
106345
  request['start_time'] = since;
106019
106346
  }
106020
106347
  request['side'] = 0;
106021
- response = await this.perpetualPrivateGetMarketUserDeals(this.extend(request, params));
106348
+ response = await this.v1PerpetualPrivateGetMarketUserDeals(this.extend(request, params));
106022
106349
  }
106023
106350
  else {
106024
106351
  request['page'] = 1;
106025
- response = await this.privateGetOrderUserDeals(this.extend(request, params));
106352
+ response = await this.v1PrivateGetOrderUserDeals(this.extend(request, params));
106026
106353
  }
106027
106354
  //
106028
106355
  // Spot and Margin
@@ -106116,8 +106443,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
106116
106443
  */
106117
106444
  await this.loadMarkets();
106118
106445
  let defaultMethod = undefined;
106119
- [defaultMethod, params] = this.handleOptionAndParams(params, 'fetchPositions', 'method', 'perpetualPrivateGetPositionPending');
106120
- const isHistory = (defaultMethod === 'perpetualPrivateGetPositionFinished');
106446
+ [defaultMethod, params] = this.handleOptionAndParams(params, 'fetchPositions', 'method', 'v1PerpetualPrivateGetPositionPending');
106447
+ const isHistory = (defaultMethod === 'v1PerpetualPrivateGetPositionFinished');
106121
106448
  symbols = this.marketSymbols(symbols);
106122
106449
  const request = {};
106123
106450
  let market = undefined;
@@ -106146,11 +106473,11 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
106146
106473
  request['side'] = this.safeInteger(params, 'side', 0); // 0: All, 1: Sell, 2: Buy
106147
106474
  }
106148
106475
  let response = undefined;
106149
- if (defaultMethod === 'perpetualPrivateGetPositionPending') {
106150
- response = await this.perpetualPrivateGetPositionPending(this.extend(request, params));
106476
+ if (defaultMethod === 'v1PerpetualPrivateGetPositionPending') {
106477
+ response = await this.v1PerpetualPrivateGetPositionPending(this.extend(request, params));
106151
106478
  }
106152
106479
  else {
106153
- response = await this.perpetualPrivateGetPositionFinished(this.extend(request, params));
106480
+ response = await this.v1PerpetualPrivateGetPositionFinished(this.extend(request, params));
106154
106481
  }
106155
106482
  //
106156
106483
  // {
@@ -106233,7 +106560,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
106233
106560
  const request = {
106234
106561
  'market': market['id'],
106235
106562
  };
106236
- const response = await this.perpetualPrivateGetPositionPending(this.extend(request, params));
106563
+ const response = await this.v1PerpetualPrivateGetPositionPending(this.extend(request, params));
106237
106564
  //
106238
106565
  // {
106239
106566
  // "code": 0,
@@ -106447,7 +106774,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
106447
106774
  'leverage': leverage.toString(),
106448
106775
  'position_type': positionType, // 1: isolated, 2: cross
106449
106776
  };
106450
- return await this.perpetualPrivatePostMarketAdjustLeverage(this.extend(request, params));
106777
+ return await this.v1PerpetualPrivatePostMarketAdjustLeverage(this.extend(request, params));
106451
106778
  }
106452
106779
  async setLeverage(leverage, symbol = undefined, params = {}) {
106453
106780
  /**
@@ -106488,7 +106815,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
106488
106815
  'leverage': leverage.toString(),
106489
106816
  'position_type': positionType, // 1: isolated, 2: cross
106490
106817
  };
106491
- return await this.perpetualPrivatePostMarketAdjustLeverage(this.extend(request, params));
106818
+ return await this.v1PerpetualPrivatePostMarketAdjustLeverage(this.extend(request, params));
106492
106819
  }
106493
106820
  async fetchLeverageTiers(symbols = undefined, params = {}) {
106494
106821
  /**
@@ -106501,7 +106828,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
106501
106828
  * @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
106502
106829
  */
106503
106830
  await this.loadMarkets();
106504
- const response = await this.perpetualPublicGetMarketLimitConfig(params);
106831
+ const response = await this.v1PerpetualPublicGetMarketLimitConfig(params);
106505
106832
  //
106506
106833
  // {
106507
106834
  // "code": 0,
@@ -106579,7 +106906,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
106579
106906
  'amount': this.amountToPrecision(symbol, amount),
106580
106907
  'type': addOrReduce,
106581
106908
  };
106582
- const response = await this.perpetualPrivatePostPositionAdjustMargin(this.extend(request, params));
106909
+ const response = await this.v1PerpetualPrivatePostPositionAdjustMargin(this.extend(request, params));
106583
106910
  //
106584
106911
  // {
106585
106912
  // "code": 0,
@@ -106646,13 +106973,72 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
106646
106973
  });
106647
106974
  }
106648
106975
  parseMarginModification(data, market = undefined) {
106976
+ //
106977
+ // addMargin/reduceMargin
106978
+ //
106979
+ // {
106980
+ // "adl_sort": 1,
106981
+ // "adl_sort_val": "0.00004320",
106982
+ // "amount": "0.0005",
106983
+ // "amount_max": "0.0005",
106984
+ // "amount_max_margin": "6.57352000000000000000",
106985
+ // "bkr_price": "16294.08000000000000011090",
106986
+ // "bkr_price_imply": "0.00000000000000000000",
106987
+ // "close_left": "0.0005",
106988
+ // "create_time": 1651202571.320778,
106989
+ // "deal_all": "19.72000000000000000000",
106990
+ // "deal_asset_fee": "0.00000000000000000000",
106991
+ // "fee_asset": "",
106992
+ // "finish_type": 1,
106993
+ // "first_price": "39441.12",
106994
+ // "insurance": "0.00000000000000000000",
106995
+ // "latest_price": "39441.12",
106996
+ // "leverage": "3",
106997
+ // "liq_amount": "0.00000000000000000000",
106998
+ // "liq_order_price": "0",
106999
+ // "liq_order_time": 0,
107000
+ // "liq_price": "16491.28560000000000011090",
107001
+ // "liq_price_imply": "0.00000000000000000000",
107002
+ // "liq_profit": "0.00000000000000000000",
107003
+ // "liq_time": 0,
107004
+ // "mainten_margin": "0.005",
107005
+ // "mainten_margin_amount": "0.09860280000000000000",
107006
+ // "maker_fee": "0.00000000000000000000",
107007
+ // "margin_amount": "11.57352000000000000000",
107008
+ // "market": "BTCUSDT",
107009
+ // "open_margin": "0.58687582908396110455",
107010
+ // "open_margin_imply": "0.00000000000000000000",
107011
+ // "open_price": "39441.12000000000000000000",
107012
+ // "open_val": "19.72056000000000000000",
107013
+ // "open_val_max": "19.72056000000000000000",
107014
+ // "position_id": 65171206,
107015
+ // "profit_clearing": "-0.00986028000000000000",
107016
+ // "profit_real": "-0.00986028000000000000",
107017
+ // "profit_unreal": "0.00",
107018
+ // "side": 2,
107019
+ // "stop_loss_price": "0.00000000000000000000",
107020
+ // "stop_loss_type": 0,
107021
+ // "sys": 0,
107022
+ // "take_profit_price": "0.00000000000000000000",
107023
+ // "take_profit_type": 0,
107024
+ // "taker_fee": "0.00000000000000000000",
107025
+ // "total": 3464,
107026
+ // "type": 1,
107027
+ // "update_time": 1651202638.911212,
107028
+ // "user_id": 3620173
107029
+ // }
107030
+ //
107031
+ const timestamp = this.safeIntegerProduct(data, 'update_time', 1000);
106649
107032
  return {
106650
107033
  'info': data,
107034
+ 'symbol': this.safeSymbol(undefined, market),
106651
107035
  'type': undefined,
106652
- 'amount': undefined,
107036
+ 'amount': this.safeNumber(data, 'margin_amount'),
107037
+ 'total': undefined,
106653
107038
  'code': market['quote'],
106654
- 'symbol': this.safeSymbol(undefined, market),
106655
107039
  'status': undefined,
107040
+ 'timestamp': timestamp,
107041
+ 'datetime': this.iso8601(timestamp),
106656
107042
  };
106657
107043
  }
106658
107044
  async addMargin(symbol, amount, params = {}) {
@@ -106709,7 +107095,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
106709
107095
  if (since !== undefined) {
106710
107096
  request['start_time'] = since;
106711
107097
  }
106712
- const response = await this.perpetualPrivateGetPositionFunding(this.extend(request, params));
107098
+ const response = await this.v1PerpetualPrivateGetPositionFunding(this.extend(request, params));
106713
107099
  //
106714
107100
  // {
106715
107101
  // "code": 0,
@@ -106775,7 +107161,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
106775
107161
  const request = {
106776
107162
  'market': market['id'],
106777
107163
  };
106778
- const response = await this.perpetualPublicGetMarketTicker(this.extend(request, params));
107164
+ const response = await this.v1PerpetualPublicGetMarketTicker(this.extend(request, params));
106779
107165
  //
106780
107166
  // {
106781
107167
  // "code": 0,
@@ -106886,7 +107272,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
106886
107272
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol(this.id + ' fetchFundingRates() supports swap contracts only');
106887
107273
  }
106888
107274
  }
106889
- const response = await this.perpetualPublicGetMarketTickerAll(params);
107275
+ const response = await this.v1PerpetualPublicGetMarketTickerAll(params);
106890
107276
  //
106891
107277
  // {
106892
107278
  // "code": 0,
@@ -106968,7 +107354,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
106968
107354
  if (networkCode !== undefined) {
106969
107355
  request['smart_contract_name'] = this.networkCodeToId(networkCode);
106970
107356
  }
106971
- const response = await this.privatePostBalanceCoinWithdraw(this.extend(request, params));
107357
+ const response = await this.v1PrivatePostBalanceCoinWithdraw(this.extend(request, params));
106972
107358
  //
106973
107359
  // {
106974
107360
  // "code": 0,
@@ -107040,7 +107426,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
107040
107426
  request['start_time'] = since;
107041
107427
  }
107042
107428
  [request, params] = this.handleUntilOption('end_time', request, params);
107043
- const response = await this.perpetualPublicGetMarketFundingHistory(this.extend(request, params));
107429
+ const response = await this.v1PerpetualPublicGetMarketFundingHistory(this.extend(request, params));
107044
107430
  //
107045
107431
  // {
107046
107432
  // "code": 0,
@@ -107217,11 +107603,11 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
107217
107603
  let response = undefined;
107218
107604
  if ((fromAccount === 'spot') && (toAccount === 'swap')) {
107219
107605
  request['transfer_side'] = 'in'; // 'in' spot to swap, 'out' swap to spot
107220
- response = await this.privatePostContractBalanceTransfer(this.extend(request, params));
107606
+ response = await this.v1PrivatePostContractBalanceTransfer(this.extend(request, params));
107221
107607
  }
107222
107608
  else if ((fromAccount === 'swap') && (toAccount === 'spot')) {
107223
107609
  request['transfer_side'] = 'out'; // 'in' spot to swap, 'out' swap to spot
107224
- response = await this.privatePostContractBalanceTransfer(this.extend(request, params));
107610
+ response = await this.v1PrivatePostContractBalanceTransfer(this.extend(request, params));
107225
107611
  }
107226
107612
  else {
107227
107613
  const accountsById = this.safeValue(this.options, 'accountsById', {});
@@ -107231,7 +107617,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
107231
107617
  // spot is 0, use fetchBalance() to find the margin account id
107232
107618
  request['from_account'] = parseInt(fromId);
107233
107619
  request['to_account'] = parseInt(toId);
107234
- response = await this.privatePostMarginTransfer(this.extend(request, params));
107620
+ response = await this.v1PrivatePostMarginTransfer(this.extend(request, params));
107235
107621
  }
107236
107622
  //
107237
107623
  // {"code": 0, "data": null, "message": "Success"}
@@ -107354,10 +107740,10 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
107354
107740
  [marginMode, params] = this.handleMarginModeAndParams('fetchTransfers', params);
107355
107741
  let response = undefined;
107356
107742
  if (marginMode !== undefined) {
107357
- response = await this.privateGetMarginTransferHistory(this.extend(request, params));
107743
+ response = await this.v1PrivateGetMarginTransferHistory(this.extend(request, params));
107358
107744
  }
107359
107745
  else {
107360
- response = await this.privateGetContractTransferHistory(this.extend(request, params));
107746
+ response = await this.v1PrivateGetContractTransferHistory(this.extend(request, params));
107361
107747
  }
107362
107748
  //
107363
107749
  // Swap
@@ -107429,7 +107815,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
107429
107815
  if (limit !== undefined) {
107430
107816
  request['Limit'] = limit;
107431
107817
  }
107432
- const response = await this.privateGetBalanceCoinWithdraw(this.extend(request, params));
107818
+ const response = await this.v1PrivateGetBalanceCoinWithdraw(this.extend(request, params));
107433
107819
  //
107434
107820
  // {
107435
107821
  // "code": 0,
@@ -107496,7 +107882,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
107496
107882
  if (limit !== undefined) {
107497
107883
  request['Limit'] = limit;
107498
107884
  }
107499
- const response = await this.privateGetBalanceCoinDeposit(this.extend(request, params));
107885
+ const response = await this.v1PrivateGetBalanceCoinDeposit(this.extend(request, params));
107500
107886
  //
107501
107887
  // {
107502
107888
  // "code": 0,
@@ -107589,7 +107975,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
107589
107975
  const request = {
107590
107976
  'market': market['id'],
107591
107977
  };
107592
- const response = await this.privateGetMarginConfig(this.extend(request, params));
107978
+ const response = await this.v1PrivateGetMarginConfig(this.extend(request, params));
107593
107979
  //
107594
107980
  // {
107595
107981
  // "code": 0,
@@ -107623,7 +108009,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
107623
108009
  * @returns {object} a list of [isolated borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
107624
108010
  */
107625
108011
  await this.loadMarkets();
107626
- const response = await this.privateGetMarginConfig(params);
108012
+ const response = await this.v1PrivateGetMarginConfig(params);
107627
108013
  //
107628
108014
  // {
107629
108015
  // "code": 0,
@@ -107664,7 +108050,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
107664
108050
  if (limit !== undefined) {
107665
108051
  request['limit'] = limit;
107666
108052
  }
107667
- const response = await this.privateGetMarginLoanHistory(this.extend(request, params));
108053
+ const response = await this.v1PrivateGetMarginLoanHistory(this.extend(request, params));
107668
108054
  //
107669
108055
  // {
107670
108056
  // "code": 0,
@@ -107760,7 +108146,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
107760
108146
  'coin_type': currency['id'],
107761
108147
  'amount': this.currencyToPrecision(code, amount),
107762
108148
  };
107763
- const response = await this.privatePostMarginLoan(this.extend(request, params));
108149
+ const response = await this.v1PrivatePostMarginLoan(this.extend(request, params));
107764
108150
  //
107765
108151
  // {
107766
108152
  // "code": 0,
@@ -107798,7 +108184,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
107798
108184
  'coin_type': currency['id'],
107799
108185
  'amount': this.currencyToPrecision(code, amount),
107800
108186
  };
107801
- const response = await this.privatePostMarginFlat(this.extend(request, params));
108187
+ const response = await this.v1PrivatePostMarginFlat(this.extend(request, params));
107802
108188
  //
107803
108189
  // {
107804
108190
  // "code": 0,
@@ -107856,7 +108242,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
107856
108242
  request['coin_type'] = this.safeValue(codes, 0);
107857
108243
  }
107858
108244
  }
107859
- const response = await this.publicGetCommonAssetConfig(this.extend(request, params));
108245
+ const response = await this.v1PublicGetCommonAssetConfig(this.extend(request, params));
107860
108246
  //
107861
108247
  // {
107862
108248
  // "code": 0,
@@ -107956,7 +108342,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
107956
108342
  if (marketType !== 'spot') {
107957
108343
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchLeverages() supports spot margin markets only');
107958
108344
  }
107959
- const response = await this.privateGetMarginConfig(params);
108345
+ const response = await this.v1PrivateGetMarginConfig(params);
107960
108346
  //
107961
108347
  // {
107962
108348
  // "code": 0,
@@ -108015,9 +108401,11 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
108015
108401
  nonce() {
108016
108402
  return this.milliseconds();
108017
108403
  }
108018
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
108404
+ sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
108019
108405
  path = this.implodeParams(path, params);
108020
- let url = this.urls['api'][api] + '/' + this.version + '/' + path;
108406
+ const version = api[0];
108407
+ const requestUrl = api[1];
108408
+ let url = this.urls['api'][requestUrl] + '/' + version + '/' + path;
108021
108409
  let query = this.omit(params, this.extractParams(path));
108022
108410
  const nonce = this.nonce().toString();
108023
108411
  if (method === 'POST') {
@@ -108046,7 +108434,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
108046
108434
  }
108047
108435
  }
108048
108436
  }
108049
- if (api === 'perpetualPrivate') {
108437
+ if (requestUrl === 'perpetualPrivate') {
108050
108438
  this.checkRequiredCredentials();
108051
108439
  query = this.extend({
108052
108440
  'access_id': this.apiKey,
@@ -108067,29 +108455,49 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
108067
108455
  body = urlencoded;
108068
108456
  }
108069
108457
  }
108070
- else if (api === 'public' || api === 'perpetualPublic') {
108458
+ else if (requestUrl === 'public' || requestUrl === 'perpetualPublic') {
108071
108459
  if (Object.keys(query).length) {
108072
108460
  url += '?' + this.urlencode(query);
108073
108461
  }
108074
108462
  }
108075
108463
  else {
108076
- this.checkRequiredCredentials();
108077
- query = this.extend({
108078
- 'access_id': this.apiKey,
108079
- 'tonce': nonce,
108080
- }, query);
108081
- query = this.keysort(query);
108082
- const urlencoded = this.rawencode(query);
108083
- const signature = this.hash(this.encode(urlencoded + '&secret_key=' + this.secret), _static_dependencies_noble_hashes_md5_js__WEBPACK_IMPORTED_MODULE_5__/* .md5 */ .F);
108084
- headers = {
108085
- 'Authorization': signature.toUpperCase(),
108086
- 'Content-Type': 'application/json',
108087
- };
108088
- if ((method === 'GET') || (method === 'DELETE') || (method === 'PUT')) {
108089
- url += '?' + urlencoded;
108464
+ if (version === 'v1') {
108465
+ this.checkRequiredCredentials();
108466
+ query = this.extend({
108467
+ 'access_id': this.apiKey,
108468
+ 'tonce': nonce,
108469
+ }, query);
108470
+ query = this.keysort(query);
108471
+ const urlencoded = this.rawencode(query);
108472
+ const signature = this.hash(this.encode(urlencoded + '&secret_key=' + this.secret), _static_dependencies_noble_hashes_md5_js__WEBPACK_IMPORTED_MODULE_5__/* .md5 */ .F);
108473
+ headers = {
108474
+ 'Authorization': signature.toUpperCase(),
108475
+ 'Content-Type': 'application/json',
108476
+ };
108477
+ if ((method === 'GET') || (method === 'DELETE') || (method === 'PUT')) {
108478
+ url += '?' + urlencoded;
108479
+ }
108480
+ else {
108481
+ body = this.json(query);
108482
+ }
108090
108483
  }
108091
- else {
108092
- body = this.json(query);
108484
+ else if (version === 'v2') {
108485
+ this.checkRequiredCredentials();
108486
+ query = this.keysort(query);
108487
+ const urlencoded = this.rawencode(query);
108488
+ const preparedString = method + '/' + version + '/' + path + '?' + urlencoded + nonce + this.secret;
108489
+ const signature = this.hash(this.encode(preparedString), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_4__/* .sha256 */ .J);
108490
+ headers = {
108491
+ 'X-COINEX-KEY': this.apiKey,
108492
+ 'X-COINEX-SIGN': signature,
108493
+ 'X-COINEX-TIMESTAMP': nonce,
108494
+ };
108495
+ if ((method === 'GET') || (method === 'DELETE') || (method === 'PUT')) {
108496
+ url += '?' + urlencoded;
108497
+ }
108498
+ else {
108499
+ body = this.json(query);
108500
+ }
108093
108501
  }
108094
108502
  }
108095
108503
  return { 'url': url, 'method': method, 'body': body, 'headers': headers };
@@ -121246,7 +121654,7 @@ class currencycom extends _abstract_currencycom_js__WEBPACK_IMPORTED_MODULE_0__/
121246
121654
  request['startTime'] = since;
121247
121655
  }
121248
121656
  if (limit !== undefined) {
121249
- request['limit'] = limit; // default 500, max 1000
121657
+ request['limit'] = Math.min(limit, 1000); // default 500, max 1000
121250
121658
  }
121251
121659
  const response = await this.publicGetV2Klines(this.extend(request, params));
121252
121660
  //
@@ -124981,12 +125389,14 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
124981
125389
  market = this.safeMarket(marketId, market);
124982
125390
  return {
124983
125391
  'info': data,
125392
+ 'symbol': market['symbol'],
124984
125393
  'type': undefined,
124985
125394
  'amount': undefined,
124986
125395
  'total': this.safeNumber(data, 'margin'),
124987
125396
  'code': undefined,
124988
- 'symbol': market['symbol'],
124989
125397
  'status': undefined,
125398
+ 'timestamp': undefined,
125399
+ 'datetime': undefined,
124990
125400
  };
124991
125401
  }
124992
125402
  async fetchOpenInterest(symbol, params = {}) {
@@ -130964,7 +131374,7 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
130964
131374
  request['instrument_id'] = market['id'];
130965
131375
  request['granularity'] = timeframe;
130966
131376
  if (limit !== undefined) {
130967
- request['limit'] = limit;
131377
+ request['limit'] = Math.min(limit, 100);
130968
131378
  }
130969
131379
  response = await this.publicSwapGetPublicCandles(this.extend(request, params));
130970
131380
  }
@@ -133617,12 +134027,14 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
133617
134027
  const rawType = this.safeInteger(data, 'type');
133618
134028
  return {
133619
134029
  'info': data,
134030
+ 'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
133620
134031
  'type': (rawType === 1) ? 'add' : 'reduce',
133621
134032
  'amount': this.safeNumber(data, 'amount'),
133622
134033
  'total': undefined,
133623
134034
  'code': market['settle'],
133624
- 'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
133625
134035
  'status': undefined,
134036
+ 'timestamp': undefined,
134037
+ 'datetime': undefined,
133626
134038
  };
133627
134039
  }
133628
134040
  async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -134071,12 +134483,14 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
134071
134483
  //
134072
134484
  return {
134073
134485
  'info': data,
134486
+ 'symbol': this.safeSymbol(undefined, market),
134074
134487
  'type': undefined,
134075
134488
  'amount': undefined,
134076
- 'code': this.safeValue(market, 'quote'),
134077
- 'symbol': this.safeSymbol(undefined, market),
134078
134489
  'total': undefined,
134490
+ 'code': this.safeValue(market, 'quote'),
134079
134491
  'status': 'ok',
134492
+ 'timestamp': undefined,
134493
+ 'datetime': undefined,
134080
134494
  };
134081
134495
  }
134082
134496
  async reduceMargin(symbol, amount, params = {}) {
@@ -134669,16 +135083,15 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
134669
135083
  'symbol': market['id'],
134670
135084
  'resolution': this.safeString(this.timeframes, timeframe, timeframe),
134671
135085
  };
134672
- const options = this.safeValue(this.options, 'fetchOHLCV');
134673
- const maxLimit = this.safeInteger(options, 'maxLimit', 3000);
135086
+ const maxLimit = 3000;
134674
135087
  const duration = this.parseTimeframe(timeframe);
134675
135088
  const now = this.milliseconds();
134676
135089
  if (since === undefined) {
134677
135090
  if (limit === undefined) {
134678
135091
  limit = 1000; // cap default at generous amount
134679
135092
  }
134680
- if (limit > maxLimit) {
134681
- limit = maxLimit; // avoid exception
135093
+ else {
135094
+ limit = Math.min(limit, maxLimit);
134682
135095
  }
134683
135096
  request['from'] = this.parseToInt(now / 1000) - limit * duration - 1;
134684
135097
  request['to'] = this.parseToInt(now / 1000);
@@ -134686,15 +135099,13 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
134686
135099
  else {
134687
135100
  request['from'] = this.parseToInt(since / 1000) - 1;
134688
135101
  if (limit === undefined) {
134689
- request['to'] = this.parseToInt(now / 1000);
135102
+ limit = maxLimit;
134690
135103
  }
134691
135104
  else {
134692
- if (limit > maxLimit) {
134693
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchOHLCV() will serve ' + maxLimit.toString() + ' candles at most');
134694
- }
134695
- const to = this.sum(since, limit * duration * 1000);
134696
- request['to'] = this.parseToInt(to / 1000);
135105
+ limit = Math.min(limit, maxLimit);
134697
135106
  }
135107
+ const to = this.sum(since, limit * duration * 1000);
135108
+ request['to'] = this.parseToInt(to / 1000);
134698
135109
  }
134699
135110
  const response = await this.publicGetCandlesHistory(this.extend(request, params));
134700
135111
  //
@@ -142641,11 +143052,14 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
142641
143052
  const total = this.safeNumber(data, 'margin');
142642
143053
  return {
142643
143054
  'info': data,
142644
- 'amount': undefined,
142645
- 'code': this.safeValue(market, 'quote'),
142646
143055
  'symbol': market['symbol'],
143056
+ 'type': undefined,
143057
+ 'amount': undefined,
142647
143058
  'total': total,
143059
+ 'code': this.safeValue(market, 'quote'),
142648
143060
  'status': 'ok',
143061
+ 'timestamp': undefined,
143062
+ 'datetime': undefined,
142649
143063
  };
142650
143064
  }
142651
143065
  async reduceMargin(symbol, amount, params = {}) {
@@ -147621,7 +148035,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
147621
148035
  }
147622
148036
  [request, params] = this.handleUntilOption('till', request, params);
147623
148037
  if (limit !== undefined) {
147624
- request['limit'] = limit;
148038
+ request['limit'] = Math.min(limit, 1000);
147625
148039
  }
147626
148040
  const price = this.safeString(params, 'price');
147627
148041
  params = this.omit(params, 'price');
@@ -149179,15 +149593,39 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
149179
149593
  });
149180
149594
  }
149181
149595
  parseMarginModification(data, market = undefined) {
149596
+ //
149597
+ // addMargin/reduceMargin
149598
+ //
149599
+ // {
149600
+ // "symbol": "BTCUSDT_PERP",
149601
+ // "type": "isolated",
149602
+ // "leverage": "8.00",
149603
+ // "created_at": "2022-03-30T23:34:27.161Z",
149604
+ // "updated_at": "2022-03-30T23:34:27.161Z",
149605
+ // "currencies": [
149606
+ // {
149607
+ // "code": "USDT",
149608
+ // "margin_balance": "7.000000000000",
149609
+ // "reserved_orders": "0",
149610
+ // "reserved_positions": "0"
149611
+ // }
149612
+ // ],
149613
+ // "positions": null
149614
+ // }
149615
+ //
149182
149616
  const currencies = this.safeValue(data, 'currencies', []);
149183
149617
  const currencyInfo = this.safeValue(currencies, 0);
149618
+ const datetime = this.safeString(data, 'updated_at');
149184
149619
  return {
149185
149620
  'info': data,
149621
+ 'symbol': market['symbol'],
149186
149622
  'type': undefined,
149187
149623
  'amount': undefined,
149624
+ 'total': undefined,
149188
149625
  'code': this.safeString(currencyInfo, 'code'),
149189
- 'symbol': market['symbol'],
149190
149626
  'status': undefined,
149627
+ 'timestamp': this.parse8601(datetime),
149628
+ 'datetime': datetime,
149191
149629
  };
149192
149630
  }
149193
149631
  async reduceMargin(symbol, amount, params = {}) {
@@ -154474,7 +154912,7 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
154474
154912
  const untilSeconds = (until !== undefined) ? this.parseToInt(until / 1000) : undefined;
154475
154913
  if (market['contract']) {
154476
154914
  if (limit !== undefined) {
154477
- request['size'] = limit; // when using limit: from & to are ignored
154915
+ request['size'] = Math.min(limit, 2000); // when using limit: from & to are ignored
154478
154916
  // https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-kline-data
154479
154917
  }
154480
154918
  else {
@@ -154566,7 +155004,7 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
154566
155004
  [useHistorical, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'useHistoricalEndpointForSpot', true);
154567
155005
  if (!useHistorical) {
154568
155006
  if (limit !== undefined) {
154569
- request['size'] = Math.min(2000, limit); // max 2000
155007
+ request['size'] = Math.min(limit, 2000); // max 2000
154570
155008
  }
154571
155009
  response = await this.spotPublicGetMarketHistoryKline(this.extend(request, params));
154572
155010
  }
@@ -161678,7 +162116,7 @@ class huobijp extends _abstract_huobijp_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
161678
162116
  'period': this.safeString(this.timeframes, timeframe, timeframe),
161679
162117
  };
161680
162118
  if (limit !== undefined) {
161681
- request['size'] = limit;
162119
+ request['size'] = Math.min(limit, 2000);
161682
162120
  }
161683
162121
  const response = await this.marketGetHistoryKline(this.extend(request, params));
161684
162122
  //
@@ -162682,7 +163120,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162682
163120
  'pro': true,
162683
163121
  'has': {
162684
163122
  'CORS': undefined,
162685
- 'spot': false,
163123
+ 'spot': true,
162686
163124
  'margin': false,
162687
163125
  'swap': true,
162688
163126
  'future': true,
@@ -162815,6 +163253,10 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162815
163253
  'taker': this.parseNumber('0.00035'),
162816
163254
  'maker': this.parseNumber('0.0001'),
162817
163255
  },
163256
+ 'spot': {
163257
+ 'taker': this.parseNumber('0.00035'),
163258
+ 'maker': this.parseNumber('0.0001'),
163259
+ },
162818
163260
  },
162819
163261
  'requiredCredentials': {
162820
163262
  'apiKey': false,
@@ -162840,6 +163282,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162840
163282
  'precisionMode': _base_functions_number_js__WEBPACK_IMPORTED_MODULE_2__/* .TICK_SIZE */ .sh,
162841
163283
  'commonCurrencies': {},
162842
163284
  'options': {
163285
+ 'defaultType': 'swap',
162843
163286
  'sandboxMode': false,
162844
163287
  'defaultSlippage': 0.05,
162845
163288
  'zeroAddress': '0x0000000000000000000000000000000000000000',
@@ -162910,6 +163353,24 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162910
163353
  * @param {object} [params] extra parameters specific to the exchange API endpoint
162911
163354
  * @returns {object[]} an array of objects representing market data
162912
163355
  */
163356
+ const rawPromises = [
163357
+ this.fetchSwapMarkets(params),
163358
+ this.fetchSpotMarkets(params),
163359
+ ];
163360
+ const promises = await Promise.all(rawPromises);
163361
+ const swapMarkets = promises[0];
163362
+ const spotMarkets = promises[1];
163363
+ return this.arrayConcat(swapMarkets, spotMarkets);
163364
+ }
163365
+ async fetchSwapMarkets(params = {}) {
163366
+ /**
163367
+ * @method
163368
+ * @name hyperliquid#fetchMarkets
163369
+ * @description retrieves data on all swap markets for hyperliquid
163370
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-asset-contexts-includes-mark-price-current-funding-open-interest-etc
163371
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
163372
+ * @returns {object[]} an array of objects representing market data
163373
+ */
162913
163374
  const request = {
162914
163375
  'type': 'metaAndAssetCtxs',
162915
163376
  };
@@ -162955,6 +163416,132 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162955
163416
  }
162956
163417
  return this.parseMarkets(result);
162957
163418
  }
163419
+ async fetchSpotMarkets(params = {}) {
163420
+ /**
163421
+ * @method
163422
+ * @name hyperliquid#fetchMarkets
163423
+ * @description retrieves data on all spot markets for hyperliquid
163424
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-asset-contexts-includes-mark-price-current-funding-open-interest-etc
163425
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
163426
+ * @returns {object[]} an array of objects representing market data
163427
+ */
163428
+ const request = {
163429
+ 'type': 'spotMetaAndAssetCtxs',
163430
+ };
163431
+ const response = await this.publicPostInfo(this.extend(request, params));
163432
+ //
163433
+ // [
163434
+ // {
163435
+ // 'tokens': [
163436
+ // {
163437
+ // 'name': 'USDC',
163438
+ // 'szDecimals': '8',
163439
+ // 'weiDecimals': '8',
163440
+ // },
163441
+ // {
163442
+ // 'name': 'PURR',
163443
+ // 'szDecimals': '0',
163444
+ // 'weiDecimals': '5',
163445
+ // },
163446
+ // ],
163447
+ // 'universe': [
163448
+ // {
163449
+ // 'name': 'PURR/USDC',
163450
+ // 'tokens': [
163451
+ // 1,
163452
+ // 0,
163453
+ // ],
163454
+ // },
163455
+ // ],
163456
+ // },
163457
+ // [
163458
+ // {
163459
+ // 'dayNtlVlm': '264250385.14640012',
163460
+ // 'markPx': '0.018314',
163461
+ // 'midPx': '0.0182235',
163462
+ // 'prevDayPx': '0.017427',
163463
+ // },
163464
+ // ],
163465
+ // ];
163466
+ //
163467
+ const first = this.safeDict(response, 0, {});
163468
+ const meta = this.safeList(first, 'universe', []);
163469
+ const tokens = this.safeList(first, 'tokens', []);
163470
+ const markets = [];
163471
+ for (let i = 0; i < meta.length; i++) {
163472
+ const market = this.safeDict(meta, i, {});
163473
+ const marketName = this.safeString(market, 'name');
163474
+ const marketParts = marketName.split('/');
163475
+ const baseName = this.safeString(marketParts, 0);
163476
+ const quoteId = this.safeString(marketParts, 1);
163477
+ const base = this.safeCurrencyCode(baseName);
163478
+ const quote = this.safeCurrencyCode(quoteId);
163479
+ const symbol = base + '/' + quote;
163480
+ const fees = this.safeDict(this.fees, 'spot', {});
163481
+ const taker = this.safeNumber(fees, 'taker');
163482
+ const maker = this.safeNumber(fees, 'maker');
163483
+ const tokensPos = this.safeList(market, 'tokens', []);
163484
+ const baseTokenPos = this.safeInteger(tokensPos, 0);
163485
+ const quoteTokenPos = this.safeInteger(tokensPos, 1);
163486
+ const baseTokenInfo = this.safeDict(tokens, baseTokenPos, {});
163487
+ const quoteTokenInfo = this.safeDict(tokens, quoteTokenPos, {});
163488
+ const baseDecimals = this.safeString(baseTokenInfo, 'szDecimals');
163489
+ const quoteDecimals = this.safeInteger(quoteTokenInfo, 'szDecimals');
163490
+ const baseId = this.numberToString(i + 10000);
163491
+ markets.push(this.safeMarketStructure({
163492
+ 'id': baseId,
163493
+ 'symbol': symbol,
163494
+ 'base': base,
163495
+ 'quote': quote,
163496
+ 'settle': undefined,
163497
+ 'baseId': baseId,
163498
+ 'quoteId': quoteId,
163499
+ 'settleId': undefined,
163500
+ 'type': 'spot',
163501
+ 'spot': true,
163502
+ 'margin': undefined,
163503
+ 'swap': false,
163504
+ 'future': false,
163505
+ 'option': false,
163506
+ 'active': true,
163507
+ 'contract': false,
163508
+ 'linear': true,
163509
+ 'inverse': false,
163510
+ 'taker': taker,
163511
+ 'maker': maker,
163512
+ 'contractSize': undefined,
163513
+ 'expiry': undefined,
163514
+ 'expiryDatetime': undefined,
163515
+ 'strike': undefined,
163516
+ 'optionType': undefined,
163517
+ 'precision': {
163518
+ 'amount': this.parseNumber(this.parsePrecision(baseDecimals)),
163519
+ 'price': quoteDecimals, // significant digits
163520
+ },
163521
+ 'limits': {
163522
+ 'leverage': {
163523
+ 'min': undefined,
163524
+ 'max': undefined,
163525
+ },
163526
+ 'amount': {
163527
+ 'min': undefined,
163528
+ 'max': undefined,
163529
+ },
163530
+ 'price': {
163531
+ 'min': undefined,
163532
+ 'max': undefined,
163533
+ },
163534
+ 'cost': {
163535
+ 'min': undefined,
163536
+ 'max': undefined,
163537
+ },
163538
+ },
163539
+ 'created': undefined,
163540
+ 'info': market,
163541
+ }));
163542
+ }
163543
+ return markets;
163544
+ }
162958
163545
  parseMarket(market) {
162959
163546
  //
162960
163547
  // {
@@ -163053,12 +163640,17 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163053
163640
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-state
163054
163641
  * @param {object} [params] extra parameters specific to the exchange API endpoint
163055
163642
  * @param {string} [params.user] user address, will default to this.walletAddress if not provided
163643
+ * @param {string} [params.type] wallet type, ['spot', 'swap'], defaults to swap
163056
163644
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
163057
163645
  */
163058
163646
  let userAddress = undefined;
163059
163647
  [userAddress, params] = this.handlePublicAddress('fetchBalance', params);
163648
+ let type = undefined;
163649
+ [type, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
163650
+ const isSpot = (type === 'spot');
163651
+ const reqType = (isSpot) ? 'spotClearinghouseState' : 'clearinghouseState';
163060
163652
  const request = {
163061
- 'type': 'clearinghouseState',
163653
+ 'type': reqType,
163062
163654
  'user': userAddress,
163063
163655
  };
163064
163656
  const response = await this.publicPostInfo(this.extend(request, params));
@@ -163081,7 +163673,37 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163081
163673
  // "time": "1704261007014",
163082
163674
  // "withdrawable": "100.0"
163083
163675
  // }
163676
+ // spot
163084
163677
  //
163678
+ // {
163679
+ // "balances":[
163680
+ // {
163681
+ // "coin":"USDC",
163682
+ // "hold":"0.0",
163683
+ // "total":"1481.844"
163684
+ // },
163685
+ // {
163686
+ // "coin":"PURR",
163687
+ // "hold":"0.0",
163688
+ // "total":"999.65004"
163689
+ // }
163690
+ // }
163691
+ //
163692
+ const balances = this.safeList(response, 'balances');
163693
+ if (balances !== undefined) {
163694
+ const spotBalances = { 'info': response };
163695
+ for (let i = 0; i < balances.length; i++) {
163696
+ const balance = balances[i];
163697
+ const code = this.safeCurrencyCode(this.safeString(balance, 'coin'));
163698
+ const account = this.account();
163699
+ const total = this.safeString(balance, 'total');
163700
+ const free = this.safeString(balance, 'hold');
163701
+ account['total'] = total;
163702
+ account['free'] = free;
163703
+ spotBalances[code] = account;
163704
+ }
163705
+ return this.safeBalance(spotBalances);
163706
+ }
163085
163707
  const data = this.safeDict(response, 'marginSummary', {});
163086
163708
  const result = {
163087
163709
  'info': response,
@@ -163607,6 +164229,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163607
164229
  * @param {string} symbol unified symbol of the market the order was made in
163608
164230
  * @param {object} [params] extra parameters specific to the exchange API endpoint
163609
164231
  * @param {string} [params.clientOrderId] client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
164232
+ * @param {string} [params.vaultAddress] the vault address for order
163610
164233
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
163611
164234
  */
163612
164235
  return await this.cancelOrders([id], symbol, params);
@@ -163622,6 +164245,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163622
164245
  * @param {string} [symbol] unified market symbol
163623
164246
  * @param {object} [params] extra parameters specific to the exchange API endpoint
163624
164247
  * @param {string|string[]} [params.clientOrderId] client order ids, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
164248
+ * @param {string} [params.vaultAddress] the vault address
163625
164249
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
163626
164250
  */
163627
164251
  this.checkRequiredCredentials();
@@ -164104,7 +164728,12 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
164104
164728
  const coin = this.safeString(entry, 'coin');
164105
164729
  let marketId = undefined;
164106
164730
  if (coin !== undefined) {
164107
- marketId = coin + '/USDC:USDC';
164731
+ if (coin.indexOf('/') > -1) {
164732
+ marketId = coin;
164733
+ }
164734
+ else {
164735
+ marketId = coin + '/USDC:USDC';
164736
+ }
164108
164737
  }
164109
164738
  if (this.safeString(entry, 'id') === undefined) {
164110
164739
  market = this.safeMarket(marketId, undefined);
@@ -164588,10 +165217,27 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
164588
165217
  // 'status': 'ok'
164589
165218
  // }
164590
165219
  //
164591
- return response;
164592
- // return this.extend (this.parseMarginModification (response, market), {
164593
- // 'code': code,
164594
- // });
165220
+ return this.extend(this.parseMarginModification(response, market), {
165221
+ 'code': this.safeString(response, 'status'),
165222
+ });
165223
+ }
165224
+ parseMarginModification(data, market = undefined) {
165225
+ //
165226
+ // {
165227
+ // 'type': 'default'
165228
+ // }
165229
+ //
165230
+ return {
165231
+ 'info': data,
165232
+ 'symbol': this.safeSymbol(undefined, market),
165233
+ 'type': undefined,
165234
+ 'amount': undefined,
165235
+ 'total': undefined,
165236
+ 'code': this.safeString(market, 'settle'),
165237
+ 'status': undefined,
165238
+ 'timestamp': undefined,
165239
+ 'datetime': undefined,
165240
+ };
164595
165241
  }
164596
165242
  async transfer(code, amount, fromAccount, toAccount, params = {}) {
164597
165243
  /**
@@ -164601,13 +165247,44 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
164601
165247
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#l1-usdc-transfer
164602
165248
  * @param {string} code unified currency code
164603
165249
  * @param {float} amount amount to transfer
164604
- * @param {string} fromAccount account to transfer from
164605
- * @param {string} toAccount account to transfer to
165250
+ * @param {string} fromAccount account to transfer from *spot, swap*
165251
+ * @param {string} toAccount account to transfer to *swap, spot or address*
164606
165252
  * @param {object} [params] extra parameters specific to the exchange API endpoint
165253
+ * @param {string} [params.vaultAddress] the vault address for order
164607
165254
  * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
164608
165255
  */
164609
165256
  this.checkRequiredCredentials();
164610
165257
  await this.loadMarkets();
165258
+ const isSandboxMode = this.safeBool(this.options, 'sandboxMode');
165259
+ const nonce = this.milliseconds();
165260
+ if (this.inArray(fromAccount, ['spot', 'swap', 'perp'])) {
165261
+ // handle swap <> spot account transfer
165262
+ if (!this.inArray(toAccount, ['spot', 'swap', 'perp'])) {
165263
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + 'transfer() only support spot <> swap transfer');
165264
+ }
165265
+ const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
165266
+ params = this.omit(params, 'vaultAddress');
165267
+ const toPerp = (toAccount === 'perp') || (toAccount === 'swap');
165268
+ const action = {
165269
+ 'type': 'spotUser',
165270
+ 'classTransfer': {
165271
+ 'usdc': amount,
165272
+ 'toPerp': toPerp,
165273
+ },
165274
+ };
165275
+ const signature = this.signL1Action(action, nonce, vaultAddress);
165276
+ const innerRequest = {
165277
+ 'action': this.extend(action, params),
165278
+ 'nonce': nonce,
165279
+ 'signature': signature,
165280
+ };
165281
+ if (vaultAddress !== undefined) {
165282
+ innerRequest['vaultAddress'] = vaultAddress;
165283
+ }
165284
+ const transferResponse = await this.privatePostExchange(innerRequest);
165285
+ return transferResponse;
165286
+ }
165287
+ // handle sub-account/different account transfer
164611
165288
  this.checkAddress(toAccount);
164612
165289
  if (code !== undefined) {
164613
165290
  code = code.toUpperCase();
@@ -164615,11 +165292,9 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
164615
165292
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + 'withdraw() only support USDC');
164616
165293
  }
164617
165294
  }
164618
- const isSandboxMode = this.safeBool(this.options, 'sandboxMode');
164619
- const nonce = this.milliseconds();
164620
165295
  const payload = {
164621
165296
  'destination': toAccount,
164622
- 'amount': amount.toString(),
165297
+ 'amount': this.numberToString(amount),
164623
165298
  'time': nonce,
164624
165299
  };
164625
165300
  const sig = this.buildTransferSig(payload);
@@ -164923,13 +165598,15 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
164923
165598
  'network': 'MATIC',
164924
165599
  },
164925
165600
  'exceptions': {
164926
- 'INVALID_ORDER_QUANTITY': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
164927
- 'INSUFFICIENT_FUNDS': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InsufficientFunds,
164928
- 'SERVICE_UNAVAILABLE': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable,
164929
- 'EXCEEDED_RATE_LIMIT': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.DDoSProtection,
164930
- 'INVALID_PARAMETER': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
164931
- 'WALLET_NOT_ASSOCIATED': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidAddress,
164932
- 'INVALID_WALLET_SIGNATURE': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError,
165601
+ 'exact': {
165602
+ 'INVALID_ORDER_QUANTITY': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
165603
+ 'INSUFFICIENT_FUNDS': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InsufficientFunds,
165604
+ 'SERVICE_UNAVAILABLE': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable,
165605
+ 'EXCEEDED_RATE_LIMIT': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.DDoSProtection,
165606
+ 'INVALID_PARAMETER': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
165607
+ 'WALLET_NOT_ASSOCIATED': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidAddress,
165608
+ 'INVALID_WALLET_SIGNATURE': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError,
165609
+ },
164933
165610
  },
164934
165611
  'requiredCredentials': {
164935
165612
  'walletAddress': true,
@@ -165222,7 +165899,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
165222
165899
  request['start'] = since;
165223
165900
  }
165224
165901
  if (limit !== undefined) {
165225
- request['limit'] = limit;
165902
+ request['limit'] = Math.min(limit, 1000);
165226
165903
  }
165227
165904
  const response = await this.publicGetCandles(this.extend(request, params));
165228
165905
  if (Array.isArray(response)) {
@@ -166255,11 +166932,8 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
166255
166932
  handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
166256
166933
  const errorCode = this.safeString(response, 'code');
166257
166934
  const message = this.safeString(response, 'message');
166258
- if (errorCode in this.exceptions) {
166259
- const Exception = this.exceptions[errorCode];
166260
- throw new Exception(this.id + ' ' + message);
166261
- }
166262
166935
  if (errorCode !== undefined) {
166936
+ this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, message);
166263
166937
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' ' + message);
166264
166938
  }
166265
166939
  return undefined;
@@ -172349,17 +173023,13 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
172349
173023
  if (limit === undefined) {
172350
173024
  limit = 5000;
172351
173025
  }
172352
- else if (limit > 5000) {
172353
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' fetchOHLCV() limit cannot exceed 5000');
172354
- }
173026
+ limit = Math.min(limit, 5000);
172355
173027
  const toTimestamp = this.sum(request['from'], limit * duration - 1);
172356
173028
  const currentTimestamp = this.seconds();
172357
173029
  request['to'] = Math.min(toTimestamp, currentTimestamp);
172358
173030
  }
172359
173031
  else if (limit !== undefined) {
172360
- if (limit > 5000) {
172361
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' fetchOHLCV() limit cannot exceed 5000');
172362
- }
173032
+ limit = Math.min(limit, 5000);
172363
173033
  const duration = this.parseTimeframe(timeframe);
172364
173034
  request['to'] = this.seconds();
172365
173035
  request['from'] = this.parseToInt(request['to'] - (duration * limit));
@@ -186567,6 +187237,9 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
186567
187237
  if (limit === undefined) {
186568
187238
  limit = 100;
186569
187239
  }
187240
+ else {
187241
+ limit = Math.min(limit, 2000);
187242
+ }
186570
187243
  if (since === undefined) {
186571
187244
  const duration = this.parseTimeframe(timeframe);
186572
187245
  since = this.milliseconds() - duration * 1000 * limit;
@@ -202255,7 +202928,7 @@ class oceanex extends _abstract_oceanex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
202255
202928
  request['timestamp'] = since;
202256
202929
  }
202257
202930
  if (limit !== undefined) {
202258
- request['limit'] = limit;
202931
+ request['limit'] = Math.min(limit, 10000);
202259
202932
  }
202260
202933
  const response = await this.publicPostK(this.extend(request, params));
202261
202934
  const ohlcvs = this.safeList(response, 'data', []);
@@ -203571,8 +204244,10 @@ class okcoin extends _abstract_okcoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
203571
204244
  const request = {
203572
204245
  'instId': market['id'],
203573
204246
  'bar': bar,
203574
- 'limit': limit,
203575
204247
  };
204248
+ if (limit !== undefined) {
204249
+ request['limit'] = limit; // default 100, max 100
204250
+ }
203576
204251
  let method = undefined;
203577
204252
  [method, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'method', 'publicGetMarketCandles');
203578
204253
  let response = undefined;
@@ -212052,26 +212727,40 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
212052
212727
  // "msg": ""
212053
212728
  // }
212054
212729
  //
212055
- return this.parseMarginModification(response, market);
212730
+ const data = this.safeList(response, 'data', []);
212731
+ const errorCode = this.safeString(response, 'code');
212732
+ const item = this.safeDict(data, 0, {});
212733
+ return this.extend(this.parseMarginModification(item, market), {
212734
+ 'status': (errorCode === '0') ? 'ok' : 'failed',
212735
+ });
212056
212736
  }
212057
212737
  parseMarginModification(data, market = undefined) {
212058
- const innerData = this.safeValue(data, 'data', []);
212059
- const entry = this.safeValue(innerData, 0, {});
212060
- const errorCode = this.safeString(data, 'code');
212061
- const status = (errorCode === '0') ? 'ok' : 'failed';
212062
- const amountRaw = this.safeNumber(entry, 'amt');
212063
- const typeRaw = this.safeString(entry, 'type');
212738
+ //
212739
+ // addMargin/reduceMargin
212740
+ //
212741
+ // {
212742
+ // "amt": "0.01",
212743
+ // "instId": "ETH-USD-SWAP",
212744
+ // "posSide": "net",
212745
+ // "type": "reduce"
212746
+ // }
212747
+ //
212748
+ const amountRaw = this.safeNumber(data, 'amt');
212749
+ const typeRaw = this.safeString(data, 'type');
212064
212750
  const type = (typeRaw === 'reduce') ? 'reduce' : 'add';
212065
- const marketId = this.safeString(entry, 'instId');
212751
+ const marketId = this.safeString(data, 'instId');
212066
212752
  const responseMarket = this.safeMarket(marketId, market);
212067
212753
  const code = responseMarket['inverse'] ? responseMarket['base'] : responseMarket['quote'];
212068
212754
  return {
212069
212755
  'info': data,
212756
+ 'symbol': responseMarket['symbol'],
212070
212757
  'type': type,
212071
212758
  'amount': amountRaw,
212759
+ 'total': undefined,
212072
212760
  'code': code,
212073
- 'symbol': responseMarket['symbol'],
212074
- 'status': status,
212761
+ 'status': undefined,
212762
+ 'timestamp': undefined,
212763
+ 'datetime': undefined,
212075
212764
  };
212076
212765
  }
212077
212766
  async reduceMargin(symbol, amount, params = {}) {
@@ -221119,12 +221808,14 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
221119
221808
  const codeCurrency = inverse ? 'base' : 'quote';
221120
221809
  return {
221121
221810
  'info': data,
221811
+ 'symbol': this.safeSymbol(undefined, market),
221122
221812
  'type': 'set',
221123
221813
  'amount': undefined,
221124
221814
  'total': undefined,
221125
221815
  'code': market[codeCurrency],
221126
- 'symbol': this.safeSymbol(undefined, market),
221127
221816
  'status': this.parseMarginStatus(this.safeString(data, 'code')),
221817
+ 'timestamp': undefined,
221818
+ 'datetime': undefined,
221128
221819
  };
221129
221820
  }
221130
221821
  async setMarginMode(marginMode, symbol = undefined, params = {}) {
@@ -234101,6 +234792,7 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
234101
234792
  '30015': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError,
234102
234793
  '30016': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest, // { event: 'error', code: 30016, msg: 'Param error' }
234103
234794
  },
234795
+ 'broad': {},
234104
234796
  },
234105
234797
  },
234106
234798
  });
@@ -265949,17 +266641,22 @@ class kucoin extends _kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
265949
266641
  const marketId = this.safeString(data, 'symbol', topicSymbol);
265950
266642
  const symbol = this.safeSymbol(marketId, undefined, '-');
265951
266643
  const messageHash = 'orderbook:' + symbol;
265952
- let orderbook = this.safeDict(this.orderbooks, symbol);
266644
+ // let orderbook = this.safeDict (this.orderbooks, symbol);
265953
266645
  if (subject === 'level2') {
265954
- if (orderbook === undefined) {
265955
- orderbook = this.orderBook();
266646
+ if (!(symbol in this.orderbooks)) {
266647
+ this.orderbooks[symbol] = this.orderBook();
265956
266648
  }
265957
266649
  else {
266650
+ const orderbook = this.orderbooks[symbol];
265958
266651
  orderbook.reset();
265959
266652
  }
265960
- orderbook['symbol'] = symbol;
266653
+ this.orderbooks[symbol]['symbol'] = symbol;
265961
266654
  }
265962
266655
  else {
266656
+ if (!(symbol in this.orderbooks)) {
266657
+ this.orderbooks[symbol] = this.orderBook();
266658
+ }
266659
+ const orderbook = this.orderbooks[symbol];
265963
266660
  const nonce = this.safeInteger(orderbook, 'nonce');
265964
266661
  const deltaEnd = this.safeInteger2(data, 'sequenceEnd', 'timestamp');
265965
266662
  if (nonce === undefined) {
@@ -265985,8 +266682,8 @@ class kucoin extends _kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
265985
266682
  return;
265986
266683
  }
265987
266684
  }
265988
- this.handleDelta(orderbook, data);
265989
- client.resolve(orderbook, messageHash);
266685
+ this.handleDelta(this.orderbooks[symbol], data);
266686
+ client.resolve(this.orderbooks[symbol], messageHash);
265990
266687
  }
265991
266688
  getCacheIndex(orderbook, cache) {
265992
266689
  const firstDelta = this.safeValue(cache, 0);
@@ -307384,7 +308081,7 @@ class wazirx extends _abstract_wazirx_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
307384
308081
  'interval': this.safeString(this.timeframes, timeframe, timeframe),
307385
308082
  };
307386
308083
  if (limit !== undefined) {
307387
- request['limit'] = limit;
308084
+ request['limit'] = Math.min(limit, 2000);
307388
308085
  }
307389
308086
  const until = this.safeInteger(params, 'until');
307390
308087
  params = this.omit(params, ['until']);
@@ -316985,6 +317682,9 @@ class zonda extends _abstract_zonda_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
316985
317682
  if (limit === undefined) {
316986
317683
  limit = 100;
316987
317684
  }
317685
+ else {
317686
+ limit = Math.min(limit, 11000); // supports up to 11k candles diapason
317687
+ }
316988
317688
  const duration = this.parseTimeframe(timeframe);
316989
317689
  const timerange = limit * duration * 1000;
316990
317690
  if (since === undefined) {
@@ -323808,7 +324508,7 @@ SOFTWARE.
323808
324508
 
323809
324509
  //-----------------------------------------------------------------------------
323810
324510
  // this is updated by vss.js when building
323811
- const version = '4.2.85';
324511
+ const version = '4.2.87';
323812
324512
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
323813
324513
  //-----------------------------------------------------------------------------
323814
324514