ccxt 4.2.38 → 4.2.40

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 (127) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +1340 -407
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/ascendex.js +28 -24
  6. package/dist/cjs/src/base/Exchange.js +28 -16
  7. package/dist/cjs/src/binance.js +528 -181
  8. package/dist/cjs/src/bingx.js +250 -23
  9. package/dist/cjs/src/bitget.js +14 -3
  10. package/dist/cjs/src/bitso.js +18 -2
  11. package/dist/cjs/src/bitstamp.js +24 -2
  12. package/dist/cjs/src/bl3p.js +6 -0
  13. package/dist/cjs/src/blockchaincom.js +21 -0
  14. package/dist/cjs/src/btcalpha.js +9 -0
  15. package/dist/cjs/src/btcbox.js +9 -0
  16. package/dist/cjs/src/btcmarkets.js +19 -0
  17. package/dist/cjs/src/bybit.js +3 -1
  18. package/dist/cjs/src/coinbase.js +21 -8
  19. package/dist/cjs/src/coinbasepro.js +1 -0
  20. package/dist/cjs/src/coinlist.js +9 -7
  21. package/dist/cjs/src/coinmetro.js +2 -1
  22. package/dist/cjs/src/krakenfutures.js +133 -16
  23. package/dist/cjs/src/luno.js +1 -1
  24. package/dist/cjs/src/mexc.js +43 -43
  25. package/dist/cjs/src/okx.js +11 -17
  26. package/dist/cjs/src/phemex.js +1 -0
  27. package/dist/cjs/src/poloniexfutures.js +11 -5
  28. package/dist/cjs/src/pro/bitmart.js +141 -48
  29. package/dist/cjs/src/pro/bybit.js +5 -5
  30. package/dist/cjs/src/pro/mexc.js +1 -1
  31. package/dist/cjs/src/wavesexchange.js +1 -1
  32. package/dist/cjs/src/woo.js +1 -1
  33. package/js/ccxt.d.ts +1 -1
  34. package/js/ccxt.js +1 -1
  35. package/js/src/abstract/bingx.d.ts +4 -0
  36. package/js/src/abstract/coinbase.d.ts +1 -0
  37. package/js/src/abstract/coinbasepro.d.ts +1 -0
  38. package/js/src/abstract/okx.d.ts +1 -0
  39. package/js/src/ascendex.d.ts +2 -2
  40. package/js/src/ascendex.js +28 -24
  41. package/js/src/base/Exchange.d.ts +12 -8
  42. package/js/src/base/Exchange.js +28 -16
  43. package/js/src/base/types.d.ts +2 -0
  44. package/js/src/bigone.d.ts +2 -2
  45. package/js/src/binance.d.ts +9 -9
  46. package/js/src/binance.js +528 -181
  47. package/js/src/bingx.d.ts +6 -5
  48. package/js/src/bingx.js +250 -23
  49. package/js/src/bitfinex.d.ts +3 -3
  50. package/js/src/bitfinex2.d.ts +2 -2
  51. package/js/src/bitget.d.ts +5 -5
  52. package/js/src/bitget.js +14 -3
  53. package/js/src/bitmart.d.ts +2 -2
  54. package/js/src/bitmex.d.ts +2 -2
  55. package/js/src/bitrue.d.ts +2 -2
  56. package/js/src/bitso.d.ts +1 -1
  57. package/js/src/bitso.js +18 -2
  58. package/js/src/bitstamp.d.ts +1 -1
  59. package/js/src/bitstamp.js +24 -2
  60. package/js/src/bitvavo.d.ts +1 -1
  61. package/js/src/bl3p.js +6 -0
  62. package/js/src/blockchaincom.js +21 -0
  63. package/js/src/blofin.d.ts +2 -2
  64. package/js/src/btcalpha.js +9 -0
  65. package/js/src/btcbox.js +9 -0
  66. package/js/src/btcmarkets.js +19 -0
  67. package/js/src/bybit.d.ts +7 -7
  68. package/js/src/bybit.js +3 -1
  69. package/js/src/cex.d.ts +1 -1
  70. package/js/src/coinbase.d.ts +2 -2
  71. package/js/src/coinbase.js +21 -8
  72. package/js/src/coinbasepro.js +1 -0
  73. package/js/src/coinex.d.ts +4 -4
  74. package/js/src/coinlist.d.ts +2 -2
  75. package/js/src/coinlist.js +9 -7
  76. package/js/src/coinmetro.js +2 -1
  77. package/js/src/coinone.d.ts +1 -1
  78. package/js/src/delta.d.ts +2 -2
  79. package/js/src/deribit.d.ts +3 -3
  80. package/js/src/digifinex.d.ts +3 -3
  81. package/js/src/exmo.d.ts +2 -2
  82. package/js/src/gate.d.ts +6 -6
  83. package/js/src/hitbtc.d.ts +2 -2
  84. package/js/src/hollaex.d.ts +1 -1
  85. package/js/src/htx.d.ts +3 -3
  86. package/js/src/huobijp.d.ts +1 -1
  87. package/js/src/kraken.d.ts +2 -2
  88. package/js/src/krakenfutures.d.ts +4 -2
  89. package/js/src/krakenfutures.js +133 -16
  90. package/js/src/kucoin.d.ts +5 -5
  91. package/js/src/kucoinfutures.d.ts +2 -2
  92. package/js/src/latoken.d.ts +1 -1
  93. package/js/src/lbank.d.ts +2 -2
  94. package/js/src/luno.d.ts +1 -1
  95. package/js/src/luno.js +1 -1
  96. package/js/src/mexc.d.ts +4 -4
  97. package/js/src/mexc.js +43 -43
  98. package/js/src/ndax.d.ts +1 -1
  99. package/js/src/novadax.d.ts +1 -1
  100. package/js/src/okcoin.d.ts +2 -2
  101. package/js/src/okx.d.ts +7 -7
  102. package/js/src/okx.js +11 -17
  103. package/js/src/paymium.d.ts +2 -2
  104. package/js/src/phemex.d.ts +4 -4
  105. package/js/src/phemex.js +1 -0
  106. package/js/src/poloniex.d.ts +2 -2
  107. package/js/src/poloniexfutures.d.ts +2 -2
  108. package/js/src/poloniexfutures.js +11 -5
  109. package/js/src/pro/bitmart.d.ts +4 -0
  110. package/js/src/pro/bitmart.js +141 -48
  111. package/js/src/pro/bitvavo.d.ts +1 -1
  112. package/js/src/pro/bybit.d.ts +1 -1
  113. package/js/src/pro/bybit.js +5 -5
  114. package/js/src/pro/cex.d.ts +2 -2
  115. package/js/src/pro/coinbase.d.ts +2 -2
  116. package/js/src/pro/coinex.d.ts +1 -1
  117. package/js/src/pro/lbank.d.ts +1 -1
  118. package/js/src/pro/mexc.js +1 -1
  119. package/js/src/probit.d.ts +1 -1
  120. package/js/src/timex.d.ts +1 -1
  121. package/js/src/upbit.d.ts +1 -1
  122. package/js/src/wavesexchange.js +1 -1
  123. package/js/src/whitebit.d.ts +2 -2
  124. package/js/src/woo.d.ts +3 -3
  125. package/js/src/woo.js +1 -1
  126. package/js/src/zonda.d.ts +3 -3
  127. package/package.json +2 -2
@@ -3928,11 +3928,14 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
3928
3928
  'fillResponseFromRequest': true,
3929
3929
  },
3930
3930
  'networks': {
3931
- 'BSC': 'BEP20 (BSC)',
3931
+ 'BSC': 'BEP20 ' + '(BSC)',
3932
3932
  'ARB': 'arbitrum',
3933
3933
  'SOL': 'Solana',
3934
3934
  'AVAX': 'avalanche C chain',
3935
3935
  'OMNI': 'Omni',
3936
+ 'TRC': 'TRC20',
3937
+ 'TRX': 'TRC20',
3938
+ 'ERC': 'ERC20',
3936
3939
  },
3937
3940
  'networksById': {
3938
3941
  'BEP20 (BSC)': 'BSC',
@@ -3940,6 +3943,16 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
3940
3943
  'Solana': 'SOL',
3941
3944
  'avalanche C chain': 'AVAX',
3942
3945
  'Omni': 'OMNI',
3946
+ 'TRC20': 'TRC20',
3947
+ 'ERC20': 'ERC20',
3948
+ 'GO20': 'GO20',
3949
+ 'BEP2': 'BEP2',
3950
+ 'Bitcoin': 'BTC',
3951
+ 'Bitcoin ABC': 'BCH',
3952
+ 'Litecoin': 'LTC',
3953
+ 'Matic Network': 'MATIC',
3954
+ 'xDai': 'STAKE',
3955
+ 'Akash': 'AKT',
3943
3956
  },
3944
3957
  },
3945
3958
  'exceptions': {
@@ -6029,8 +6042,8 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
6029
6042
  const tag = this.safeString(depositAddress, tagId);
6030
6043
  this.checkAddress(address);
6031
6044
  const code = (currency === undefined) ? undefined : currency['code'];
6032
- const chainName = this.safeString(depositAddress, 'chainName');
6033
- const network = this.safeNetwork(chainName);
6045
+ const chainName = this.safeString(depositAddress, 'blockchain');
6046
+ const network = this.networkIdToCode(chainName, code);
6034
6047
  return {
6035
6048
  'currency': code,
6036
6049
  'address': address,
@@ -6040,20 +6053,7 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
6040
6053
  };
6041
6054
  }
6042
6055
  safeNetwork(networkId) {
6043
- const networksById = {
6044
- 'TRC20': 'TRC20',
6045
- 'ERC20': 'ERC20',
6046
- 'GO20': 'GO20',
6047
- 'BEP2': 'BEP2',
6048
- 'BEP20 (BSC)': 'BEP20',
6049
- 'Bitcoin': 'BTC',
6050
- 'Bitcoin ABC': 'BCH',
6051
- 'Litecoin': 'LTC',
6052
- 'Matic Network': 'MATIC',
6053
- 'Solana': 'SOL',
6054
- 'xDai': 'STAKE',
6055
- 'Akash': 'AKT',
6056
- };
6056
+ const networksById = this.safeDict(this.options, 'networksById');
6057
6057
  return this.safeString(networksById, networkId, networkId);
6058
6058
  }
6059
6059
  async fetchDepositAddress(code, params = {}) {
@@ -6061,16 +6061,20 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
6061
6061
  * @method
6062
6062
  * @name ascendex#fetchDepositAddress
6063
6063
  * @description fetch the deposit address for a currency associated with this account
6064
+ * @see https://ascendex.github.io/ascendex-pro-api/#query-deposit-addresses
6064
6065
  * @param {string} code unified currency code
6065
6066
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6067
+ * @param {string} [params.network] unified network code for deposit chain
6066
6068
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
6067
6069
  */
6068
6070
  await this.loadMarkets();
6069
6071
  const currency = this.currency(code);
6070
- const chainName = this.safeString(params, 'chainName');
6071
- params = this.omit(params, 'chainName');
6072
+ const networkCode = this.safeString2(params, 'network', 'chainName');
6073
+ const networkId = this.networkCodeToId(networkCode);
6074
+ params = this.omit(params, ['chainName']);
6072
6075
  const request = {
6073
6076
  'asset': currency['id'],
6077
+ 'blockchain': networkId,
6074
6078
  };
6075
6079
  const response = await this.v1PrivateGetWalletDepositAddress(this.extend(request, params));
6076
6080
  //
@@ -6106,22 +6110,22 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
6106
6110
  // }
6107
6111
  // }
6108
6112
  //
6109
- const data = this.safeValue(response, 'data', {});
6110
- const addresses = this.safeValue(data, 'address', []);
6113
+ const data = this.safeDict(response, 'data', {});
6114
+ const addresses = this.safeList(data, 'address', []);
6111
6115
  const numAddresses = addresses.length;
6112
6116
  let address = undefined;
6113
6117
  if (numAddresses > 1) {
6114
6118
  const addressesByChainName = this.indexBy(addresses, 'chainName');
6115
- if (chainName === undefined) {
6119
+ if (networkId === undefined) {
6116
6120
  const chainNames = Object.keys(addressesByChainName);
6117
6121
  const chains = chainNames.join(', ');
6118
6122
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchDepositAddress() returned more than one address, a chainName parameter is required, one of ' + chains);
6119
6123
  }
6120
- address = this.safeValue(addressesByChainName, chainName, {});
6124
+ address = this.safeDict(addressesByChainName, networkId, {});
6121
6125
  }
6122
6126
  else {
6123
6127
  // first address
6124
- address = this.safeValue(addresses, 0, {});
6128
+ address = this.safeDict(addresses, 0, {});
6125
6129
  }
6126
6130
  const result = this.parseDepositAddress(address, currency);
6127
6131
  return this.extend(result, {
@@ -8965,6 +8969,18 @@ class Exchange {
8965
8969
  async setLeverage(leverage, symbol = undefined, params = {}) {
8966
8970
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' setLeverage() is not supported yet');
8967
8971
  }
8972
+ async fetchLeverage(symbol, params = {}) {
8973
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchLeverage() is not supported yet');
8974
+ }
8975
+ async setPositionMode(hedged, symbol = undefined, params = {}) {
8976
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' setPositionMode() is not supported yet');
8977
+ }
8978
+ async setMarginMode(marginMode, symbol = undefined, params = {}) {
8979
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' setMarginMode() is not supported yet');
8980
+ }
8981
+ async fetchDepositAddressesByNetwork(code, params = {}) {
8982
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchDepositAddressesByNetwork() is not supported yet');
8983
+ }
8968
8984
  async fetchOpenInterestHistory(symbol, timeframe = '1h', since = undefined, limit = undefined, params = {}) {
8969
8985
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOpenInterestHistory() is not supported yet');
8970
8986
  }
@@ -10191,11 +10207,11 @@ class Exchange {
10191
10207
  * @param {string|undefined} currencyCode unified currency code, but this argument is not required by default, unless there is an exchange (like huobi) that needs an override of the method to be able to pass currencyCode argument additionally
10192
10208
  * @returns {string|undefined} unified network code
10193
10209
  */
10194
- const networkCodesByIds = this.safeValue(this.options, 'networksById', {});
10210
+ const networkCodesByIds = this.safeDict(this.options, 'networksById', {});
10195
10211
  let networkCode = this.safeString(networkCodesByIds, networkId, networkId);
10196
10212
  // replace mainnet network-codes (i.e. ERC20->ETH)
10197
10213
  if (currencyCode !== undefined) {
10198
- const defaultNetworkCodeReplacements = this.safeValue(this.options, 'defaultNetworkCodeReplacements', {});
10214
+ const defaultNetworkCodeReplacements = this.safeDict(this.options, 'defaultNetworkCodeReplacements', {});
10199
10215
  if (currencyCode in defaultNetworkCodeReplacements) {
10200
10216
  const replacementObject = this.safeDict(defaultNetworkCodeReplacements, currencyCode, {});
10201
10217
  networkCode = this.safeString(replacementObject, networkCode, networkCode);
@@ -10213,14 +10229,14 @@ class Exchange {
10213
10229
  }
10214
10230
  defaultNetworkCode(currencyCode) {
10215
10231
  let defaultNetworkCode = undefined;
10216
- const defaultNetworks = this.safeValue(this.options, 'defaultNetworks', {});
10232
+ const defaultNetworks = this.safeDict(this.options, 'defaultNetworks', {});
10217
10233
  if (currencyCode in defaultNetworks) {
10218
10234
  // if currency had set its network in "defaultNetworks", use it
10219
10235
  defaultNetworkCode = defaultNetworks[currencyCode];
10220
10236
  }
10221
10237
  else {
10222
10238
  // otherwise, try to use the global-scope 'defaultNetwork' value (even if that network is not supported by currency, it doesn't make any problem, this will be just used "at first" if currency supports this network at all)
10223
- const defaultNetwork = this.safeValue(this.options, 'defaultNetwork');
10239
+ const defaultNetwork = this.safeDict(this.options, 'defaultNetwork');
10224
10240
  if (defaultNetwork !== undefined) {
10225
10241
  defaultNetworkCode = defaultNetwork;
10226
10242
  }
@@ -10725,14 +10741,14 @@ class Exchange {
10725
10741
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchStatus() is not supported yet');
10726
10742
  }
10727
10743
  async fetchFundingFee(code, params = {}) {
10728
- const warnOnFetchFundingFee = this.safeValue(this.options, 'warnOnFetchFundingFee', true);
10744
+ const warnOnFetchFundingFee = this.safeBool(this.options, 'warnOnFetchFundingFee', true);
10729
10745
  if (warnOnFetchFundingFee) {
10730
10746
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchFundingFee() method is deprecated, it will be removed in July 2022, please, use fetchTransactionFee() or set exchange.options["warnOnFetchFundingFee"] = false to suppress this warning');
10731
10747
  }
10732
10748
  return await this.fetchTransactionFee(code, params);
10733
10749
  }
10734
10750
  async fetchFundingFees(codes = undefined, params = {}) {
10735
- const warnOnFetchFundingFees = this.safeValue(this.options, 'warnOnFetchFundingFees', true);
10751
+ const warnOnFetchFundingFees = this.safeBool(this.options, 'warnOnFetchFundingFees', true);
10736
10752
  if (warnOnFetchFundingFees) {
10737
10753
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchFundingFees() method is deprecated, it will be removed in July 2022. Please, use fetchTransactionFees() or set exchange.options["warnOnFetchFundingFees"] = false to suppress this warning');
10738
10754
  }
@@ -10783,7 +10799,7 @@ class Exchange {
10783
10799
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchIsolatedBorrowRate() is not supported yet');
10784
10800
  }
10785
10801
  const borrowRates = await this.fetchIsolatedBorrowRates(params);
10786
- const rate = this.safeValue(borrowRates, symbol);
10802
+ const rate = this.safeDict(borrowRates, symbol);
10787
10803
  if (rate === undefined) {
10788
10804
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeError(this.id + ' fetchIsolatedBorrowRate() could not find the borrow rate for market symbol ' + symbol);
10789
10805
  }
@@ -10844,7 +10860,7 @@ class Exchange {
10844
10860
  }
10845
10861
  handleMarketTypeAndParams(methodName, market = undefined, params = {}) {
10846
10862
  const defaultType = this.safeString2(this.options, 'defaultType', 'type', 'spot');
10847
- const methodOptions = this.safeValue(this.options, methodName);
10863
+ const methodOptions = this.safeDict(this.options, methodName);
10848
10864
  let methodType = defaultType;
10849
10865
  if (methodOptions !== undefined) {
10850
10866
  if (typeof methodOptions === 'string') {
@@ -10880,7 +10896,7 @@ class Exchange {
10880
10896
  }
10881
10897
  // if it was not defined in market object
10882
10898
  if (subType === undefined) {
10883
- const values = this.handleOptionAndParams(undefined, methodName, 'subType', defaultValue); // no need to re-test params here
10899
+ const values = this.handleOptionAndParams({}, methodName, 'subType', defaultValue); // no need to re-test params here
10884
10900
  subType = values[0];
10885
10901
  }
10886
10902
  }
@@ -10936,7 +10952,7 @@ class Exchange {
10936
10952
  const market = this.market(symbol);
10937
10953
  symbol = market['symbol'];
10938
10954
  const tickers = await this.fetchTickers([symbol], params);
10939
- const ticker = this.safeValue(tickers, symbol);
10955
+ const ticker = this.safeDict(tickers, symbol);
10940
10956
  if (ticker === undefined) {
10941
10957
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NullResponse(this.id + ' fetchTickers() could not find a ticker for ' + symbol);
10942
10958
  }
@@ -10973,7 +10989,7 @@ class Exchange {
10973
10989
  return order['status'];
10974
10990
  }
10975
10991
  async fetchUnifiedOrder(order, params = {}) {
10976
- return await this.fetchOrder(this.safeValue(order, 'id'), this.safeValue(order, 'symbol'), params);
10992
+ return await this.fetchOrder(this.safeString(order, 'id'), this.safeString(order, 'symbol'), params);
10977
10993
  }
10978
10994
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
10979
10995
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createOrder() is not supported yet');
@@ -11243,7 +11259,7 @@ class Exchange {
11243
11259
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' cancelAllOrdersWs() is not supported yet');
11244
11260
  }
11245
11261
  async cancelUnifiedOrder(order, params = {}) {
11246
- return this.cancelOrder(this.safeValue(order, 'id'), this.safeValue(order, 'symbol'), params);
11262
+ return this.cancelOrder(this.safeString(order, 'id'), this.safeString(order, 'symbol'), params);
11247
11263
  }
11248
11264
  async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
11249
11265
  if (this.has['fetchOpenOrders'] && this.has['fetchClosedOrders']) {
@@ -11735,7 +11751,7 @@ class Exchange {
11735
11751
  return result;
11736
11752
  }
11737
11753
  isTriggerOrder(params) {
11738
- const isTrigger = this.safeValue2(params, 'trigger', 'stop');
11754
+ const isTrigger = this.safeBool2(params, 'trigger', 'stop');
11739
11755
  if (isTrigger) {
11740
11756
  params = this.omit(params, ['trigger', 'stop']);
11741
11757
  }
@@ -11751,7 +11767,7 @@ class Exchange {
11751
11767
  * @returns {boolean} true if a post only order, false otherwise
11752
11768
  */
11753
11769
  const timeInForce = this.safeStringUpper(params, 'timeInForce');
11754
- let postOnly = this.safeValue2(params, 'postOnly', 'post_only', false);
11770
+ let postOnly = this.safeBool2(params, 'postOnly', 'post_only', false);
11755
11771
  // we assume timeInForce is uppercase from safeStringUpper (params, 'timeInForce')
11756
11772
  const ioc = timeInForce === 'IOC';
11757
11773
  const fok = timeInForce === 'FOK';
@@ -11945,7 +11961,7 @@ class Exchange {
11945
11961
  * @param {string} account key for account name in this.options['accountsByType']
11946
11962
  * @returns the exchange specific account name or the isolated margin id for transfers
11947
11963
  */
11948
- const accountsByType = this.safeValue(this.options, 'accountsByType', {});
11964
+ const accountsByType = this.safeDict(this.options, 'accountsByType', {});
11949
11965
  const lowercaseAccount = account.toLowerCase();
11950
11966
  if (lowercaseAccount in accountsByType) {
11951
11967
  return accountsByType[lowercaseAccount];
@@ -12422,7 +12438,7 @@ class Exchange {
12422
12438
  return input;
12423
12439
  }
12424
12440
  handleUntilOption(key, request, params, multiplier = 1) {
12425
- const until = this.safeValue2(params, 'until', 'till');
12441
+ const until = this.safeInteger2(params, 'until', 'till');
12426
12442
  if (until !== undefined) {
12427
12443
  request[key] = this.parseToInt(until * multiplier);
12428
12444
  params = this.omit(params, ['until', 'till']);
@@ -20621,7 +20637,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
20621
20637
  let minPrecision = undefined;
20622
20638
  let isWithdrawEnabled = true;
20623
20639
  let isDepositEnabled = true;
20624
- const networkList = this.safeValue(entry, 'networkList', []);
20640
+ const networkList = this.safeList(entry, 'networkList', []);
20625
20641
  const fees = {};
20626
20642
  let fee = undefined;
20627
20643
  for (let j = 0; j < networkList.length; j++) {
@@ -20629,12 +20645,12 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
20629
20645
  const network = this.safeString(networkItem, 'network');
20630
20646
  // const name = this.safeString (networkItem, 'name');
20631
20647
  const withdrawFee = this.safeNumber(networkItem, 'withdrawFee');
20632
- const depositEnable = this.safeValue(networkItem, 'depositEnable');
20633
- const withdrawEnable = this.safeValue(networkItem, 'withdrawEnable');
20648
+ const depositEnable = this.safeBool(networkItem, 'depositEnable');
20649
+ const withdrawEnable = this.safeBool(networkItem, 'withdrawEnable');
20634
20650
  isDepositEnabled = isDepositEnabled || depositEnable;
20635
20651
  isWithdrawEnabled = isWithdrawEnabled || withdrawEnable;
20636
20652
  fees[network] = withdrawFee;
20637
- const isDefault = this.safeValue(networkItem, 'isDefault');
20653
+ const isDefault = this.safeBool(networkItem, 'isDefault');
20638
20654
  if (isDefault || (fee === undefined)) {
20639
20655
  fee = withdrawFee;
20640
20656
  }
@@ -20645,7 +20661,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
20645
20661
  minPrecision = (minPrecision === undefined) ? precisionTick : _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMin(minPrecision, precisionTick);
20646
20662
  }
20647
20663
  }
20648
- const trading = this.safeValue(entry, 'trading');
20664
+ const trading = this.safeBool(entry, 'trading');
20649
20665
  const active = (isWithdrawEnabled && isDepositEnabled && trading);
20650
20666
  let maxDecimalPlaces = undefined;
20651
20667
  if (minPrecision !== undefined) {
@@ -20681,8 +20697,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
20681
20697
  * @returns {object[]} an array of objects representing market data
20682
20698
  */
20683
20699
  const promisesRaw = [];
20684
- const rawFetchMarkets = this.safeValue(this.options, 'fetchMarkets', ['spot', 'linear', 'inverse']);
20685
- const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
20700
+ const rawFetchMarkets = this.safeList(this.options, 'fetchMarkets', ['spot', 'linear', 'inverse']);
20701
+ const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
20686
20702
  const fetchMarkets = [];
20687
20703
  for (let i = 0; i < rawFetchMarkets.length; i++) {
20688
20704
  const type = rawFetchMarkets[i];
@@ -20960,7 +20976,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
20960
20976
  }
20961
20977
  const settle = this.safeCurrencyCode(settleId);
20962
20978
  const spot = !contract;
20963
- const filters = this.safeValue(market, 'filters', []);
20979
+ const filters = this.safeList(market, 'filters', []);
20964
20980
  const filtersByType = this.indexBy(filters, 'filterType');
20965
20981
  const status = this.safeString2(market, 'status', 'contractStatus');
20966
20982
  let contractSize = undefined;
@@ -20983,11 +20999,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
20983
20999
  linear = settle === quote;
20984
21000
  inverse = settle === base;
20985
21001
  const feesType = linear ? 'linear' : 'inverse';
20986
- fees = this.safeValue(this.fees, feesType, {});
21002
+ fees = this.safeDict(this.fees, feesType, {});
20987
21003
  }
20988
21004
  let active = (status === 'TRADING');
20989
21005
  if (spot) {
20990
- const permissions = this.safeValue(market, 'permissions', []);
21006
+ const permissions = this.safeList(market, 'permissions', []);
20991
21007
  for (let j = 0; j < permissions.length; j++) {
20992
21008
  if (permissions[j] === 'TRD_GRP_003') {
20993
21009
  active = false;
@@ -21065,7 +21081,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
21065
21081
  'created': this.safeInteger(market, 'onboardDate'), // present in inverse & linear apis
21066
21082
  };
21067
21083
  if ('PRICE_FILTER' in filtersByType) {
21068
- const filter = this.safeValue(filtersByType, 'PRICE_FILTER', {});
21084
+ const filter = this.safeDict(filtersByType, 'PRICE_FILTER', {});
21069
21085
  // PRICE_FILTER reports zero values for maxPrice
21070
21086
  // since they updated filter types in November 2018
21071
21087
  // https://github.com/ccxt/ccxt/issues/4286
@@ -21077,7 +21093,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
21077
21093
  entry['precision']['price'] = this.precisionFromString(filter['tickSize']);
21078
21094
  }
21079
21095
  if ('LOT_SIZE' in filtersByType) {
21080
- const filter = this.safeValue(filtersByType, 'LOT_SIZE', {});
21096
+ const filter = this.safeDict(filtersByType, 'LOT_SIZE', {});
21081
21097
  const stepSize = this.safeString(filter, 'stepSize');
21082
21098
  entry['precision']['amount'] = this.precisionFromString(stepSize);
21083
21099
  entry['limits']['amount'] = {
@@ -21086,14 +21102,14 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
21086
21102
  };
21087
21103
  }
21088
21104
  if ('MARKET_LOT_SIZE' in filtersByType) {
21089
- const filter = this.safeValue(filtersByType, 'MARKET_LOT_SIZE', {});
21105
+ const filter = this.safeDict(filtersByType, 'MARKET_LOT_SIZE', {});
21090
21106
  entry['limits']['market'] = {
21091
21107
  'min': this.safeNumber(filter, 'minQty'),
21092
21108
  'max': this.safeNumber(filter, 'maxQty'),
21093
21109
  };
21094
21110
  }
21095
21111
  if (('MIN_NOTIONAL' in filtersByType) || ('NOTIONAL' in filtersByType)) { // notional added in 12/04/23 to spot testnet
21096
- const filter = this.safeValue2(filtersByType, 'MIN_NOTIONAL', 'NOTIONAL', {});
21112
+ const filter = this.safeDict2(filtersByType, 'MIN_NOTIONAL', 'NOTIONAL', {});
21097
21113
  entry['limits']['cost']['min'] = this.safeNumber2(filter, 'minNotional', 'notional');
21098
21114
  entry['limits']['cost']['max'] = this.safeNumber(filter, 'maxNotional');
21099
21115
  }
@@ -21787,7 +21803,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
21787
21803
  }
21788
21804
  }
21789
21805
  if (Array.isArray(response)) {
21790
- const firstTicker = this.safeValue(response, 0, {});
21806
+ const firstTicker = this.safeDict(response, 0, {});
21791
21807
  return this.parseTicker(firstTicker, market);
21792
21808
  }
21793
21809
  return this.parseTicker(response, market);
@@ -23020,7 +23036,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23020
23036
  // "msg": "Quantity greater than max quantity."
23021
23037
  // }
23022
23038
  //
23023
- // createOrder, fetchOpenOrders: portfolio margin linear swap and future
23039
+ // createOrder, fetchOpenOrders, fetchOrder, cancelOrder: portfolio margin linear swap and future
23024
23040
  //
23025
23041
  // {
23026
23042
  // "symbol": "BTCUSDT",
@@ -23043,7 +23059,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23043
23059
  // "status": "NEW"
23044
23060
  // }
23045
23061
  //
23046
- // createOrder, fetchOpenOrders: portfolio margin inverse swap and future
23062
+ // createOrder, fetchOpenOrders, fetchOrder, cancelOrder: portfolio margin inverse swap and future
23047
23063
  //
23048
23064
  // {
23049
23065
  // "symbol": "ETHUSD_PERP",
@@ -23109,7 +23125,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23109
23125
  // "priceProtect": false
23110
23126
  // }
23111
23127
  //
23112
- // createOrder, cancelAllOrders: portfolio margin spot margin
23128
+ // createOrder, cancelAllOrders, cancelOrder: portfolio margin spot margin
23113
23129
  //
23114
23130
  // {
23115
23131
  // "clientOrderId": "x-R4BD3S82e9ef29d8346440f0b28b86",
@@ -23128,7 +23144,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23128
23144
  // "type": "LIMIT"
23129
23145
  // }
23130
23146
  //
23131
- // fetchOpenOrders: portfolio margin spot margin
23147
+ // fetchOpenOrders, fetchOrder: portfolio margin spot margin
23132
23148
  //
23133
23149
  // {
23134
23150
  // "symbol": "BTCUSDT",
@@ -23153,6 +23169,31 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23153
23169
  // "preventedQuantity": null
23154
23170
  // }
23155
23171
  //
23172
+ // cancelOrder: portfolio margin linear and inverse swap conditional
23173
+ //
23174
+ // {
23175
+ // "strategyId": 3733211,
23176
+ // "newClientStrategyId": "x-xcKtGhcuaf166172ed504cd1bc0396",
23177
+ // "strategyType": "STOP",
23178
+ // "strategyStatus": "CANCELED",
23179
+ // "origQty": "0.010",
23180
+ // "price": "35000.00",
23181
+ // "reduceOnly": false,
23182
+ // "side": "BUY",
23183
+ // "positionSide": "BOTH",
23184
+ // "stopPrice": "50000.00", // ignored with trailing orders
23185
+ // "symbol": "BTCUSDT",
23186
+ // "timeInForce": "GTC",
23187
+ // "activatePrice": null, // only return with trailing orders
23188
+ // "priceRate": null, // only return with trailing orders
23189
+ // "bookTime": 1707270098774,
23190
+ // "updateTime": 1707270119261,
23191
+ // "workingType": "CONTRACT_PRICE",
23192
+ // "priceProtect": false,
23193
+ // "goodTillDate": 0,
23194
+ // "selfTradePreventionMode": "NONE"
23195
+ // }
23196
+ //
23156
23197
  const code = this.safeString(order, 'code');
23157
23198
  if (code !== undefined) {
23158
23199
  // cancelOrders/createOrders might have a partial success
@@ -23188,7 +23229,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23188
23229
  cost = this.safeString(order, 'cumBase', cost);
23189
23230
  let type = this.safeStringLower(order, 'type');
23190
23231
  const side = this.safeStringLower(order, 'side');
23191
- const fills = this.safeValue(order, 'fills', []);
23232
+ const fills = this.safeList(order, 'fills', []);
23192
23233
  let timeInForce = this.safeString(order, 'timeInForce');
23193
23234
  if (timeInForce === 'GTX') {
23194
23235
  // GTX means "Good Till Crossing" and is an equivalent way of saying Post Only
@@ -23221,7 +23262,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23221
23262
  'type': type,
23222
23263
  'timeInForce': timeInForce,
23223
23264
  'postOnly': postOnly,
23224
- 'reduceOnly': this.safeValue(order, 'reduceOnly'),
23265
+ 'reduceOnly': this.safeBool(order, 'reduceOnly'),
23225
23266
  'side': side,
23226
23267
  'price': price,
23227
23268
  'triggerPrice': stopPrice,
@@ -23255,7 +23296,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23255
23296
  const side = this.safeString(rawOrder, 'side');
23256
23297
  const amount = this.safeValue(rawOrder, 'amount');
23257
23298
  const price = this.safeValue(rawOrder, 'price');
23258
- const orderParams = this.safeValue(rawOrder, 'params', {});
23299
+ const orderParams = this.safeDict(rawOrder, 'params', {});
23259
23300
  const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams);
23260
23301
  ordersRequests.push(orderRequest);
23261
23302
  }
@@ -23763,9 +23804,14 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23763
23804
  * @see https://binance-docs.github.io/apidocs/delivery/en/#query-order-user_data
23764
23805
  * @see https://binance-docs.github.io/apidocs/voptions/en/#query-single-order-trade
23765
23806
  * @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-order-user_data
23807
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-um-order-user_data
23808
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-cm-order-user_data
23809
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-margin-account-order-user_data
23810
+ * @param {string} id the order id
23766
23811
  * @param {string} symbol unified symbol of the market the order was made in
23767
23812
  * @param {object} [params] extra parameters specific to the exchange API endpoint
23768
23813
  * @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
23814
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch an order in a portfolio margin account
23769
23815
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
23770
23816
  */
23771
23817
  if (symbol === undefined) {
@@ -23775,11 +23821,14 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23775
23821
  const market = this.market(symbol);
23776
23822
  const defaultType = this.safeString2(this.options, 'fetchOrder', 'defaultType', 'spot');
23777
23823
  const type = this.safeString(params, 'type', defaultType);
23778
- const [marginMode, query] = this.handleMarginModeAndParams('fetchOrder', params);
23824
+ let marginMode = undefined;
23825
+ [marginMode, params] = this.handleMarginModeAndParams('fetchOrder', params);
23826
+ let isPortfolioMargin = undefined;
23827
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchOrder', 'papi', 'portfolioMargin', false);
23779
23828
  const request = {
23780
23829
  'symbol': market['id'],
23781
23830
  };
23782
- const clientOrderId = this.safeValue2(params, 'origClientOrderId', 'clientOrderId');
23831
+ const clientOrderId = this.safeString2(params, 'origClientOrderId', 'clientOrderId');
23783
23832
  if (clientOrderId !== undefined) {
23784
23833
  if (market['option']) {
23785
23834
  request['clientOrderId'] = clientOrderId;
@@ -23791,25 +23840,40 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23791
23840
  else {
23792
23841
  request['orderId'] = id;
23793
23842
  }
23794
- const requestParams = this.omit(query, ['type', 'clientOrderId', 'origClientOrderId']);
23843
+ params = this.omit(params, ['type', 'clientOrderId', 'origClientOrderId']);
23795
23844
  let response = undefined;
23796
23845
  if (market['option']) {
23797
- response = await this.eapiPrivateGetOrder(this.extend(request, requestParams));
23846
+ response = await this.eapiPrivateGetOrder(this.extend(request, params));
23798
23847
  }
23799
23848
  else if (market['linear']) {
23800
- response = await this.fapiPrivateGetOrder(this.extend(request, requestParams));
23849
+ if (isPortfolioMargin) {
23850
+ response = await this.papiGetUmOrder(this.extend(request, params));
23851
+ }
23852
+ else {
23853
+ response = await this.fapiPrivateGetOrder(this.extend(request, params));
23854
+ }
23801
23855
  }
23802
23856
  else if (market['inverse']) {
23803
- response = await this.dapiPrivateGetOrder(this.extend(request, requestParams));
23857
+ if (isPortfolioMargin) {
23858
+ response = await this.papiGetCmOrder(this.extend(request, params));
23859
+ }
23860
+ else {
23861
+ response = await this.dapiPrivateGetOrder(this.extend(request, params));
23862
+ }
23804
23863
  }
23805
- else if (type === 'margin' || marginMode !== undefined) {
23806
- if (marginMode === 'isolated') {
23807
- request['isIsolated'] = true;
23864
+ else if ((type === 'margin') || (marginMode !== undefined) || isPortfolioMargin) {
23865
+ if (isPortfolioMargin) {
23866
+ response = await this.papiGetMarginOrder(this.extend(request, params));
23867
+ }
23868
+ else {
23869
+ if (marginMode === 'isolated') {
23870
+ request['isIsolated'] = true;
23871
+ }
23872
+ response = await this.sapiGetMarginOrder(this.extend(request, params));
23808
23873
  }
23809
- response = await this.sapiGetMarginOrder(this.extend(request, requestParams));
23810
23874
  }
23811
23875
  else {
23812
- response = await this.privateGetOrder(this.extend(request, requestParams));
23876
+ response = await this.privateGetOrder(this.extend(request, params));
23813
23877
  }
23814
23878
  return this.parseOrder(response, market);
23815
23879
  }
@@ -24124,9 +24188,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24124
24188
  * @see https://binance-docs.github.io/apidocs/delivery/en/#cancel-order-trade
24125
24189
  * @see https://binance-docs.github.io/apidocs/voptions/en/#cancel-option-order-trade
24126
24190
  * @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-cancel-order-trade
24191
+ * @see https://binance-docs.github.io/apidocs/pm/en/#cancel-um-order-trade
24192
+ * @see https://binance-docs.github.io/apidocs/pm/en/#cancel-cm-order-trade
24193
+ * @see https://binance-docs.github.io/apidocs/pm/en/#cancel-um-conditional-order-trade
24194
+ * @see https://binance-docs.github.io/apidocs/pm/en/#cancel-cm-conditional-order-trade
24195
+ * @see https://binance-docs.github.io/apidocs/pm/en/#cancel-margin-account-order-trade
24127
24196
  * @param {string} id order id
24128
24197
  * @param {string} symbol unified symbol of the market the order was made in
24129
24198
  * @param {object} [params] extra parameters specific to the exchange API endpoint
24199
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to cancel an order in a portfolio margin account
24200
+ * @param {boolean} [params.stop] set to true if you would like to cancel a portfolio margin account conditional order
24130
24201
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
24131
24202
  */
24132
24203
  if (symbol === undefined) {
@@ -24136,43 +24207,80 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24136
24207
  const market = this.market(symbol);
24137
24208
  const defaultType = this.safeString2(this.options, 'cancelOrder', 'defaultType', 'spot');
24138
24209
  const type = this.safeString(params, 'type', defaultType);
24139
- const [marginMode, query] = this.handleMarginModeAndParams('cancelOrder', params);
24210
+ let marginMode = undefined;
24211
+ [marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
24212
+ let isPortfolioMargin = undefined;
24213
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'cancelOrder', 'papi', 'portfolioMargin', false);
24214
+ const isConditional = this.safeBool2(params, 'stop', 'conditional');
24140
24215
  const request = {
24141
24216
  'symbol': market['id'],
24142
- // 'orderId': id,
24143
- // 'origClientOrderId': id,
24144
24217
  };
24145
- const clientOrderId = this.safeValue2(params, 'origClientOrderId', 'clientOrderId');
24218
+ const clientOrderId = this.safeStringN(params, ['origClientOrderId', 'clientOrderId', 'newClientStrategyId']);
24146
24219
  if (clientOrderId !== undefined) {
24147
24220
  if (market['option']) {
24148
24221
  request['clientOrderId'] = clientOrderId;
24149
24222
  }
24150
24223
  else {
24151
- request['origClientOrderId'] = clientOrderId;
24224
+ if (isPortfolioMargin && isConditional) {
24225
+ request['newClientStrategyId'] = clientOrderId;
24226
+ }
24227
+ else {
24228
+ request['origClientOrderId'] = clientOrderId;
24229
+ }
24152
24230
  }
24153
24231
  }
24154
24232
  else {
24155
- request['orderId'] = id;
24233
+ if (isPortfolioMargin && isConditional) {
24234
+ request['strategyId'] = id;
24235
+ }
24236
+ else {
24237
+ request['orderId'] = id;
24238
+ }
24156
24239
  }
24157
- const requestParams = this.omit(query, ['type', 'origClientOrderId', 'clientOrderId']);
24240
+ params = this.omit(params, ['type', 'origClientOrderId', 'clientOrderId', 'newClientStrategyId', 'stop', 'conditional']);
24158
24241
  let response = undefined;
24159
24242
  if (market['option']) {
24160
- response = await this.eapiPrivateDeleteOrder(this.extend(request, requestParams));
24243
+ response = await this.eapiPrivateDeleteOrder(this.extend(request, params));
24161
24244
  }
24162
24245
  else if (market['linear']) {
24163
- response = await this.fapiPrivateDeleteOrder(this.extend(request, requestParams));
24246
+ if (isPortfolioMargin) {
24247
+ if (isConditional) {
24248
+ response = await this.papiDeleteUmConditionalOrder(this.extend(request, params));
24249
+ }
24250
+ else {
24251
+ response = await this.papiDeleteUmOrder(this.extend(request, params));
24252
+ }
24253
+ }
24254
+ else {
24255
+ response = await this.fapiPrivateDeleteOrder(this.extend(request, params));
24256
+ }
24164
24257
  }
24165
24258
  else if (market['inverse']) {
24166
- response = await this.dapiPrivateDeleteOrder(this.extend(request, requestParams));
24259
+ if (isPortfolioMargin) {
24260
+ if (isConditional) {
24261
+ response = await this.papiDeleteCmConditionalOrder(this.extend(request, params));
24262
+ }
24263
+ else {
24264
+ response = await this.papiDeleteCmOrder(this.extend(request, params));
24265
+ }
24266
+ }
24267
+ else {
24268
+ response = await this.dapiPrivateDeleteOrder(this.extend(request, params));
24269
+ }
24167
24270
  }
24168
- else if (type === 'margin' || marginMode !== undefined) {
24169
- if (marginMode === 'isolated') {
24170
- request['isIsolated'] = true;
24271
+ else if ((type === 'margin') || (marginMode !== undefined) || isPortfolioMargin) {
24272
+ if (isPortfolioMargin) {
24273
+ response = await this.papiDeleteMarginOrder(this.extend(request, params));
24274
+ }
24275
+ else {
24276
+ if (marginMode === 'isolated') {
24277
+ request['isIsolated'] = true;
24278
+ }
24279
+ response = await this.sapiDeleteMarginOrder(this.extend(request, params));
24171
24280
  }
24172
- response = await this.sapiDeleteMarginOrder(this.extend(request, requestParams));
24173
24281
  }
24174
24282
  else {
24175
- response = await this.privateDeleteOrder(this.extend(request, requestParams));
24283
+ response = await this.privateDeleteOrder(this.extend(request, params));
24176
24284
  }
24177
24285
  return this.parseOrder(response, market);
24178
24286
  }
@@ -24580,11 +24688,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24580
24688
  // },
24581
24689
  // ]
24582
24690
  // }
24583
- const results = this.safeValue(response, 'userAssetDribblets', []);
24691
+ const results = this.safeList(response, 'userAssetDribblets', []);
24584
24692
  const rows = this.safeInteger(response, 'total', 0);
24585
24693
  const data = [];
24586
24694
  for (let i = 0; i < rows; i++) {
24587
- const logs = this.safeValue(results[i], 'userAssetDribbletDetails', []);
24695
+ const logs = this.safeList(results[i], 'userAssetDribbletDetails', []);
24588
24696
  for (let j = 0; j < logs.length; j++) {
24589
24697
  logs[j]['isDustTrade'] = true;
24590
24698
  data.push(logs[j]);
@@ -24691,7 +24799,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24691
24799
  let currency = undefined;
24692
24800
  let response = undefined;
24693
24801
  const request = {};
24694
- const legalMoney = this.safeValue(this.options, 'legalMoney', {});
24802
+ const legalMoney = this.safeDict(this.options, 'legalMoney', {});
24695
24803
  const fiatOnly = this.safeBool(params, 'fiat', false);
24696
24804
  params = this.omit(params, 'fiatOnly');
24697
24805
  const until = this.safeInteger(params, 'until');
@@ -24803,7 +24911,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24803
24911
  if (paginate) {
24804
24912
  return await this.fetchPaginatedCallDynamic('fetchWithdrawals', code, since, limit, params);
24805
24913
  }
24806
- const legalMoney = this.safeValue(this.options, 'legalMoney', {});
24914
+ const legalMoney = this.safeDict(this.options, 'legalMoney', {});
24807
24915
  const fiatOnly = this.safeBool(params, 'fiat', false);
24808
24916
  params = this.omit(params, 'fiatOnly');
24809
24917
  const request = {};
@@ -24947,7 +25055,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24947
25055
  'Refund Failed': 'failed',
24948
25056
  },
24949
25057
  };
24950
- const statuses = this.safeValue(statusesByType, type, {});
25058
+ const statuses = this.safeDict(statusesByType, type, {});
24951
25059
  return this.safeString(statuses, status, status);
24952
25060
  }
24953
25061
  parseTransaction(transaction, currency = undefined) {
@@ -25112,7 +25220,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25112
25220
  const type = this.safeString(transfer, 'type');
25113
25221
  let fromAccount = undefined;
25114
25222
  let toAccount = undefined;
25115
- const accountsById = this.safeValue(this.options, 'accountsById', {});
25223
+ const accountsById = this.safeDict(this.options, 'accountsById', {});
25116
25224
  if (type !== undefined) {
25117
25225
  const parts = type.split('_');
25118
25226
  fromAccount = this.safeValue(parts, 0);
@@ -25148,20 +25256,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25148
25256
  // }
25149
25257
  //
25150
25258
  const marketId = this.safeString(income, 'symbol');
25151
- const symbol = this.safeSymbol(marketId, market, undefined, 'swap');
25152
- const amount = this.safeNumber(income, 'income');
25153
25259
  const currencyId = this.safeString(income, 'asset');
25154
- const code = this.safeCurrencyCode(currencyId);
25155
- const id = this.safeString(income, 'tranId');
25156
25260
  const timestamp = this.safeInteger(income, 'time');
25157
25261
  return {
25158
25262
  'info': income,
25159
- 'symbol': symbol,
25160
- 'code': code,
25263
+ 'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
25264
+ 'code': this.safeCurrencyCode(currencyId),
25161
25265
  'timestamp': timestamp,
25162
25266
  'datetime': this.iso8601(timestamp),
25163
- 'id': id,
25164
- 'amount': amount,
25267
+ 'id': this.safeString(income, 'tranId'),
25268
+ 'amount': this.safeNumber(income, 'income'),
25165
25269
  };
25166
25270
  }
25167
25271
  async transfer(code, amount, fromAccount, toAccount, params = {}) {
@@ -25210,7 +25314,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25210
25314
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' transfer () requires params["symbol"] when toAccount is ' + toAccount);
25211
25315
  }
25212
25316
  }
25213
- const accountsById = this.safeValue(this.options, 'accountsById', {});
25317
+ const accountsById = this.safeDict(this.options, 'accountsById', {});
25214
25318
  const fromIsolated = !(fromId in accountsById);
25215
25319
  const toIsolated = !(toId in accountsById);
25216
25320
  if (fromIsolated && (market === undefined)) {
@@ -25300,7 +25404,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25300
25404
  const defaultTo = (fromAccount === 'future') ? 'spot' : 'future';
25301
25405
  const toAccount = this.safeString(params, 'toAccount', defaultTo);
25302
25406
  let type = this.safeString(params, 'type');
25303
- const accountsByType = this.safeValue(this.options, 'accountsByType', {});
25407
+ const accountsByType = this.safeDict(this.options, 'accountsByType', {});
25304
25408
  const fromId = this.safeString(accountsByType, fromAccount);
25305
25409
  const toId = this.safeString(accountsByType, toAccount);
25306
25410
  if (type === undefined) {
@@ -25344,7 +25448,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25344
25448
  // ]
25345
25449
  // }
25346
25450
  //
25347
- const rows = this.safeValue(response, 'rows', []);
25451
+ const rows = this.safeList(response, 'rows', []);
25348
25452
  return this.parseTransfers(rows, currency, since, limit);
25349
25453
  }
25350
25454
  async fetchDepositAddress(code, params = {}) {
@@ -25363,7 +25467,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25363
25467
  'coin': currency['id'],
25364
25468
  // 'network': 'ETH', // 'BSC', 'XMR', you can get network and isDefault in networkList in the response of sapiGetCapitalConfigDetail
25365
25469
  };
25366
- const networks = this.safeValue(this.options, 'networks', {});
25470
+ const networks = this.safeDict(this.options, 'networks', {});
25367
25471
  let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
25368
25472
  network = this.safeString(networks, network, network); // handle ERC20>ETH alias
25369
25473
  if (network !== undefined) {
@@ -25390,7 +25494,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25390
25494
  const url = this.safeString(response, 'url');
25391
25495
  let impliedNetwork = undefined;
25392
25496
  if (url !== undefined) {
25393
- const reverseNetworks = this.safeValue(this.options, 'reverseNetworks', {});
25497
+ const reverseNetworks = this.safeDict(this.options, 'reverseNetworks', {});
25394
25498
  const parts = url.split('/');
25395
25499
  let topLevel = this.safeString(parts, 2);
25396
25500
  if ((topLevel === 'blockchair.com') || (topLevel === 'viewblock.io')) {
@@ -25405,7 +25509,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25405
25509
  'TRX': { 'TRC20': 'TRX' },
25406
25510
  });
25407
25511
  if (code in impliedNetworks) {
25408
- const conversion = this.safeValue(impliedNetworks, code, {});
25512
+ const conversion = this.safeDict(impliedNetworks, code, {});
25409
25513
  impliedNetwork = this.safeString(conversion, impliedNetwork, impliedNetwork);
25410
25514
  }
25411
25515
  }
@@ -25521,7 +25625,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25521
25625
  const entry = response[i];
25522
25626
  const currencyId = this.safeString(entry, 'coin');
25523
25627
  const code = this.safeCurrencyCode(currencyId);
25524
- const networkList = this.safeValue(entry, 'networkList', []);
25628
+ const networkList = this.safeList(entry, 'networkList', []);
25525
25629
  withdrawFees[code] = {};
25526
25630
  for (let j = 0; j < networkList.length; j++) {
25527
25631
  const networkEntry = networkList[j];
@@ -25634,14 +25738,14 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25634
25738
  // ]
25635
25739
  // }
25636
25740
  //
25637
- const networkList = this.safeValue(fee, 'networkList', []);
25741
+ const networkList = this.safeList(fee, 'networkList', []);
25638
25742
  const result = this.depositWithdrawFee(fee);
25639
25743
  for (let j = 0; j < networkList.length; j++) {
25640
25744
  const networkEntry = networkList[j];
25641
25745
  const networkId = this.safeString(networkEntry, 'network');
25642
25746
  const networkCode = this.networkIdToCode(networkId);
25643
25747
  const withdrawFee = this.safeNumber(networkEntry, 'withdrawFee');
25644
- const isDefault = this.safeValue(networkEntry, 'isDefault');
25748
+ const isDefault = this.safeBool(networkEntry, 'isDefault');
25645
25749
  if (isDefault === true) {
25646
25750
  result['withdraw'] = {
25647
25751
  'fee': withdrawFee,
@@ -25689,7 +25793,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25689
25793
  if (tag !== undefined) {
25690
25794
  request['addressTag'] = tag;
25691
25795
  }
25692
- const networks = this.safeValue(this.options, 'networks', {});
25796
+ const networks = this.safeDict(this.options, 'networks', {});
25693
25797
  let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
25694
25798
  network = this.safeString(networks, network, network); // handle ERC20>ETH alias
25695
25799
  if (network !== undefined) {
@@ -25781,7 +25885,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25781
25885
  //
25782
25886
  let data = response;
25783
25887
  if (Array.isArray(data)) {
25784
- data = this.safeValue(data, 0, {});
25888
+ data = this.safeDict(data, 0, {});
25785
25889
  }
25786
25890
  return this.parseTradingFee(data);
25787
25891
  }
@@ -26195,8 +26299,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26195
26299
  };
26196
26300
  }
26197
26301
  parseAccountPositions(account) {
26198
- const positions = this.safeValue(account, 'positions');
26199
- const assets = this.safeValue(account, 'assets', []);
26302
+ const positions = this.safeList(account, 'positions');
26303
+ const assets = this.safeList(account, 'assets', []);
26200
26304
  const balances = {};
26201
26305
  for (let i = 0; i < assets.length; i++) {
26202
26306
  const entry = assets[i];
@@ -26215,13 +26319,17 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26215
26319
  const marketId = this.safeString(position, 'symbol');
26216
26320
  const market = this.safeMarket(marketId, undefined, undefined, 'contract');
26217
26321
  const code = market['linear'] ? market['quote'] : market['base'];
26218
- // sometimes not all the codes are correctly returned...
26219
- if (code in balances) {
26220
- const parsed = this.parseAccountPosition(this.extend(position, {
26221
- 'crossMargin': balances[code]['crossMargin'],
26222
- 'crossWalletBalance': balances[code]['crossWalletBalance'],
26223
- }), market);
26224
- result.push(parsed);
26322
+ const maintenanceMargin = this.safeString(position, 'maintMargin');
26323
+ // check for maintenance margin so empty positions are not returned
26324
+ if ((maintenanceMargin !== '0') && (maintenanceMargin !== '0.00000000')) {
26325
+ // sometimes not all the codes are correctly returned...
26326
+ if (code in balances) {
26327
+ const parsed = this.parseAccountPosition(this.extend(position, {
26328
+ 'crossMargin': balances[code]['crossMargin'],
26329
+ 'crossWalletBalance': balances[code]['crossWalletBalance'],
26330
+ }), market);
26331
+ result.push(parsed);
26332
+ }
26225
26333
  }
26226
26334
  }
26227
26335
  return result;
@@ -26229,6 +26337,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26229
26337
  parseAccountPosition(position, market = undefined) {
26230
26338
  //
26231
26339
  // usdm
26340
+ //
26232
26341
  // {
26233
26342
  // "symbol": "BTCBUSD",
26234
26343
  // "initialMargin": "0",
@@ -26249,6 +26358,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26249
26358
  // }
26250
26359
  //
26251
26360
  // coinm
26361
+ //
26252
26362
  // {
26253
26363
  // "symbol": "BTCUSD_210625",
26254
26364
  // "initialMargin": "0.00024393",
@@ -26267,6 +26377,46 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26267
26377
  // "crossWalletBalance": "34",
26268
26378
  // }
26269
26379
  //
26380
+ // linear portfolio margin
26381
+ //
26382
+ // {
26383
+ // "symbol": "CTSIUSDT",
26384
+ // "initialMargin": "0",
26385
+ // "maintMargin": "0",
26386
+ // "unrealizedProfit": "0.00000000",
26387
+ // "positionInitialMargin": "0",
26388
+ // "openOrderInitialMargin": "0",
26389
+ // "leverage": "20",
26390
+ // "entryPrice": "0.0",
26391
+ // "maxNotional": "25000",
26392
+ // "bidNotional": "0",
26393
+ // "askNotional": "0",
26394
+ // "positionSide": "SHORT",
26395
+ // "positionAmt": "0",
26396
+ // "updateTime": 0,
26397
+ // "notional": "0",
26398
+ // "breakEvenPrice": "0.0"
26399
+ // }
26400
+ //
26401
+ // inverse portoflio margin
26402
+ //
26403
+ // {
26404
+ // "symbol": "TRXUSD_PERP",
26405
+ // "initialMargin": "0",
26406
+ // "maintMargin": "0",
26407
+ // "unrealizedProfit": "0.00000000",
26408
+ // "positionInitialMargin": "0",
26409
+ // "openOrderInitialMargin": "0",
26410
+ // "leverage": "20",
26411
+ // "entryPrice": "0.00000000",
26412
+ // "positionSide": "SHORT",
26413
+ // "positionAmt": "0",
26414
+ // "maxQty": "5000000",
26415
+ // "updateTime": 0,
26416
+ // "notionalValue": "0",
26417
+ // "breakEvenPrice": "0.00000000"
26418
+ // }
26419
+ //
26270
26420
  const marketId = this.safeString(position, 'symbol');
26271
26421
  market = this.safeMarket(marketId, market, undefined, 'contract');
26272
26422
  const symbol = this.safeString(market, 'symbol');
@@ -26297,8 +26447,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26297
26447
  contractsStringAbs = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringDiv(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(contractsString, '0.5'), '1', 0);
26298
26448
  }
26299
26449
  const contracts = this.parseNumber(contractsStringAbs);
26300
- const leverageBrackets = this.safeValue(this.options, 'leverageBrackets', {});
26301
- const leverageBracket = this.safeValue(leverageBrackets, symbol, []);
26450
+ const leverageBrackets = this.safeDict(this.options, 'leverageBrackets', {});
26451
+ const leverageBracket = this.safeList(leverageBrackets, symbol, []);
26302
26452
  let maintenanceMarginPercentageString = undefined;
26303
26453
  for (let i = 0; i < leverageBracket.length; i++) {
26304
26454
  const bracket = leverageBracket[i];
@@ -26314,7 +26464,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26314
26464
  if (timestamp === 0) {
26315
26465
  timestamp = undefined;
26316
26466
  }
26317
- const isolated = this.safeValue(position, 'isolated');
26467
+ const isolated = this.safeBool(position, 'isolated');
26318
26468
  let marginMode = undefined;
26319
26469
  let collateralString = undefined;
26320
26470
  let walletBalance = undefined;
@@ -26467,11 +26617,45 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26467
26617
  // "isolatedWallet": "0.00268058"
26468
26618
  // }
26469
26619
  //
26620
+ // inverse portfolio margin
26621
+ //
26622
+ // {
26623
+ // "symbol": "ETHUSD_PERP",
26624
+ // "positionAmt": "1",
26625
+ // "entryPrice": "2422.400000007",
26626
+ // "markPrice": "2424.51267823",
26627
+ // "unRealizedProfit": "0.0000036",
26628
+ // "liquidationPrice": "293.57678898",
26629
+ // "leverage": "100",
26630
+ // "positionSide": "LONG",
26631
+ // "updateTime": 1707371941861,
26632
+ // "maxQty": "15",
26633
+ // "notionalValue": "0.00412454",
26634
+ // "breakEvenPrice": "2423.368960034"
26635
+ // }
26636
+ //
26637
+ // linear portfolio margin
26638
+ //
26639
+ // {
26640
+ // "symbol": "BTCUSDT",
26641
+ // "positionAmt": "0.01",
26642
+ // "entryPrice": "44525.0",
26643
+ // "markPrice": "45464.1735922",
26644
+ // "unRealizedProfit": "9.39173592",
26645
+ // "liquidationPrice": "38007.16308568",
26646
+ // "leverage": "100",
26647
+ // "positionSide": "LONG",
26648
+ // "updateTime": 1707371879042,
26649
+ // "maxNotionalValue": "500000.0",
26650
+ // "notional": "454.64173592",
26651
+ // "breakEvenPrice": "44542.81"
26652
+ // }
26653
+ //
26470
26654
  const marketId = this.safeString(position, 'symbol');
26471
26655
  market = this.safeMarket(marketId, market, undefined, 'contract');
26472
26656
  const symbol = this.safeString(market, 'symbol');
26473
- const leverageBrackets = this.safeValue(this.options, 'leverageBrackets', {});
26474
- const leverageBracket = this.safeValue(leverageBrackets, symbol, []);
26657
+ const leverageBrackets = this.safeDict(this.options, 'leverageBrackets', {});
26658
+ const leverageBracket = this.safeList(leverageBrackets, symbol, []);
26475
26659
  const notionalString = this.safeString2(position, 'notional', 'notionalValue');
26476
26660
  const notionalStringAbs = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(notionalString);
26477
26661
  let maintenanceMarginPercentageString = undefined;
@@ -26508,7 +26692,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26508
26692
  const linear = ('notional' in position);
26509
26693
  if (marginMode === 'cross') {
26510
26694
  // calculate collateral
26511
- const precision = this.safeValue(market, 'precision', {});
26695
+ const precision = this.safeDict(market, 'precision', {});
26512
26696
  if (linear) {
26513
26697
  // walletBalance = (liquidationPrice * (±1 + mmp) ± entryPrice) * contracts
26514
26698
  let onePlusMaintenanceMarginPercentageString = undefined;
@@ -26615,12 +26799,24 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26615
26799
  const query = this.omit(params, 'type');
26616
26800
  let subType = undefined;
26617
26801
  [subType, params] = this.handleSubTypeAndParams('loadLeverageBrackets', undefined, params, 'linear');
26802
+ let isPortfolioMargin = undefined;
26803
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'loadLeverageBrackets', 'papi', 'portfolioMargin', false);
26618
26804
  let response = undefined;
26619
26805
  if (this.isLinear(type, subType)) {
26620
- response = await this.fapiPrivateGetLeverageBracket(query);
26806
+ if (isPortfolioMargin) {
26807
+ response = await this.papiGetUmLeverageBracket(query);
26808
+ }
26809
+ else {
26810
+ response = await this.fapiPrivateGetLeverageBracket(query);
26811
+ }
26621
26812
  }
26622
26813
  else if (this.isInverse(type, subType)) {
26623
- response = await this.dapiPrivateV2GetLeverageBracket(query);
26814
+ if (isPortfolioMargin) {
26815
+ response = await this.papiGetCmLeverageBracket(query);
26816
+ }
26817
+ else {
26818
+ response = await this.dapiPrivateV2GetLeverageBracket(query);
26819
+ }
26624
26820
  }
26625
26821
  else {
26626
26822
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' loadLeverageBrackets() supports linear and inverse contracts only');
@@ -26630,7 +26826,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26630
26826
  const entry = response[i];
26631
26827
  const marketId = this.safeString(entry, 'symbol');
26632
26828
  const symbol = this.safeSymbol(marketId, undefined, undefined, 'contract');
26633
- const brackets = this.safeValue(entry, 'brackets', []);
26829
+ const brackets = this.safeList(entry, 'brackets', []);
26634
26830
  const result = [];
26635
26831
  for (let j = 0; j < brackets.length; j++) {
26636
26832
  const bracket = brackets[j];
@@ -26650,8 +26846,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26650
26846
  * @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
26651
26847
  * @see https://binance-docs.github.io/apidocs/futures/en/#notional-and-leverage-brackets-user_data
26652
26848
  * @see https://binance-docs.github.io/apidocs/delivery/en/#notional-bracket-for-symbol-user_data
26849
+ * @see https://binance-docs.github.io/apidocs/pm/en/#um-notional-and-leverage-brackets-user_data
26850
+ * @see https://binance-docs.github.io/apidocs/pm/en/#cm-notional-and-leverage-brackets-user_data
26653
26851
  * @param {string[]|undefined} symbols list of unified market symbols
26654
26852
  * @param {object} [params] extra parameters specific to the exchange API endpoint
26853
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch the leverage tiers for a portfolio margin account
26655
26854
  * @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
26656
26855
  */
26657
26856
  await this.loadMarkets();
@@ -26659,12 +26858,24 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26659
26858
  [type, params] = this.handleMarketTypeAndParams('fetchLeverageTiers', undefined, params);
26660
26859
  let subType = undefined;
26661
26860
  [subType, params] = this.handleSubTypeAndParams('fetchLeverageTiers', undefined, params, 'linear');
26861
+ let isPortfolioMargin = undefined;
26862
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchLeverageTiers', 'papi', 'portfolioMargin', false);
26662
26863
  let response = undefined;
26663
26864
  if (this.isLinear(type, subType)) {
26664
- response = await this.fapiPrivateGetLeverageBracket(params);
26865
+ if (isPortfolioMargin) {
26866
+ response = await this.papiGetUmLeverageBracket(params);
26867
+ }
26868
+ else {
26869
+ response = await this.fapiPrivateGetLeverageBracket(params);
26870
+ }
26665
26871
  }
26666
26872
  else if (this.isInverse(type, subType)) {
26667
- response = await this.dapiPrivateV2GetLeverageBracket(params);
26873
+ if (isPortfolioMargin) {
26874
+ response = await this.papiGetCmLeverageBracket(params);
26875
+ }
26876
+ else {
26877
+ response = await this.dapiPrivateV2GetLeverageBracket(params);
26878
+ }
26668
26879
  }
26669
26880
  else {
26670
26881
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchLeverageTiers() supports linear and inverse contracts only');
@@ -26734,7 +26945,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26734
26945
  //
26735
26946
  const marketId = this.safeString(info, 'symbol');
26736
26947
  market = this.safeMarket(marketId, market, undefined, 'contract');
26737
- const brackets = this.safeValue(info, 'brackets', []);
26948
+ const brackets = this.safeList(info, 'brackets', []);
26738
26949
  const tiers = [];
26739
26950
  for (let j = 0; j < brackets.length; j++) {
26740
26951
  const bracket = brackets[j];
@@ -26949,8 +27160,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26949
27160
  * @description fetch account positions
26950
27161
  * @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
26951
27162
  * @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
27163
+ * @see https://binance-docs.github.io/apidocs/pm/en/#get-um-account-detail-user_data
27164
+ * @see https://binance-docs.github.io/apidocs/pm/en/#get-cm-account-detail-user_data
26952
27165
  * @param {string[]|undefined} symbols list of unified market symbols
26953
27166
  * @param {object} [params] extra parameters specific to the exchange API endpoint
27167
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch positions in a portfolio margin account
26954
27168
  * @returns {object} data on account positions
26955
27169
  */
26956
27170
  if (symbols !== undefined) {
@@ -26962,15 +27176,27 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26962
27176
  await this.loadLeverageBrackets(false, params);
26963
27177
  const defaultType = this.safeString(this.options, 'defaultType', 'future');
26964
27178
  const type = this.safeString(params, 'type', defaultType);
26965
- let query = this.omit(params, 'type');
27179
+ params = this.omit(params, 'type');
26966
27180
  let subType = undefined;
26967
- [subType, query] = this.handleSubTypeAndParams('fetchAccountPositions', undefined, params, 'linear');
27181
+ [subType, params] = this.handleSubTypeAndParams('fetchAccountPositions', undefined, params, 'linear');
27182
+ let isPortfolioMargin = undefined;
27183
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchAccountPositions', 'papi', 'portfolioMargin', false);
26968
27184
  let response = undefined;
26969
27185
  if (this.isLinear(type, subType)) {
26970
- response = await this.fapiPrivateV2GetAccount(query);
27186
+ if (isPortfolioMargin) {
27187
+ response = await this.papiGetUmAccount(params);
27188
+ }
27189
+ else {
27190
+ response = await this.fapiPrivateV2GetAccount(params);
27191
+ }
26971
27192
  }
26972
27193
  else if (this.isInverse(type, subType)) {
26973
- response = await this.dapiPrivateGetAccount(query);
27194
+ if (isPortfolioMargin) {
27195
+ response = await this.papiGetCmAccount(params);
27196
+ }
27197
+ else {
27198
+ response = await this.dapiPrivateGetAccount(params);
27199
+ }
26974
27200
  }
26975
27201
  else {
26976
27202
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchPositions() supports linear and inverse contracts only');
@@ -26987,8 +27213,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26987
27213
  * @description fetch positions risk
26988
27214
  * @see https://binance-docs.github.io/apidocs/futures/en/#position-information-v2-user_data
26989
27215
  * @see https://binance-docs.github.io/apidocs/delivery/en/#position-information-user_data
27216
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-um-position-information-user_data
27217
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-cm-position-information-user_data
26990
27218
  * @param {string[]|undefined} symbols list of unified market symbols
26991
27219
  * @param {object} [params] extra parameters specific to the exchange API endpoint
27220
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch positions for a portfolio margin account
26992
27221
  * @returns {object} data on the positions risk
26993
27222
  */
26994
27223
  if (symbols !== undefined) {
@@ -27004,71 +27233,124 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27004
27233
  const type = this.safeString(params, 'type', defaultType);
27005
27234
  let subType = undefined;
27006
27235
  [subType, params] = this.handleSubTypeAndParams('fetchPositionsRisk', undefined, params, 'linear');
27236
+ let isPortfolioMargin = undefined;
27237
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchPositionsRisk', 'papi', 'portfolioMargin', false);
27007
27238
  params = this.omit(params, 'type');
27008
27239
  let response = undefined;
27009
27240
  if (this.isLinear(type, subType)) {
27010
- response = await this.fapiPrivateV2GetPositionRisk(this.extend(request, params));
27011
- // ### Response examples ###
27012
- //
27013
- // For One-way position mode:
27014
- // [
27015
- // {
27016
- // "entryPrice": "0.00000",
27017
- // "marginType": "isolated",
27018
- // "isAutoAddMargin": "false",
27019
- // "isolatedMargin": "0.00000000",
27020
- // "leverage": "10",
27021
- // "liquidationPrice": "0",
27022
- // "markPrice": "6679.50671178",
27023
- // "maxNotionalValue": "20000000",
27024
- // "positionAmt": "0.000",
27025
- // "symbol": "BTCUSDT",
27026
- // "unRealizedProfit": "0.00000000",
27027
- // "positionSide": "BOTH",
27028
- // "updateTime": 0
27029
- // }
27030
- // ]
27031
- //
27032
- // For Hedge position mode:
27033
- // [
27034
- // {
27035
- // "entryPrice": "6563.66500",
27036
- // "marginType": "isolated",
27037
- // "isAutoAddMargin": "false",
27038
- // "isolatedMargin": "15517.54150468",
27039
- // "leverage": "10",
27040
- // "liquidationPrice": "5930.78",
27041
- // "markPrice": "6679.50671178",
27042
- // "maxNotionalValue": "20000000",
27043
- // "positionAmt": "20.000",
27044
- // "symbol": "BTCUSDT",
27045
- // "unRealizedProfit": "2316.83423560"
27046
- // "positionSide": "LONG",
27047
- // "updateTime": 1625474304765
27048
- // },
27049
- // {
27050
- // "entryPrice": "0.00000",
27051
- // "marginType": "isolated",
27052
- // "isAutoAddMargin": "false",
27053
- // "isolatedMargin": "5413.95799991",
27054
- // "leverage": "10",
27055
- // "liquidationPrice": "7189.95",
27056
- // "markPrice": "6679.50671178",
27057
- // "maxNotionalValue": "20000000",
27058
- // "positionAmt": "-10.000",
27059
- // "symbol": "BTCUSDT",
27060
- // "unRealizedProfit": "-1156.46711780",
27061
- // "positionSide": "SHORT",
27062
- // "updateTime": 0
27063
- // }
27064
- // ]
27241
+ if (isPortfolioMargin) {
27242
+ response = await this.papiGetUmPositionRisk(this.extend(request, params));
27243
+ }
27244
+ else {
27245
+ response = await this.fapiPrivateV2GetPositionRisk(this.extend(request, params));
27246
+ }
27065
27247
  }
27066
27248
  else if (this.isInverse(type, subType)) {
27067
- response = await this.dapiPrivateGetPositionRisk(this.extend(request, params));
27249
+ if (isPortfolioMargin) {
27250
+ response = await this.papiGetCmPositionRisk(this.extend(request, params));
27251
+ }
27252
+ else {
27253
+ response = await this.dapiPrivateGetPositionRisk(this.extend(request, params));
27254
+ }
27068
27255
  }
27069
27256
  else {
27070
27257
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchPositionsRisk() supports linear and inverse contracts only');
27071
27258
  }
27259
+ // ### Response examples ###
27260
+ //
27261
+ // For One-way position mode:
27262
+ //
27263
+ // [
27264
+ // {
27265
+ // "entryPrice": "0.00000",
27266
+ // "marginType": "isolated",
27267
+ // "isAutoAddMargin": "false",
27268
+ // "isolatedMargin": "0.00000000",
27269
+ // "leverage": "10",
27270
+ // "liquidationPrice": "0",
27271
+ // "markPrice": "6679.50671178",
27272
+ // "maxNotionalValue": "20000000",
27273
+ // "positionAmt": "0.000",
27274
+ // "symbol": "BTCUSDT",
27275
+ // "unRealizedProfit": "0.00000000",
27276
+ // "positionSide": "BOTH",
27277
+ // "updateTime": 0
27278
+ // }
27279
+ // ]
27280
+ //
27281
+ // For Hedge position mode:
27282
+ //
27283
+ // [
27284
+ // {
27285
+ // "entryPrice": "6563.66500",
27286
+ // "marginType": "isolated",
27287
+ // "isAutoAddMargin": "false",
27288
+ // "isolatedMargin": "15517.54150468",
27289
+ // "leverage": "10",
27290
+ // "liquidationPrice": "5930.78",
27291
+ // "markPrice": "6679.50671178",
27292
+ // "maxNotionalValue": "20000000",
27293
+ // "positionAmt": "20.000",
27294
+ // "symbol": "BTCUSDT",
27295
+ // "unRealizedProfit": "2316.83423560"
27296
+ // "positionSide": "LONG",
27297
+ // "updateTime": 1625474304765
27298
+ // },
27299
+ // {
27300
+ // "entryPrice": "0.00000",
27301
+ // "marginType": "isolated",
27302
+ // "isAutoAddMargin": "false",
27303
+ // "isolatedMargin": "5413.95799991",
27304
+ // "leverage": "10",
27305
+ // "liquidationPrice": "7189.95",
27306
+ // "markPrice": "6679.50671178",
27307
+ // "maxNotionalValue": "20000000",
27308
+ // "positionAmt": "-10.000",
27309
+ // "symbol": "BTCUSDT",
27310
+ // "unRealizedProfit": "-1156.46711780",
27311
+ // "positionSide": "SHORT",
27312
+ // "updateTime": 0
27313
+ // }
27314
+ // ]
27315
+ //
27316
+ // inverse portfolio margin:
27317
+ //
27318
+ // [
27319
+ // {
27320
+ // "symbol": "ETHUSD_PERP",
27321
+ // "positionAmt": "1",
27322
+ // "entryPrice": "2422.400000007",
27323
+ // "markPrice": "2424.51267823",
27324
+ // "unRealizedProfit": "0.0000036",
27325
+ // "liquidationPrice": "293.57678898",
27326
+ // "leverage": "100",
27327
+ // "positionSide": "LONG",
27328
+ // "updateTime": 1707371941861,
27329
+ // "maxQty": "15",
27330
+ // "notionalValue": "0.00412454",
27331
+ // "breakEvenPrice": "2423.368960034"
27332
+ // }
27333
+ // ]
27334
+ //
27335
+ // linear portfolio margin:
27336
+ //
27337
+ // [
27338
+ // {
27339
+ // "symbol": "BTCUSDT",
27340
+ // "positionAmt": "0.01",
27341
+ // "entryPrice": "44525.0",
27342
+ // "markPrice": "45464.1735922",
27343
+ // "unRealizedProfit": "9.39173592",
27344
+ // "liquidationPrice": "38007.16308568",
27345
+ // "leverage": "100",
27346
+ // "positionSide": "LONG",
27347
+ // "updateTime": 1707371879042,
27348
+ // "maxNotionalValue": "500000.0",
27349
+ // "notional": "454.64173592",
27350
+ // "breakEvenPrice": "44542.81"
27351
+ // }
27352
+ // ]
27353
+ //
27072
27354
  const result = [];
27073
27355
  for (let i = 0; i < response.length; i++) {
27074
27356
  const parsed = this.parsePositionRisk(response[i]);
@@ -27084,15 +27366,19 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27084
27366
  * @description fetch the history of funding payments paid and received on this account
27085
27367
  * @see https://binance-docs.github.io/apidocs/futures/en/#get-income-history-user_data
27086
27368
  * @see https://binance-docs.github.io/apidocs/delivery/en/#get-income-history-user_data
27369
+ * @see https://binance-docs.github.io/apidocs/pm/en/#get-um-income-history-user_data
27370
+ * @see https://binance-docs.github.io/apidocs/pm/en/#get-cm-income-history-user_data
27087
27371
  * @param {string} symbol unified market symbol
27088
27372
  * @param {int} [since] the earliest time in ms to fetch funding history for
27089
27373
  * @param {int} [limit] the maximum number of funding history structures to retrieve
27090
27374
  * @param {object} [params] extra parameters specific to the exchange API endpoint
27375
+ * @param {int} [params.until] timestamp in ms of the latest funding history entry
27376
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch the funding history for a portfolio margin account
27091
27377
  * @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
27092
27378
  */
27093
27379
  await this.loadMarkets();
27094
27380
  let market = undefined;
27095
- const request = {
27381
+ let request = {
27096
27382
  'incomeType': 'FUNDING_FEE', // "TRANSFER","WELCOME_BONUS", "REALIZED_PNL","FUNDING_FEE", "COMMISSION" and "INSURANCE_CLEAR"
27097
27383
  };
27098
27384
  if (symbol !== undefined) {
@@ -27104,6 +27390,9 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27104
27390
  }
27105
27391
  let subType = undefined;
27106
27392
  [subType, params] = this.handleSubTypeAndParams('fetchFundingHistory', market, params, 'linear');
27393
+ let isPortfolioMargin = undefined;
27394
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchFundingHistory', 'papi', 'portfolioMargin', false);
27395
+ [request, params] = this.handleUntilOption('endTime', request, params);
27107
27396
  if (since !== undefined) {
27108
27397
  request['startTime'] = since;
27109
27398
  }
@@ -27115,10 +27404,20 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27115
27404
  params = this.omit(params, 'type');
27116
27405
  let response = undefined;
27117
27406
  if (this.isLinear(type, subType)) {
27118
- response = await this.fapiPrivateGetIncome(this.extend(request, params));
27407
+ if (isPortfolioMargin) {
27408
+ response = await this.papiGetUmIncome(this.extend(request, params));
27409
+ }
27410
+ else {
27411
+ response = await this.fapiPrivateGetIncome(this.extend(request, params));
27412
+ }
27119
27413
  }
27120
27414
  else if (this.isInverse(type, subType)) {
27121
- response = await this.dapiPrivateGetIncome(this.extend(request, params));
27415
+ if (isPortfolioMargin) {
27416
+ response = await this.papiGetCmIncome(this.extend(request, params));
27417
+ }
27418
+ else {
27419
+ response = await this.dapiPrivateGetIncome(this.extend(request, params));
27420
+ }
27122
27421
  }
27123
27422
  else {
27124
27423
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchFundingHistory() supports linear and inverse contracts only');
@@ -27132,9 +27431,12 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27132
27431
  * @description set the level of leverage for a market
27133
27432
  * @see https://binance-docs.github.io/apidocs/futures/en/#change-initial-leverage-trade
27134
27433
  * @see https://binance-docs.github.io/apidocs/delivery/en/#change-initial-leverage-trade
27434
+ * @see https://binance-docs.github.io/apidocs/pm/en/#change-um-initial-leverage-trade
27435
+ * @see https://binance-docs.github.io/apidocs/pm/en/#change-cm-initial-leverage-trade
27135
27436
  * @param {float} leverage the rate of leverage
27136
27437
  * @param {string} symbol unified market symbol
27137
27438
  * @param {object} [params] extra parameters specific to the exchange API endpoint
27439
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to set the leverage for a trading pair in a portfolio margin account
27138
27440
  * @returns {object} response from the exchange
27139
27441
  */
27140
27442
  if (symbol === undefined) {
@@ -27151,12 +27453,24 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27151
27453
  'symbol': market['id'],
27152
27454
  'leverage': leverage,
27153
27455
  };
27456
+ let isPortfolioMargin = undefined;
27457
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'setLeverage', 'papi', 'portfolioMargin', false);
27154
27458
  let response = undefined;
27155
27459
  if (market['linear']) {
27156
- response = await this.fapiPrivatePostLeverage(this.extend(request, params));
27460
+ if (isPortfolioMargin) {
27461
+ response = await this.papiPostUmLeverage(this.extend(request, params));
27462
+ }
27463
+ else {
27464
+ response = await this.fapiPrivatePostLeverage(this.extend(request, params));
27465
+ }
27157
27466
  }
27158
27467
  else if (market['inverse']) {
27159
- response = await this.dapiPrivatePostLeverage(this.extend(request, params));
27468
+ if (isPortfolioMargin) {
27469
+ response = await this.papiPostCmLeverage(this.extend(request, params));
27470
+ }
27471
+ else {
27472
+ response = await this.dapiPrivatePostLeverage(this.extend(request, params));
27473
+ }
27160
27474
  }
27161
27475
  else {
27162
27476
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' setLeverage() supports linear and inverse contracts only');
@@ -27238,9 +27552,12 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27238
27552
  * @description set hedged to true or false for a market
27239
27553
  * @see https://binance-docs.github.io/apidocs/futures/en/#change-position-mode-trade
27240
27554
  * @see https://binance-docs.github.io/apidocs/delivery/en/#change-position-mode-trade
27555
+ * @see https://binance-docs.github.io/apidocs/pm/en/#change-um-position-mode-trade
27556
+ * @see https://binance-docs.github.io/apidocs/pm/en/#change-cm-position-mode-trade
27241
27557
  * @param {bool} hedged set to true to use dualSidePosition
27242
27558
  * @param {string} symbol not used by binance setPositionMode ()
27243
27559
  * @param {object} [params] extra parameters specific to the exchange API endpoint
27560
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to set the position mode for a portfolio margin account
27244
27561
  * @returns {object} response from the exchange
27245
27562
  */
27246
27563
  const defaultType = this.safeString(this.options, 'defaultType', 'future');
@@ -27248,6 +27565,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27248
27565
  params = this.omit(params, ['type']);
27249
27566
  let subType = undefined;
27250
27567
  [subType, params] = this.handleSubTypeAndParams('setPositionMode', undefined, params);
27568
+ let isPortfolioMargin = undefined;
27569
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'setPositionMode', 'papi', 'portfolioMargin', false);
27251
27570
  let dualSidePosition = undefined;
27252
27571
  if (hedged) {
27253
27572
  dualSidePosition = 'true';
@@ -27260,11 +27579,20 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27260
27579
  };
27261
27580
  let response = undefined;
27262
27581
  if (this.isInverse(type, subType)) {
27263
- response = await this.dapiPrivatePostPositionSideDual(this.extend(request, params));
27582
+ if (isPortfolioMargin) {
27583
+ response = await this.papiPostCmPositionSideDual(this.extend(request, params));
27584
+ }
27585
+ else {
27586
+ response = await this.dapiPrivatePostPositionSideDual(this.extend(request, params));
27587
+ }
27264
27588
  }
27265
27589
  else {
27266
- // default to future
27267
- response = await this.fapiPrivatePostPositionSideDual(this.extend(request, params));
27590
+ if (isPortfolioMargin) {
27591
+ response = await this.papiPostUmPositionSideDual(this.extend(request, params));
27592
+ }
27593
+ else {
27594
+ response = await this.fapiPrivatePostPositionSideDual(this.extend(request, params));
27595
+ }
27268
27596
  }
27269
27597
  //
27270
27598
  // {
@@ -27464,12 +27792,15 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27464
27792
  * @see https://binance-docs.github.io/apidocs/voptions/en/#account-funding-flow-user_data
27465
27793
  * @see https://binance-docs.github.io/apidocs/futures/en/#get-income-history-user_data
27466
27794
  * @see https://binance-docs.github.io/apidocs/delivery/en/#get-income-history-user_data
27795
+ * @see https://binance-docs.github.io/apidocs/pm/en/#get-um-income-history-user_data
27796
+ * @see https://binance-docs.github.io/apidocs/pm/en/#get-cm-income-history-user_data
27467
27797
  * @param {string} code unified currency code
27468
27798
  * @param {int} [since] timestamp in ms of the earliest ledger entry
27469
27799
  * @param {int} [limit] max number of ledger entrys to return
27470
27800
  * @param {object} [params] extra parameters specific to the exchange API endpoint
27471
27801
  * @param {int} [params.until] timestamp in ms of the latest ledger entry
27472
- * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
27802
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
27803
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch the ledger for a portfolio margin account
27473
27804
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
27474
27805
  */
27475
27806
  await this.loadMarkets();
@@ -27498,6 +27829,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27498
27829
  params = this.omit(params, 'until');
27499
27830
  request['endTime'] = until;
27500
27831
  }
27832
+ let isPortfolioMargin = undefined;
27833
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchLedger', 'papi', 'portfolioMargin', false);
27501
27834
  let response = undefined;
27502
27835
  if (type === 'option') {
27503
27836
  this.checkRequiredArgument('fetchLedger', code, 'code');
@@ -27505,10 +27838,20 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27505
27838
  response = await this.eapiPrivateGetBill(this.extend(request, params));
27506
27839
  }
27507
27840
  else if (this.isLinear(type, subType)) {
27508
- response = await this.fapiPrivateGetIncome(this.extend(request, params));
27841
+ if (isPortfolioMargin) {
27842
+ response = await this.papiGetUmIncome(this.extend(request, params));
27843
+ }
27844
+ else {
27845
+ response = await this.fapiPrivateGetIncome(this.extend(request, params));
27846
+ }
27509
27847
  }
27510
27848
  else if (this.isInverse(type, subType)) {
27511
- response = await this.dapiPrivateGetIncome(this.extend(request, params));
27849
+ if (isPortfolioMargin) {
27850
+ response = await this.papiGetCmIncome(this.extend(request, params));
27851
+ }
27852
+ else {
27853
+ response = await this.dapiPrivateGetIncome(this.extend(request, params));
27854
+ }
27512
27855
  }
27513
27856
  else {
27514
27857
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchLedger() supports contract wallets only');
@@ -27526,7 +27869,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27526
27869
  // }
27527
27870
  // ]
27528
27871
  //
27529
- // futures (fapi, dapi)
27872
+ // futures (fapi, dapi, papi)
27530
27873
  //
27531
27874
  // [
27532
27875
  // {
@@ -27555,7 +27898,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27555
27898
  // "createDate": 1676621042489
27556
27899
  // }
27557
27900
  //
27558
- // futures (fapi, dapi)
27901
+ // futures (fapi, dapi, papi)
27559
27902
  //
27560
27903
  // {
27561
27904
  // "symbol": "",
@@ -27664,7 +28007,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27664
28007
  const isSpotOrMargin = (api.indexOf('sapi') > -1 || api === 'private');
27665
28008
  const marketType = isSpotOrMargin ? 'spot' : 'future';
27666
28009
  const defaultId = (!isSpotOrMargin) ? 'x-xcKtGhcu' : 'x-R4BD3S82';
27667
- const broker = this.safeValue(this.options, 'broker', {});
28010
+ const broker = this.safeDict(this.options, 'broker', {});
27668
28011
  const brokerId = this.safeString(broker, marketType, defaultId);
27669
28012
  params['newClientOrderId'] = brokerId + this.uuid22();
27670
28013
  }
@@ -27692,8 +28035,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27692
28035
  }
27693
28036
  else if ((path === 'batchOrders') || (path.indexOf('sub-account') >= 0) || (path === 'capital/withdraw/apply') || (path.indexOf('staking') >= 0)) {
27694
28037
  if ((method === 'DELETE') && (path === 'batchOrders')) {
27695
- const orderidlist = this.safeValue(extendedParams, 'orderidlist', []);
27696
- const origclientorderidlist = this.safeValue(extendedParams, 'origclientorderidlist', []);
28038
+ const orderidlist = this.safeList(extendedParams, 'orderidlist', []);
28039
+ const origclientorderidlist = this.safeList(extendedParams, 'origclientorderidlist', []);
27697
28040
  extendedParams = this.omit(extendedParams, ['orderidlist', 'origclientorderidlist']);
27698
28041
  query = this.rawencode(extendedParams);
27699
28042
  const orderidlistLength = orderidlist.length;
@@ -27762,8 +28105,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27762
28105
  marketType = 'portfoliomargin';
27763
28106
  }
27764
28107
  if (marketType !== undefined) {
27765
- const exceptionsForMarketType = this.safeValue(this.exceptions, marketType, {});
27766
- return this.safeValue(exceptionsForMarketType, exactOrBroad, {});
28108
+ const exceptionsForMarketType = this.safeDict(this.exceptions, marketType, {});
28109
+ return this.safeDict(exceptionsForMarketType, exactOrBroad, {});
27767
28110
  }
27768
28111
  return {};
27769
28112
  }
@@ -27997,7 +28340,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
27997
28340
  // },
27998
28341
  // ]
27999
28342
  //
28000
- const rate = this.safeValue(response, 0);
28343
+ const rate = this.safeDict(response, 0);
28001
28344
  return this.parseBorrowRate(rate);
28002
28345
  }
28003
28346
  async fetchBorrowRateHistory(code, since = undefined, limit = undefined, params = {}) {
@@ -28101,7 +28444,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
28101
28444
  // "success": true
28102
28445
  // }
28103
28446
  //
28104
- const data = this.safeValue(response, 'data');
28447
+ const data = this.safeDict(response, 'data');
28105
28448
  const giftcardCode = this.safeString(data, 'code');
28106
28449
  const id = this.safeString(data, 'referenceNo');
28107
28450
  return {
@@ -28210,7 +28553,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
28210
28553
  // "total": 1
28211
28554
  // }
28212
28555
  //
28213
- const rows = this.safeValue(response, 'rows');
28556
+ const rows = this.safeList(response, 'rows');
28214
28557
  const interest = this.parseBorrowInterests(rows, market);
28215
28558
  return this.filterByCurrencySinceLimit(interest, code, since, limit);
28216
28559
  }
@@ -28237,9 +28580,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
28237
28580
  * @name binance#repayCrossMargin
28238
28581
  * @description repay borrowed margin and interest
28239
28582
  * @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-borrow-repay-margin
28583
+ * @see https://binance-docs.github.io/apidocs/pm/en/#margin-account-repay-margin
28240
28584
  * @param {string} code unified currency code of the currency to repay
28241
28585
  * @param {float} amount the amount to repay
28242
28586
  * @param {object} [params] extra parameters specific to the exchange API endpoint
28587
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to repay margin in a portfolio margin account
28243
28588
  * @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
28244
28589
  */
28245
28590
  await this.loadMarkets();
@@ -28247,10 +28592,18 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
28247
28592
  const request = {
28248
28593
  'asset': currency['id'],
28249
28594
  'amount': this.currencyToPrecision(code, amount),
28250
- 'isIsolated': 'FALSE',
28251
- 'type': 'REPAY',
28252
28595
  };
28253
- const response = await this.sapiPostMarginBorrowRepay(this.extend(request, params));
28596
+ let response = undefined;
28597
+ let isPortfolioMargin = undefined;
28598
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'repayCrossMargin', 'papi', 'portfolioMargin', false);
28599
+ if (isPortfolioMargin) {
28600
+ response = await this.papiPostRepayLoan(this.extend(request, params));
28601
+ }
28602
+ else {
28603
+ request['isIsolated'] = 'FALSE';
28604
+ request['type'] = 'REPAY';
28605
+ response = await this.sapiPostMarginBorrowRepay(this.extend(request, params));
28606
+ }
28254
28607
  //
28255
28608
  // {
28256
28609
  // "tranId": 108988250265,
@@ -28296,9 +28649,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
28296
28649
  * @name binance#borrowCrossMargin
28297
28650
  * @description create a loan to borrow margin
28298
28651
  * @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-borrow-repay-margin
28652
+ * @see https://binance-docs.github.io/apidocs/pm/en/#margin-account-borrow-margin
28299
28653
  * @param {string} code unified currency code of the currency to borrow
28300
28654
  * @param {float} amount the amount to borrow
28301
28655
  * @param {object} [params] extra parameters specific to the exchange API endpoint
28656
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to borrow margin in a portfolio margin account
28302
28657
  * @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
28303
28658
  */
28304
28659
  await this.loadMarkets();
@@ -28306,10 +28661,18 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
28306
28661
  const request = {
28307
28662
  'asset': currency['id'],
28308
28663
  'amount': this.currencyToPrecision(code, amount),
28309
- 'isIsolated': 'FALSE',
28310
- 'type': 'BORROW',
28311
28664
  };
28312
- const response = await this.sapiPostMarginBorrowRepay(this.extend(request, params));
28665
+ let response = undefined;
28666
+ let isPortfolioMargin = undefined;
28667
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'borrowCrossMargin', 'papi', 'portfolioMargin', false);
28668
+ if (isPortfolioMargin) {
28669
+ response = await this.papiPostMarginLoan(this.extend(request, params));
28670
+ }
28671
+ else {
28672
+ request['isIsolated'] = 'FALSE';
28673
+ request['type'] = 'BORROW';
28674
+ response = await this.sapiPostMarginBorrowRepay(this.extend(request, params));
28675
+ }
28313
28676
  //
28314
28677
  // {
28315
28678
  // "tranId": 108988250265,
@@ -29321,6 +29684,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
29321
29684
  'trade/order': 3,
29322
29685
  'trade/cancel': 3,
29323
29686
  'trade/batchOrders': 3,
29687
+ 'trade/order/cancelReplace': 3,
29324
29688
  'trade/cancelOrders': 3,
29325
29689
  'trade/cancelOpenOrders': 3,
29326
29690
  },
@@ -29342,12 +29706,19 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
29342
29706
  },
29343
29707
  'swap': {
29344
29708
  'v1': {
29709
+ 'public': {
29710
+ 'get': {
29711
+ 'ticker/price': 1,
29712
+ },
29713
+ },
29345
29714
  'private': {
29346
29715
  'get': {
29347
29716
  'positionSide/dual': 1,
29348
29717
  'market/markPriceKlines': 1,
29718
+ 'trade/batchCancelReplace': 1,
29349
29719
  },
29350
29720
  'post': {
29721
+ 'trade/cancelReplace': 1,
29351
29722
  'positionSide/dual': 1,
29352
29723
  },
29353
29724
  },
@@ -31422,22 +31793,104 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
31422
31793
  // reduceOnly: false
31423
31794
  // }
31424
31795
  //
31796
+ // editOrder (swap)
31797
+ //
31798
+ // {
31799
+ // cancelResult: 'true',
31800
+ // cancelMsg: '',
31801
+ // cancelResponse: {
31802
+ // cancelClientOrderId: '',
31803
+ // cancelOrderId: '1755336244265705472',
31804
+ // symbol: 'SOL-USDT',
31805
+ // orderId: '1755336244265705472',
31806
+ // side: 'SELL',
31807
+ // positionSide: 'SHORT',
31808
+ // type: 'LIMIT',
31809
+ // origQty: '1',
31810
+ // price: '100.000',
31811
+ // executedQty: '0',
31812
+ // avgPrice: '0.000',
31813
+ // cumQuote: '0',
31814
+ // stopPrice: '',
31815
+ // profit: '0.0000',
31816
+ // commission: '0.000000',
31817
+ // status: 'PENDING',
31818
+ // time: '1707339747860',
31819
+ // updateTime: '1707339747860',
31820
+ // clientOrderId: '',
31821
+ // leverage: '20X',
31822
+ // workingType: 'MARK_PRICE',
31823
+ // onlyOnePosition: false,
31824
+ // reduceOnly: false
31825
+ // },
31826
+ // replaceResult: 'true',
31827
+ // replaceMsg: '',
31828
+ // newOrderResponse: {
31829
+ // orderId: '1755338440612995072',
31830
+ // symbol: 'SOL-USDT',
31831
+ // positionSide: 'SHORT',
31832
+ // side: 'SELL',
31833
+ // type: 'LIMIT',
31834
+ // price: '99',
31835
+ // quantity: '2',
31836
+ // stopPrice: '0',
31837
+ // workingType: 'MARK_PRICE',
31838
+ // clientOrderID: '',
31839
+ // timeInForce: 'GTC',
31840
+ // priceRate: '0',
31841
+ // stopLoss: '',
31842
+ // takeProfit: '',
31843
+ // reduceOnly: false
31844
+ // }
31845
+ // }
31846
+ //
31847
+ // editOrder (spot)
31848
+ //
31849
+ // {
31850
+ // cancelResult: { code: '0', msg: '', result: true },
31851
+ // openResult: { code: '0', msg: '', result: true },
31852
+ // orderOpenResponse: {
31853
+ // symbol: 'SOL-USDT',
31854
+ // orderId: '1755334007697866752',
31855
+ // transactTime: '1707339214620',
31856
+ // price: '99',
31857
+ // stopPrice: '0',
31858
+ // origQty: '0.2',
31859
+ // executedQty: '0',
31860
+ // cummulativeQuoteQty: '0',
31861
+ // status: 'PENDING',
31862
+ // type: 'LIMIT',
31863
+ // side: 'SELL',
31864
+ // clientOrderID: ''
31865
+ // },
31866
+ // orderCancelResponse: {
31867
+ // symbol: 'SOL-USDT',
31868
+ // orderId: '1755117055251480576',
31869
+ // price: '100',
31870
+ // stopPrice: '0',
31871
+ // origQty: '0.2',
31872
+ // executedQty: '0',
31873
+ // cummulativeQuoteQty: '0',
31874
+ // status: 'CANCELED',
31875
+ // type: 'LIMIT',
31876
+ // side: 'SELL'
31877
+ // }
31878
+ // }
31879
+ //
31880
+ const info = order;
31881
+ const newOrder = this.safeDict2(order, 'newOrderResponse', 'orderOpenResponse');
31882
+ if (newOrder !== undefined) {
31883
+ order = newOrder;
31884
+ }
31425
31885
  const positionSide = this.safeString2(order, 'positionSide', 'ps');
31426
31886
  const marketType = (positionSide === undefined) ? 'spot' : 'swap';
31427
31887
  const marketId = this.safeString2(order, 'symbol', 's');
31428
31888
  if (market === undefined) {
31429
31889
  market = this.safeMarket(marketId, undefined, undefined, marketType);
31430
31890
  }
31431
- const symbol = this.safeSymbol(marketId, market, '-', marketType);
31432
- const orderId = this.safeString2(order, 'orderId', 'i');
31433
31891
  const side = this.safeStringLower2(order, 'side', 'S');
31434
- const type = this.safeStringLower2(order, 'type', 'o');
31435
31892
  const timestamp = this.safeIntegerN(order, ['time', 'transactTime', 'E']);
31436
31893
  const lastTradeTimestamp = this.safeInteger2(order, 'updateTime', 'T');
31437
- const price = this.safeString2(order, 'price', 'p');
31438
- const average = this.safeString2(order, 'avgPrice', 'ap');
31439
- const amount = this.safeString2(order, 'origQty', 'q');
31440
- const filled = this.safeString2(order, 'executedQty', 'z');
31441
31894
  const statusId = this.safeString2(order, 'status', 'X');
31442
31895
  let feeCurrencyCode = this.safeString2(order, 'feeAsset', 'N');
31443
31896
  const feeCost = this.safeStringN(order, ['fee', 'commission', 'n']);
@@ -31454,11 +31907,6 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
31454
31907
  feeCurrencyCode = market['quote'];
31455
31908
  }
31456
31909
  }
31457
- const fee = {
31458
- 'currency': feeCurrencyCode,
31459
- 'cost': _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(feeCost),
31460
- };
31461
- const clientOrderId = this.safeStringN(order, ['clientOrderID', 'origClientOrderId', 'c']);
31462
31910
  let stopLoss = this.safeValue(order, 'stopLoss');
31463
31911
  let stopLossPrice = undefined;
31464
31912
  if ((stopLoss !== undefined) && (stopLoss !== '')) {
@@ -31484,31 +31932,35 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
31484
31932
  takeProfitPrice = this.safeNumber(takeProfit, 'stopPrice');
31485
31933
  }
31486
31934
  return this.safeOrder({
31487
- 'info': order,
31488
- 'id': orderId,
31489
- 'clientOrderId': clientOrderId,
31935
+ 'info': info,
31936
+ 'id': this.safeString2(order, 'orderId', 'i'),
31937
+ 'clientOrderId': this.safeStringN(order, ['clientOrderID', 'origClientOrderId', 'c']),
31938
+ 'symbol': this.safeSymbol(marketId, market, '-', marketType),
31490
31939
  'timestamp': timestamp,
31491
31940
  'datetime': this.iso8601(timestamp),
31492
31941
  'lastTradeTimestamp': lastTradeTimestamp,
31493
31942
  'lastUpdateTimestamp': this.safeInteger(order, 'updateTime'),
31494
- 'symbol': symbol,
31495
- 'type': type,
31496
- 'timeInForce': undefined,
31943
+ 'type': this.safeStringLower2(order, 'type', 'o'),
31944
+ 'timeInForce': this.safeString(order, 'timeInForce'),
31497
31945
  'postOnly': undefined,
31498
31946
  'side': this.parseOrderSide(side),
31499
- 'price': price,
31947
+ 'price': this.safeString2(order, 'price', 'p'),
31500
31948
  'stopPrice': this.safeNumber(order, 'stopPrice'),
31501
31949
  'triggerPrice': this.safeNumber(order, 'stopPrice'),
31502
31950
  'stopLossPrice': stopLossPrice,
31503
31951
  'takeProfitPrice': takeProfitPrice,
31504
- 'average': average,
31952
+ 'average': this.safeString2(order, 'avgPrice', 'ap'),
31505
31953
  'cost': undefined,
31506
- 'amount': amount,
31507
- 'filled': filled,
31954
+ 'amount': this.safeStringN(order, ['origQty', 'q', 'quantity']),
31955
+ 'filled': this.safeString2(order, 'executedQty', 'z'),
31508
31956
  'remaining': undefined,
31509
31957
  'status': this.parseOrderStatus(statusId),
31510
- 'fee': fee,
31958
+ 'fee': {
31959
+ 'currency': feeCurrencyCode,
31960
+ 'cost': _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(feeCost),
31961
+ },
31511
31962
  'trades': undefined,
31963
+ 'reduceOnly': this.safeBool(order, 'reduceOnly'),
31512
31964
  }, market);
31513
31965
  }
31514
31966
  parseOrderStatus(status) {
@@ -33017,6 +33469,144 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
33017
33469
  //
33018
33470
  return await this.swapV1PrivatePostPositionSideDual(this.extend(request, params));
33019
33471
  }
33472
+ async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
33473
+ /**
33474
+ * @method
33475
+ * @name bingx#editOrder
33476
+ * @description cancels an order and places a new order
33477
+ * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20order%20and%20place%20a%20new%20order // spot
33478
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Cancel%20an%20order%20and%20then%20Place%20a%20new%20order // swap
33479
+ * @param {string} id order id
33480
+ * @param {string} symbol unified symbol of the market to create an order in
33481
+ * @param {string} type 'market' or 'limit'
33482
+ * @param {string} side 'buy' or 'sell'
33483
+ * @param {float} amount how much of the currency you want to trade in units of the base currency
33484
+ * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
33485
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
33486
+ * @param {string} [params.stopPrice] Trigger price used for TAKE_STOP_LIMIT, TAKE_STOP_MARKET, TRIGGER_LIMIT, TRIGGER_MARKET order types.
33487
+ * @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered
33488
+ * @param {float} [params.takeProfit.triggerPrice] take profit trigger price
33489
+ * @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
33490
+ * @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
33491
+ *
33492
+ * EXCHANGE SPECIFIC PARAMETERS
33493
+ * @param {string} [params.cancelClientOrderID] the user-defined id of the order to be canceled, 1-40 characters, different orders cannot use the same clientOrderID, only supports a query range of 2 hours
33494
+ * @param {string} [params.cancelRestrictions] cancel orders with specified status, NEW: New order, PENDING: Pending order, PARTIALLY_FILLED: Partially filled
33495
+ * @param {string} [params.cancelReplaceMode] STOP_ON_FAILURE - if the cancel order fails, it will not continue to place a new order, ALLOW_FAILURE - regardless of whether the cancel order succeeds or fails, it will continue to place a new order
33496
+ * @param {float} [params.quoteOrderQty] order amount
33497
+ * @param {string} [params.newClientOrderId] custom order id consisting of letters, numbers, and _, 1-40 characters, different orders cannot use the same newClientOrderId.
33498
+ * @param {string} [params.positionSide] *contract only* position direction, required for single position as BOTH, for both long and short positions only LONG or SHORT can be chosen, defaults to LONG if empty
33499
+ * @param {string} [params.reduceOnly] *contract only* true or false, default=false for single position mode. this parameter is not accepted for both long and short positions mode
33500
+ * @param {float} [params.priceRate] *contract only* for type TRAILING_STOP_Market, Max = 1
33501
+ * @param {string} [params.workingType] *contract only* StopPrice trigger price types, MARK_PRICE (default), CONTRACT_PRICE, or INDEX_PRICE
33502
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
33503
+ */
33504
+ await this.loadMarkets();
33505
+ const market = this.market(symbol);
33506
+ const request = this.createOrderRequest(symbol, type, side, amount, price, params);
33507
+ request['cancelOrderId'] = id;
33508
+ request['cancelReplaceMode'] = 'STOP_ON_FAILURE';
33509
+ let response = undefined;
33510
+ if (market['swap']) {
33511
+ response = await this.swapV1PrivatePostTradeCancelReplace(this.extend(request, params));
33512
+ //
33513
+ // {
33514
+ // code: '0',
33515
+ // msg: '',
33516
+ // data: {
33517
+ // cancelResult: 'true',
33518
+ // cancelMsg: '',
33519
+ // cancelResponse: {
33520
+ // cancelClientOrderId: '',
33521
+ // cancelOrderId: '1755336244265705472',
33522
+ // symbol: 'SOL-USDT',
33523
+ // orderId: '1755336244265705472',
33524
+ // side: 'SELL',
33525
+ // positionSide: 'SHORT',
33526
+ // type: 'LIMIT',
33527
+ // origQty: '1',
33528
+ // price: '100.000',
33529
+ // executedQty: '0',
33530
+ // avgPrice: '0.000',
33531
+ // cumQuote: '0',
33532
+ // stopPrice: '',
33533
+ // profit: '0.0000',
33534
+ // commission: '0.000000',
33535
+ // status: 'PENDING',
33536
+ // time: '1707339747860',
33537
+ // updateTime: '1707339747860',
33538
+ // clientOrderId: '',
33539
+ // leverage: '20X',
33540
+ // workingType: 'MARK_PRICE',
33541
+ // onlyOnePosition: false,
33542
+ // reduceOnly: false
33543
+ // },
33544
+ // replaceResult: 'true',
33545
+ // replaceMsg: '',
33546
+ // newOrderResponse: {
33547
+ // orderId: '1755338440612995072',
33548
+ // symbol: 'SOL-USDT',
33549
+ // positionSide: 'SHORT',
33550
+ // side: 'SELL',
33551
+ // type: 'LIMIT',
33552
+ // price: '99',
33553
+ // quantity: '2',
33554
+ // stopPrice: '0',
33555
+ // workingType: 'MARK_PRICE',
33556
+ // clientOrderID: '',
33557
+ // timeInForce: 'GTC',
33558
+ // priceRate: '0',
33559
+ // stopLoss: '',
33560
+ // takeProfit: '',
33561
+ // reduceOnly: false
33562
+ // }
33563
+ // }
33564
+ // }
33565
+ //
33566
+ }
33567
+ else {
33568
+ response = await this.spotV1PrivatePostTradeOrderCancelReplace(this.extend(request, params));
33569
+ //
33570
+ // {
33571
+ // code: '0',
33572
+ // msg: '',
33573
+ // debugMsg: '',
33574
+ // data: {
33575
+ // cancelResult: { code: '0', msg: '', result: true },
33576
+ // openResult: { code: '0', msg: '', result: true },
33577
+ // orderOpenResponse: {
33578
+ // symbol: 'SOL-USDT',
33579
+ // orderId: '1755334007697866752',
33580
+ // transactTime: '1707339214620',
33581
+ // price: '99',
33582
+ // stopPrice: '0',
33583
+ // origQty: '0.2',
33584
+ // executedQty: '0',
33585
+ // cummulativeQuoteQty: '0',
33586
+ // status: 'PENDING',
33587
+ // type: 'LIMIT',
33588
+ // side: 'SELL',
33589
+ // clientOrderID: ''
33590
+ // },
33591
+ // orderCancelResponse: {
33592
+ // symbol: 'SOL-USDT',
33593
+ // orderId: '1755117055251480576',
33594
+ // price: '100',
33595
+ // stopPrice: '0',
33596
+ // origQty: '0.2',
33597
+ // executedQty: '0',
33598
+ // cummulativeQuoteQty: '0',
33599
+ // status: 'CANCELED',
33600
+ // type: 'LIMIT',
33601
+ // side: 'SELL'
33602
+ // }
33603
+ // }
33604
+ // }
33605
+ //
33606
+ }
33607
+ const data = this.safeDict(response, 'data');
33608
+ return this.parseOrder(data, market);
33609
+ }
33020
33610
  sign(path, section = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
33021
33611
  const type = section[0];
33022
33612
  const version = section[1];
@@ -47634,6 +48224,13 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
47634
48224
  size = this.safeString(order, 'size');
47635
48225
  filled = this.safeString(order, 'baseVolume');
47636
48226
  }
48227
+ let side = this.safeString(order, 'side');
48228
+ const posMode = this.safeString(order, 'posMode');
48229
+ if (posMode === 'hedge_mode' && reduceOnly) {
48230
+ side = (side === 'buy') ? 'sell' : 'buy';
48231
+ // on bitget hedge mode if the position is long the side is always buy, and if the position is short the side is always sell
48232
+ // so the side of the reduceOnly order is inversed
48233
+ }
47637
48234
  return this.safeOrder({
47638
48235
  'info': order,
47639
48236
  'id': this.safeString2(order, 'orderId', 'data'),
@@ -47644,7 +48241,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
47644
48241
  'lastUpdateTimestamp': updateTimestamp,
47645
48242
  'symbol': market['symbol'],
47646
48243
  'type': this.safeString(order, 'orderType'),
47647
- 'side': this.safeString(order, 'side'),
48244
+ 'side': side,
47648
48245
  'price': price,
47649
48246
  'amount': size,
47650
48247
  'cost': this.safeString2(order, 'quoteVolume', 'quoteSize'),
@@ -48170,7 +48767,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
48170
48767
  const takeProfit = this.safeValue(params, 'takeProfit');
48171
48768
  const isStopLoss = stopLoss !== undefined;
48172
48769
  const isTakeProfit = takeProfit !== undefined;
48173
- const trailingTriggerPrice = this.safeString(params, 'trailingTriggerPrice', price);
48770
+ const trailingTriggerPrice = this.safeString(params, 'trailingTriggerPrice', this.numberToString(price));
48174
48771
  const trailingPercent = this.safeString2(params, 'trailingPercent', 'newCallbackRatio');
48175
48772
  const isTrailingPercentOrder = trailingPercent !== undefined;
48176
48773
  if (this.sum(isTriggerOrder, isStopLossOrder, isTakeProfitOrder, isTrailingPercentOrder) > 1) {
@@ -51971,7 +52568,11 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
51971
52568
  }
51972
52569
  else {
51973
52570
  if (Object.keys(params).length) {
51974
- const queryInner = '?' + this.urlencode(this.keysort(params));
52571
+ let queryInner = '?' + this.urlencode(this.keysort(params));
52572
+ // check #21169 pr
52573
+ if (queryInner.indexOf('%24') > -1) {
52574
+ queryInner = queryInner.replace('%24', '$');
52575
+ }
51975
52576
  url += queryInner;
51976
52577
  auth += queryInner;
51977
52578
  }
@@ -65860,6 +66461,7 @@ class bitso extends _abstract_bitso_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
65860
66461
  * @method
65861
66462
  * @name bitso#fetchMarkets
65862
66463
  * @description retrieves data on all markets for bitso
66464
+ * @see https://docs.bitso.com/bitso-api/docs/list-available-books
65863
66465
  * @param {object} [params] extra parameters specific to the exchange API endpoint
65864
66466
  * @returns {object[]} an array of objects representing market data
65865
66467
  */
@@ -66019,6 +66621,7 @@ class bitso extends _abstract_bitso_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
66019
66621
  * @method
66020
66622
  * @name bitso#fetchBalance
66021
66623
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
66624
+ * @see https://docs.bitso.com/bitso-api/docs/get-account-balance
66022
66625
  * @param {object} [params] extra parameters specific to the exchange API endpoint
66023
66626
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
66024
66627
  */
@@ -66056,6 +66659,7 @@ class bitso extends _abstract_bitso_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
66056
66659
  * @method
66057
66660
  * @name bitso#fetchOrderBook
66058
66661
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
66662
+ * @see https://docs.bitso.com/bitso-api/docs/list-order-book
66059
66663
  * @param {string} symbol unified symbol of the market to fetch the order book for
66060
66664
  * @param {int} [limit] the maximum amount of order book entries to return
66061
66665
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -66120,6 +66724,7 @@ class bitso extends _abstract_bitso_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
66120
66724
  * @method
66121
66725
  * @name bitso#fetchTicker
66122
66726
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
66727
+ * @see https://docs.bitso.com/bitso-api/docs/ticker
66123
66728
  * @param {string} symbol unified symbol of the market to fetch the ticker for
66124
66729
  * @param {object} [params] extra parameters specific to the exchange API endpoint
66125
66730
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -66340,6 +66945,7 @@ class bitso extends _abstract_bitso_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
66340
66945
  * @method
66341
66946
  * @name bitso#fetchTrades
66342
66947
  * @description get the list of most recent trades for a particular symbol
66948
+ * @see https://docs.bitso.com/bitso-api/docs/list-trades
66343
66949
  * @param {string} symbol unified symbol of the market to fetch trades for
66344
66950
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
66345
66951
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -66359,6 +66965,7 @@ class bitso extends _abstract_bitso_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
66359
66965
  * @method
66360
66966
  * @name bitso#fetchTradingFees
66361
66967
  * @description fetch the trading fees for multiple markets
66968
+ * @see https://docs.bitso.com/bitso-api/docs/list-fees
66362
66969
  * @param {object} [params] extra parameters specific to the exchange API endpoint
66363
66970
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
66364
66971
  */
@@ -66430,6 +67037,7 @@ class bitso extends _abstract_bitso_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
66430
67037
  * @method
66431
67038
  * @name bitso#fetchMyTrades
66432
67039
  * @description fetch all trades made by the user
67040
+ * @see https://docs.bitso.com/bitso-api/docs/user-trades
66433
67041
  * @param {string} symbol unified market symbol
66434
67042
  * @param {int} [since] the earliest time in ms to fetch trades for
66435
67043
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -66467,6 +67075,7 @@ class bitso extends _abstract_bitso_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
66467
67075
  * @method
66468
67076
  * @name bitso#createOrder
66469
67077
  * @description create a trade order
67078
+ * @see https://docs.bitso.com/bitso-api/docs/place-an-order
66470
67079
  * @param {string} symbol unified symbol of the market to create an order in
66471
67080
  * @param {string} type 'market' or 'limit'
66472
67081
  * @param {string} side 'buy' or 'sell'
@@ -66498,6 +67107,7 @@ class bitso extends _abstract_bitso_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
66498
67107
  * @method
66499
67108
  * @name bitso#cancelOrder
66500
67109
  * @description cancels an open order
67110
+ * @see https://docs.bitso.com/bitso-api/docs/cancel-an-order
66501
67111
  * @param {string} id order id
66502
67112
  * @param {string} symbol not used by bitso cancelOrder ()
66503
67113
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -66514,6 +67124,7 @@ class bitso extends _abstract_bitso_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
66514
67124
  * @method
66515
67125
  * @name bitso#cancelOrders
66516
67126
  * @description cancel multiple orders
67127
+ * @see https://docs.bitso.com/bitso-api/docs/cancel-an-order
66517
67128
  * @param {string[]} ids order ids
66518
67129
  * @param {string} symbol unified market symbol
66519
67130
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -66550,6 +67161,7 @@ class bitso extends _abstract_bitso_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
66550
67161
  * @method
66551
67162
  * @name bitso#cancelAllOrders
66552
67163
  * @description cancel all open orders
67164
+ * @see https://docs.bitso.com/bitso-api/docs/cancel-an-order
66553
67165
  * @param {undefined} symbol bitso does not support canceling orders for only a specific market
66554
67166
  * @param {object} [params] extra parameters specific to the exchange API endpoint
66555
67167
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -66634,6 +67246,7 @@ class bitso extends _abstract_bitso_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
66634
67246
  * @method
66635
67247
  * @name bitso#fetchOpenOrders
66636
67248
  * @description fetch all unfilled currently open orders
67249
+ * @see https://docs.bitso.com/bitso-api/docs/list-open-orders
66637
67250
  * @param {string} symbol unified market symbol
66638
67251
  * @param {int} [since] the earliest time in ms to fetch open orders for
66639
67252
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -66672,6 +67285,7 @@ class bitso extends _abstract_bitso_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
66672
67285
  * @method
66673
67286
  * @name bitso#fetchOrder
66674
67287
  * @description fetches information on an order made by the user
67288
+ * @see https://docs.bitso.com/bitso-api/docs/look-up-orders
66675
67289
  * @param {string} symbol not used by bitso fetchOrder
66676
67290
  * @param {object} [params] extra parameters specific to the exchange API endpoint
66677
67291
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -66694,6 +67308,7 @@ class bitso extends _abstract_bitso_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
66694
67308
  * @method
66695
67309
  * @name bitso#fetchOrderTrades
66696
67310
  * @description fetch all the trades made from a single order
67311
+ * @see https://docs.bitso.com/bitso-api/docs/list-user-trades
66697
67312
  * @param {string} id order id
66698
67313
  * @param {string} symbol unified market symbol
66699
67314
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -66714,6 +67329,7 @@ class bitso extends _abstract_bitso_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
66714
67329
  * @method
66715
67330
  * @name bitso#fetchDeposit
66716
67331
  * @description fetch information on a deposit
67332
+ * @see https://docs.bitso.com/bitso-payouts-funding/docs/fundings
66717
67333
  * @param {string} id deposit id
66718
67334
  * @param {string} code bitso does not support filtering by currency code and will ignore this argument
66719
67335
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -66756,6 +67372,7 @@ class bitso extends _abstract_bitso_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
66756
67372
  * @method
66757
67373
  * @name bitso#fetchDeposits
66758
67374
  * @description fetch all deposits made to an account
67375
+ * @see https://docs.bitso.com/bitso-payouts-funding/docs/fundings
66759
67376
  * @param {string} code unified currency code
66760
67377
  * @param {int} [since] the earliest time in ms to fetch deposits for
66761
67378
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -66831,7 +67448,7 @@ class bitso extends _abstract_bitso_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
66831
67448
  * @name bitso#fetchTransactionFees
66832
67449
  * @deprecated
66833
67450
  * @description please use fetchDepositWithdrawFees instead
66834
- * @see https://bitso.com/api_info#fees
67451
+ * @see https://docs.bitso.com/bitso-api/docs/list-fees
66835
67452
  * @param {string[]|undefined} codes list of unified currency codes
66836
67453
  * @param {object} [params] extra parameters specific to the exchange API endpoint
66837
67454
  * @returns {object[]} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -66924,7 +67541,7 @@ class bitso extends _abstract_bitso_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
66924
67541
  * @method
66925
67542
  * @name bitso#fetchDepositWithdrawFees
66926
67543
  * @description fetch deposit and withdraw fees
66927
- * @see https://bitso.com/api_info#fees
67544
+ * @see https://docs.bitso.com/bitso-api/docs/list-fees
66928
67545
  * @param {string[]|undefined} codes list of unified currency codes
66929
67546
  * @param {object} [params] extra parameters specific to the exchange API endpoint
66930
67547
  * @returns {object[]} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -67731,6 +68348,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
67731
68348
  * @method
67732
68349
  * @name bitstamp#fetchMarkets
67733
68350
  * @description retrieves data on all markets for bitstamp
68351
+ * @see https://www.bitstamp.net/api/#tag/Market-info/operation/GetTradingPairsInfo
67734
68352
  * @param {object} [params] extra parameters specific to the exchange API endpoint
67735
68353
  * @returns {object[]} an array of objects representing market data
67736
68354
  */
@@ -67874,6 +68492,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
67874
68492
  * @method
67875
68493
  * @name bitstamp#fetchCurrencies
67876
68494
  * @description fetches all available currencies on an exchange
68495
+ * @see https://www.bitstamp.net/api/#tag/Market-info/operation/GetTradingPairsInfo
67877
68496
  * @param {object} [params] extra parameters specific to the exchange API endpoint
67878
68497
  * @returns {object} an associative dictionary of currencies
67879
68498
  */
@@ -67922,6 +68541,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
67922
68541
  * @method
67923
68542
  * @name bitstamp#fetchOrderBook
67924
68543
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
68544
+ * @see https://www.bitstamp.net/api/#tag/Order-book/operation/GetOrderBook
67925
68545
  * @param {string} symbol unified symbol of the market to fetch the order book for
67926
68546
  * @param {int} [limit] the maximum amount of order book entries to return
67927
68547
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -68007,6 +68627,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
68007
68627
  * @method
68008
68628
  * @name bitstamp#fetchTicker
68009
68629
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
68630
+ * @see https://www.bitstamp.net/api/#tag/Tickers/operation/GetMarketTicker
68010
68631
  * @param {string} symbol unified symbol of the market to fetch the ticker for
68011
68632
  * @param {object} [params] extra parameters specific to the exchange API endpoint
68012
68633
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -68039,7 +68660,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
68039
68660
  * @method
68040
68661
  * @name bitstamp#fetchTickers
68041
68662
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
68042
- * @see https://www.bitstamp.net/api/#all-tickers
68663
+ * @see https://www.bitstamp.net/api/#tag/Tickers/operation/GetCurrencyPairTickers
68043
68664
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
68044
68665
  * @param {object} [params] extra parameters specific to the exchange API endpoint
68045
68666
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -68269,6 +68890,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
68269
68890
  * @method
68270
68891
  * @name bitstamp#fetchTrades
68271
68892
  * @description get the list of most recent trades for a particular symbol
68893
+ * @see https://www.bitstamp.net/api/#tag/Transactions-public/operation/GetTransactions
68272
68894
  * @param {string} symbol unified symbol of the market to fetch trades for
68273
68895
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
68274
68896
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -68403,6 +69025,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
68403
69025
  * @method
68404
69026
  * @name bitstamp#fetchBalance
68405
69027
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
69028
+ * @see https://www.bitstamp.net/api/#tag/Account-balances/operation/GetAccountBalances
68406
69029
  * @param {object} [params] extra parameters specific to the exchange API endpoint
68407
69030
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
68408
69031
  */
@@ -68433,6 +69056,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
68433
69056
  * @method
68434
69057
  * @name bitstamp#fetchTradingFee
68435
69058
  * @description fetch the trading fees for a market
69059
+ * @see https://www.bitstamp.net/api/#tag/Fees/operation/GetAllTradingFees
68436
69060
  * @param {string} symbol unified market symbol
68437
69061
  * @param {object} [params] extra parameters specific to the exchange API endpoint
68438
69062
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -68473,6 +69097,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
68473
69097
  * @method
68474
69098
  * @name bitstamp#fetchTradingFees
68475
69099
  * @description fetch the trading fees for multiple markets
69100
+ * @see https://www.bitstamp.net/api/#tag/Fees/operation/GetAllTradingFees
68476
69101
  * @param {object} [params] extra parameters specific to the exchange API endpoint
68477
69102
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
68478
69103
  */
@@ -68548,7 +69173,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
68548
69173
  * @method
68549
69174
  * @name bitstamp#fetchDepositWithdrawFees
68550
69175
  * @description fetch deposit and withdraw fees
68551
- * @see https://www.bitstamp.net/api/#balance
69176
+ * @see https://www.bitstamp.net/api/#tag/Fees/operation/GetAllWithdrawalFees
68552
69177
  * @param {string[]|undefined} codes list of unified currency codes
68553
69178
  * @param {object} [params] extra parameters specific to the exchange API endpoint
68554
69179
  * @returns {object[]} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -68681,6 +69306,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
68681
69306
  * @method
68682
69307
  * @name bitstamp#cancelOrder
68683
69308
  * @description cancels an open order
69309
+ * @see https://www.bitstamp.net/api/#tag/Orders/operation/CancelOrder
68684
69310
  * @param {string} id order id
68685
69311
  * @param {string} symbol unified symbol of the market the order was made in
68686
69312
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -68697,6 +69323,8 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
68697
69323
  * @method
68698
69324
  * @name bitstamp#cancelAllOrders
68699
69325
  * @description cancel all open orders
69326
+ * @see https://www.bitstamp.net/api/#tag/Orders/operation/CancelAllOrders
69327
+ * @see https://www.bitstamp.net/api/#tag/Orders/operation/CancelOrdersForMarket
68700
69328
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
68701
69329
  * @param {object} [params] extra parameters specific to the exchange API endpoint
68702
69330
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -68743,6 +69371,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
68743
69371
  * @method
68744
69372
  * @name bitstamp#fetchOrder
68745
69373
  * @description fetches information on an order made by the user
69374
+ * @see https://www.bitstamp.net/api/#tag/Orders/operation/GetOrderStatus
68746
69375
  * @param {string} symbol unified symbol of the market the order was made in
68747
69376
  * @param {object} [params] extra parameters specific to the exchange API endpoint
68748
69377
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -68787,6 +69416,8 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
68787
69416
  * @method
68788
69417
  * @name bitstamp#fetchMyTrades
68789
69418
  * @description fetch all trades made by the user
69419
+ * @see https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactions
69420
+ * @see https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactionsForMarket
68790
69421
  * @param {string} symbol unified market symbol
68791
69422
  * @param {int} [since] the earliest time in ms to fetch trades for
68792
69423
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -68814,6 +69445,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
68814
69445
  * @method
68815
69446
  * @name bitstamp#fetchDepositsWithdrawals
68816
69447
  * @description fetch history of deposits and withdrawals
69448
+ * @see https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactions
68817
69449
  * @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
68818
69450
  * @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
68819
69451
  * @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
@@ -68864,6 +69496,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
68864
69496
  * @method
68865
69497
  * @name bitstamp#fetchWithdrawals
68866
69498
  * @description fetch all withdrawals made from an account
69499
+ * @see https://www.bitstamp.net/api/#tag/Withdrawals/operation/GetWithdrawalRequests
68867
69500
  * @param {string} code unified currency code
68868
69501
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
68869
69502
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -69232,6 +69865,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
69232
69865
  * @method
69233
69866
  * @name bitstamp#fetchLedger
69234
69867
  * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
69868
+ * @see https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactions
69235
69869
  * @param {string} code unified currency code, default is undefined
69236
69870
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
69237
69871
  * @param {int} [limit] max number of ledger entrys to return, default is undefined
@@ -69255,6 +69889,8 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
69255
69889
  * @method
69256
69890
  * @name bitstamp#fetchOpenOrders
69257
69891
  * @description fetch all unfilled currently open orders
69892
+ * @see https://www.bitstamp.net/api/#tag/Orders/operation/GetAllOpenOrders
69893
+ * @see https://www.bitstamp.net/api/#tag/Orders/operation/GetOpenOrdersForMarket
69258
69894
  * @param {string} symbol unified market symbol
69259
69895
  * @param {int} [since] the earliest time in ms to fetch open orders for
69260
69896
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -69302,6 +69938,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
69302
69938
  * @method
69303
69939
  * @name bitstamp#fetchDepositAddress
69304
69940
  * @description fetch the deposit address for a currency associated with this account
69941
+ * @see https://www.bitstamp.net/api/#tag/Deposits/operation/GetCryptoDepositAddress
69305
69942
  * @param {string} code unified currency code
69306
69943
  * @param {object} [params] extra parameters specific to the exchange API endpoint
69307
69944
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
@@ -69328,6 +69965,8 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
69328
69965
  * @method
69329
69966
  * @name bitstamp#withdraw
69330
69967
  * @description make a withdrawal
69968
+ * @see https://www.bitstamp.net/api/#tag/Withdrawals/operation/RequestFiatWithdrawal
69969
+ * @see https://www.bitstamp.net/api/#tag/Withdrawals/operation/RequestCryptoWithdrawal
69331
69970
  * @param {string} code unified currency code
69332
69971
  * @param {float} amount the amount to withdraw
69333
69972
  * @param {string} address the address to withdraw to
@@ -74019,6 +74658,7 @@ class bl3p extends _abstract_bl3p_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
74019
74658
  * @method
74020
74659
  * @name bl3p#fetchBalance
74021
74660
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
74661
+ * @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/authenticated_api/http.md#35---get-account-info--balance
74022
74662
  * @param {object} [params] extra parameters specific to the exchange API endpoint
74023
74663
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
74024
74664
  */
@@ -74039,6 +74679,7 @@ class bl3p extends _abstract_bl3p_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
74039
74679
  * @method
74040
74680
  * @name bl3p#fetchOrderBook
74041
74681
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
74682
+ * @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/public_api/http.md#22---orderbook
74042
74683
  * @param {string} symbol unified symbol of the market to fetch the order book for
74043
74684
  * @param {int} [limit] the maximum amount of order book entries to return
74044
74685
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -74100,6 +74741,7 @@ class bl3p extends _abstract_bl3p_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
74100
74741
  * @method
74101
74742
  * @name bl3p#fetchTicker
74102
74743
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
74744
+ * @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/public_api/http.md#21---ticker
74103
74745
  * @param {string} symbol unified symbol of the market to fetch the ticker for
74104
74746
  * @param {object} [params] extra parameters specific to the exchange API endpoint
74105
74747
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -74163,6 +74805,7 @@ class bl3p extends _abstract_bl3p_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
74163
74805
  * @method
74164
74806
  * @name bl3p#fetchTrades
74165
74807
  * @description get the list of most recent trades for a particular symbol
74808
+ * @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/public_api/http.md#23---last-1000-trades
74166
74809
  * @param {string} symbol unified symbol of the market to fetch trades for
74167
74810
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
74168
74811
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -74195,6 +74838,7 @@ class bl3p extends _abstract_bl3p_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
74195
74838
  * @method
74196
74839
  * @name bl3p#fetchTradingFees
74197
74840
  * @description fetch the trading fees for multiple markets
74841
+ * @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/authenticated_api/http.md#35---get-account-info--balance
74198
74842
  * @param {object} [params] extra parameters specific to the exchange API endpoint
74199
74843
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
74200
74844
  */
@@ -74287,6 +74931,7 @@ class bl3p extends _abstract_bl3p_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
74287
74931
  * @method
74288
74932
  * @name bl3p#cancelOrder
74289
74933
  * @description cancels an open order
74934
+ * @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/authenticated_api/http.md#22---cancel-an-order
74290
74935
  * @param {string} id order id
74291
74936
  * @param {string} symbol unified symbol of the market the order was made in
74292
74937
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -74562,6 +75207,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
74562
75207
  * @method
74563
75208
  * @name blockchaincom#fetchMarkets
74564
75209
  * @description retrieves data on all markets for blockchaincom
75210
+ * @see https://api.blockchain.com/v3/#/unauthenticated/getSymbols
74565
75211
  * @param {object} [params] extra parameters specific to the exchange API endpoint
74566
75212
  * @returns {object[]} an array of objects representing market data
74567
75213
  */
@@ -74692,6 +75338,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
74692
75338
  * @method
74693
75339
  * @name blockchaincom#fetchOrderBook
74694
75340
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
75341
+ * @see https://api.blockchain.com/v3/#/unauthenticated/getL3OrderBook
74695
75342
  * @param {string} symbol unified symbol of the market to fetch the order book for
74696
75343
  * @param {int} [limit] the maximum amount of order book entries to return
74697
75344
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -74704,6 +75351,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
74704
75351
  * @method
74705
75352
  * @name blockchaincom#fetchL3OrderBook
74706
75353
  * @description fetches level 3 information on open orders with bid (buy) and ask (sell) prices, volumes and other data
75354
+ * @see https://api.blockchain.com/v3/#/unauthenticated/getL3OrderBook
74707
75355
  * @param {string} symbol unified market symbol
74708
75356
  * @param {int} [limit] max number of orders to return, default is undefined
74709
75357
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -74774,6 +75422,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
74774
75422
  * @method
74775
75423
  * @name blockchaincom#fetchTicker
74776
75424
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
75425
+ * @see https://api.blockchain.com/v3/#/unauthenticated/getTickerBySymbol
74777
75426
  * @param {string} symbol unified symbol of the market to fetch the ticker for
74778
75427
  * @param {object} [params] extra parameters specific to the exchange API endpoint
74779
75428
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -74791,6 +75440,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
74791
75440
  * @method
74792
75441
  * @name blockchaincom#fetchTickers
74793
75442
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
75443
+ * @see https://api.blockchain.com/v3/#/unauthenticated/getTickers
74794
75444
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
74795
75445
  * @param {object} [params] extra parameters specific to the exchange API endpoint
74796
75446
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -74871,6 +75521,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
74871
75521
  * @method
74872
75522
  * @name blockchaincom#createOrder
74873
75523
  * @description create a trade order
75524
+ * @see https://api.blockchain.com/v3/#/trading/createOrder
74874
75525
  * @param {string} symbol unified symbol of the market to create an order in
74875
75526
  * @param {string} type 'market' or 'limit'
74876
75527
  * @param {string} side 'buy' or 'sell'
@@ -74933,6 +75584,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
74933
75584
  * @method
74934
75585
  * @name blockchaincom#cancelOrder
74935
75586
  * @description cancels an open order
75587
+ * @see https://api.blockchain.com/v3/#/trading/deleteOrder
74936
75588
  * @param {string} id order id
74937
75589
  * @param {string} symbol unified symbol of the market the order was made in
74938
75590
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -74952,6 +75604,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
74952
75604
  * @method
74953
75605
  * @name blockchaincom#cancelAllOrders
74954
75606
  * @description cancel all open orders
75607
+ * @see https://api.blockchain.com/v3/#/trading/deleteAllOrders
74955
75608
  * @param {string} symbol unified market symbol of the market to cancel orders in, all markets are used if undefined, default is undefined
74956
75609
  * @param {object} [params] extra parameters specific to the exchange API endpoint
74957
75610
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -74977,6 +75630,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
74977
75630
  * @method
74978
75631
  * @name blockchaincom#fetchTradingFees
74979
75632
  * @description fetch the trading fees for multiple markets
75633
+ * @see https://api.blockchain.com/v3/#/trading/getFees
74980
75634
  * @param {object} [params] extra parameters specific to the exchange API endpoint
74981
75635
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
74982
75636
  */
@@ -75008,6 +75662,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
75008
75662
  * @method
75009
75663
  * @name blockchaincom#fetchCanceledOrders
75010
75664
  * @description fetches information on multiple canceled orders made by the user
75665
+ * @see https://api.blockchain.com/v3/#/trading/getOrders
75011
75666
  * @param {string} symbol unified market symbol of the market orders were made in
75012
75667
  * @param {int} [since] timestamp in ms of the earliest order, default is undefined
75013
75668
  * @param {int} [limit] max number of orders to return, default is undefined
@@ -75022,6 +75677,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
75022
75677
  * @method
75023
75678
  * @name blockchaincom#fetchClosedOrders
75024
75679
  * @description fetches information on multiple closed orders made by the user
75680
+ * @see https://api.blockchain.com/v3/#/trading/getOrders
75025
75681
  * @param {string} symbol unified market symbol of the market orders were made in
75026
75682
  * @param {int} [since] the earliest time in ms to fetch orders for
75027
75683
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -75036,6 +75692,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
75036
75692
  * @method
75037
75693
  * @name blockchaincom#fetchOpenOrders
75038
75694
  * @description fetch all unfilled currently open orders
75695
+ * @see https://api.blockchain.com/v3/#/trading/getOrders
75039
75696
  * @param {string} symbol unified market symbol
75040
75697
  * @param {int} [since] the earliest time in ms to fetch open orders for
75041
75698
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -75112,6 +75769,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
75112
75769
  * @method
75113
75770
  * @name blockchaincom#fetchMyTrades
75114
75771
  * @description fetch all trades made by the user
75772
+ * @see https://api.blockchain.com/v3/#/trading/getFills
75115
75773
  * @param {string} symbol unified market symbol
75116
75774
  * @param {int} [since] the earliest time in ms to fetch trades for
75117
75775
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -75136,6 +75794,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
75136
75794
  * @method
75137
75795
  * @name blockchaincom#fetchDepositAddress
75138
75796
  * @description fetch the deposit address for a currency associated with this account
75797
+ * @see https://api.blockchain.com/v3/#/payments/getDepositAddress
75139
75798
  * @param {string} code unified currency code
75140
75799
  * @param {object} [params] extra parameters specific to the exchange API endpoint
75141
75800
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
@@ -75249,6 +75908,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
75249
75908
  * @method
75250
75909
  * @name blockchaincom#withdraw
75251
75910
  * @description make a withdrawal
75911
+ * @see https://api.blockchain.com/v3/#/payments/createWithdrawal
75252
75912
  * @param {string} code unified currency code
75253
75913
  * @param {float} amount the amount to withdraw
75254
75914
  * @param {string} address the address to withdraw to
@@ -75283,6 +75943,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
75283
75943
  * @method
75284
75944
  * @name blockchaincom#fetchWithdrawals
75285
75945
  * @description fetch all withdrawals made from an account
75946
+ * @see https://api.blockchain.com/v3/#/payments/getWithdrawals
75286
75947
  * @param {string} code unified currency code
75287
75948
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
75288
75949
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -75309,6 +75970,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
75309
75970
  * @method
75310
75971
  * @name blockchaincom#fetchWithdrawal
75311
75972
  * @description fetch data on a currency withdrawal via the withdrawal id
75973
+ * @see https://api.blockchain.com/v3/#/payments/getWithdrawalById
75312
75974
  * @param {string} id withdrawal id
75313
75975
  * @param {string} code not used by blockchaincom.fetchWithdrawal
75314
75976
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -75326,6 +75988,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
75326
75988
  * @method
75327
75989
  * @name blockchaincom#fetchDeposits
75328
75990
  * @description fetch all deposits made to an account
75991
+ * @see https://api.blockchain.com/v3/#/payments/getDeposits
75329
75992
  * @param {string} code unified currency code
75330
75993
  * @param {int} [since] the earliest time in ms to fetch deposits for
75331
75994
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -75352,6 +76015,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
75352
76015
  * @method
75353
76016
  * @name blockchaincom#fetchDeposit
75354
76017
  * @description fetch information on a deposit
76018
+ * @see https://api.blockchain.com/v3/#/payments/getDepositById
75355
76019
  * @param {string} id deposit id
75356
76020
  * @param {string} code not used by blockchaincom fetchDeposit ()
75357
76021
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -75370,6 +76034,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
75370
76034
  * @method
75371
76035
  * @name blockchaincom#fetchBalance
75372
76036
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
76037
+ * @see https://api.blockchain.com/v3/#/payments/getAccounts
75373
76038
  * @param {object} [params] extra parameters specific to the exchange API endpoint
75374
76039
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
75375
76040
  */
@@ -75416,6 +76081,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
75416
76081
  * @method
75417
76082
  * @name blockchaincom#fetchOrder
75418
76083
  * @description fetches information on an order made by the user
76084
+ * @see https://api.blockchain.com/v3/#/trading/getOrderById
75419
76085
  * @param {string} symbol not used by blockchaincom fetchOrder
75420
76086
  * @param {object} [params] extra parameters specific to the exchange API endpoint
75421
76087
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -77774,6 +78440,7 @@ class btcalpha extends _abstract_btcalpha_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
77774
78440
  * @method
77775
78441
  * @name btcalpha#fetchMarkets
77776
78442
  * @description retrieves data on all markets for btcalpha
78443
+ * @see https://btc-alpha.github.io/api-docs/#list-all-currencies
77777
78444
  * @param {object} [params] extra parameters specific to the exchange API endpoint
77778
78445
  * @returns {object[]} an array of objects representing market data
77779
78446
  */
@@ -78044,6 +78711,7 @@ class btcalpha extends _abstract_btcalpha_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
78044
78711
  * @method
78045
78712
  * @name btcalpha#fetchTrades
78046
78713
  * @description get the list of most recent trades for a particular symbol
78714
+ * @see https://btc-alpha.github.io/api-docs/#list-all-exchanges
78047
78715
  * @param {string} symbol unified symbol of the market to fetch trades for
78048
78716
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
78049
78717
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -78068,6 +78736,7 @@ class btcalpha extends _abstract_btcalpha_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
78068
78736
  * @method
78069
78737
  * @name btcalpha#fetchDeposits
78070
78738
  * @description fetch all deposits made to an account
78739
+ * @see https://btc-alpha.github.io/api-docs/#list-own-deposits
78071
78740
  * @param {string} code unified currency code
78072
78741
  * @param {int} [since] the earliest time in ms to fetch deposits for
78073
78742
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -78097,6 +78766,7 @@ class btcalpha extends _abstract_btcalpha_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
78097
78766
  * @method
78098
78767
  * @name btcalpha#fetchWithdrawals
78099
78768
  * @description fetch all withdrawals made from an account
78769
+ * @see https://btc-alpha.github.io/api-docs/#list-own-made-withdraws
78100
78770
  * @param {string} code unified currency code
78101
78771
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
78102
78772
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -78204,6 +78874,7 @@ class btcalpha extends _abstract_btcalpha_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
78204
78874
  * @method
78205
78875
  * @name btcalpha#fetchOHLCV
78206
78876
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
78877
+ * @see https://btc-alpha.github.io/api-docs/#charts
78207
78878
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
78208
78879
  * @param {string} timeframe the length of time each candle represents
78209
78880
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -78251,6 +78922,7 @@ class btcalpha extends _abstract_btcalpha_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
78251
78922
  * @method
78252
78923
  * @name btcalpha#fetchBalance
78253
78924
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
78925
+ * @see https://btc-alpha.github.io/api-docs/#list-own-wallets
78254
78926
  * @param {object} [params] extra parameters specific to the exchange API endpoint
78255
78927
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
78256
78928
  */
@@ -78438,6 +79110,7 @@ class btcalpha extends _abstract_btcalpha_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
78438
79110
  * @method
78439
79111
  * @name btcalpha#fetchOpenOrders
78440
79112
  * @description fetch all unfilled currently open orders
79113
+ * @see https://btc-alpha.github.io/api-docs/#list-own-orders
78441
79114
  * @param {string} symbol unified market symbol
78442
79115
  * @param {int} [since] the earliest time in ms to fetch open orders for
78443
79116
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -78454,6 +79127,7 @@ class btcalpha extends _abstract_btcalpha_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
78454
79127
  * @method
78455
79128
  * @name btcalpha#fetchClosedOrders
78456
79129
  * @description fetches information on multiple closed orders made by the user
79130
+ * @see https://btc-alpha.github.io/api-docs/#list-own-orders
78457
79131
  * @param {string} symbol unified market symbol of the market orders were made in
78458
79132
  * @param {int} [since] the earliest time in ms to fetch orders for
78459
79133
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -78470,6 +79144,7 @@ class btcalpha extends _abstract_btcalpha_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
78470
79144
  * @method
78471
79145
  * @name btcalpha#fetchMyTrades
78472
79146
  * @description fetch all trades made by the user
79147
+ * @see https://btc-alpha.github.io/api-docs/#list-own-exchanges
78473
79148
  * @param {string} symbol unified market symbol
78474
79149
  * @param {int} [since] the earliest time in ms to fetch trades for
78475
79150
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -78706,6 +79381,7 @@ class btcbox extends _abstract_btcbox_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
78706
79381
  * @method
78707
79382
  * @name btcbox#fetchBalance
78708
79383
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
79384
+ * @see https://blog.btcbox.jp/en/archives/8762#toc13
78709
79385
  * @param {object} [params] extra parameters specific to the exchange API endpoint
78710
79386
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
78711
79387
  */
@@ -78718,6 +79394,7 @@ class btcbox extends _abstract_btcbox_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
78718
79394
  * @method
78719
79395
  * @name btcbox#fetchOrderBook
78720
79396
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
79397
+ * @see https://blog.btcbox.jp/en/archives/8762#toc6
78721
79398
  * @param {string} symbol unified symbol of the market to fetch the order book for
78722
79399
  * @param {int} [limit] the maximum amount of order book entries to return
78723
79400
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -78764,6 +79441,7 @@ class btcbox extends _abstract_btcbox_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
78764
79441
  * @method
78765
79442
  * @name btcbox#fetchTicker
78766
79443
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
79444
+ * @see https://blog.btcbox.jp/en/archives/8762#toc5
78767
79445
  * @param {string} symbol unified symbol of the market to fetch the ticker for
78768
79446
  * @param {object} [params] extra parameters specific to the exchange API endpoint
78769
79447
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -78818,6 +79496,7 @@ class btcbox extends _abstract_btcbox_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
78818
79496
  * @method
78819
79497
  * @name btcbox#fetchTrades
78820
79498
  * @description get the list of most recent trades for a particular symbol
79499
+ * @see https://blog.btcbox.jp/en/archives/8762#toc7
78821
79500
  * @param {string} symbol unified symbol of the market to fetch trades for
78822
79501
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
78823
79502
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -78850,6 +79529,7 @@ class btcbox extends _abstract_btcbox_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
78850
79529
  * @method
78851
79530
  * @name btcbox#createOrder
78852
79531
  * @description create a trade order
79532
+ * @see https://blog.btcbox.jp/en/archives/8762#toc18
78853
79533
  * @param {string} symbol unified symbol of the market to create an order in
78854
79534
  * @param {string} type 'market' or 'limit'
78855
79535
  * @param {string} side 'buy' or 'sell'
@@ -78880,6 +79560,7 @@ class btcbox extends _abstract_btcbox_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
78880
79560
  * @method
78881
79561
  * @name btcbox#cancelOrder
78882
79562
  * @description cancels an open order
79563
+ * @see https://blog.btcbox.jp/en/archives/8762#toc17
78883
79564
  * @param {string} id order id
78884
79565
  * @param {string} symbol unified symbol of the market the order was made in
78885
79566
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -78975,6 +79656,7 @@ class btcbox extends _abstract_btcbox_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
78975
79656
  * @method
78976
79657
  * @name btcbox#fetchOrder
78977
79658
  * @description fetches information on an order made by the user
79659
+ * @see https://blog.btcbox.jp/en/archives/8762#toc16
78978
79660
  * @param {string} symbol unified symbol of the market the order was made in
78979
79661
  * @param {object} [params] extra parameters specific to the exchange API endpoint
78980
79662
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -79043,6 +79725,7 @@ class btcbox extends _abstract_btcbox_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
79043
79725
  * @method
79044
79726
  * @name btcbox#fetchOrders
79045
79727
  * @description fetches information on multiple orders made by the user
79728
+ * @see https://blog.btcbox.jp/en/archives/8762#toc15
79046
79729
  * @param {string} symbol unified market symbol of the market orders were made in
79047
79730
  * @param {int} [since] the earliest time in ms to fetch orders for
79048
79731
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -79056,6 +79739,7 @@ class btcbox extends _abstract_btcbox_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
79056
79739
  * @method
79057
79740
  * @name btcbox#fetchOpenOrders
79058
79741
  * @description fetch all unfilled currently open orders
79742
+ * @see https://blog.btcbox.jp/en/archives/8762#toc15
79059
79743
  * @param {string} symbol unified market symbol
79060
79744
  * @param {int} [since] the earliest time in ms to fetch open orders for
79061
79745
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -79329,6 +80013,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
79329
80013
  * @method
79330
80014
  * @name btcmarkets#fetchDepositsWithdrawals
79331
80015
  * @description fetch history of deposits and withdrawals
80016
+ * @see https://docs.btcmarkets.net/v3/#tag/Fund-Management-APIs/paths/~1v3~1transfers/get
79332
80017
  * @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
79333
80018
  * @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
79334
80019
  * @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
@@ -79342,6 +80027,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
79342
80027
  * @method
79343
80028
  * @name btcmarkets#fetchDeposits
79344
80029
  * @description fetch all deposits made to an account
80030
+ * @see https://docs.btcmarkets.net/v3/#tag/Fund-Management-APIs/paths/~1v3~1deposits/get
79345
80031
  * @param {string} code unified currency code
79346
80032
  * @param {int} [since] the earliest time in ms to fetch deposits for
79347
80033
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -79355,6 +80041,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
79355
80041
  * @method
79356
80042
  * @name btcmarkets#fetchWithdrawals
79357
80043
  * @description fetch all withdrawals made from an account
80044
+ * @see https://docs.btcmarkets.net/v3/#tag/Fund-Management-APIs/paths/~1v3~1withdrawals/get
79358
80045
  * @param {string} code unified currency code
79359
80046
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
79360
80047
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -79488,6 +80175,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
79488
80175
  * @method
79489
80176
  * @name btcmarkets#fetchMarkets
79490
80177
  * @description retrieves data on all markets for btcmarkets
80178
+ * @see https://docs.btcmarkets.net/v3/#tag/Market-Data-APIs/paths/~1v3~1markets/get
79491
80179
  * @param {object} [params] extra parameters specific to the exchange API endpoint
79492
80180
  * @returns {object[]} an array of objects representing market data
79493
80181
  */
@@ -79579,6 +80267,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
79579
80267
  * @method
79580
80268
  * @name btcmarkets#fetchTime
79581
80269
  * @description fetches the current integer timestamp in milliseconds from the exchange server
80270
+ * @see https://docs.btcmarkets.net/v3/#tag/Misc-APIs/paths/~1v3~1time/get
79582
80271
  * @param {object} [params] extra parameters specific to the exchange API endpoint
79583
80272
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
79584
80273
  */
@@ -79608,6 +80297,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
79608
80297
  * @method
79609
80298
  * @name btcmarkets#fetchBalance
79610
80299
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
80300
+ * @see https://docs.btcmarkets.net/v3/#tag/Account-APIs/paths/~1v3~1accounts~1me~1balances/get
79611
80301
  * @param {object} [params] extra parameters specific to the exchange API endpoint
79612
80302
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
79613
80303
  */
@@ -79640,6 +80330,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
79640
80330
  * @method
79641
80331
  * @name btcmarkets#fetchOHLCV
79642
80332
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
80333
+ * @see https://docs.btcmarkets.net/v3/#tag/Market-Data-APIs/paths/~1v3~1markets~1{marketId}~1candles/get
79643
80334
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
79644
80335
  * @param {string} timeframe the length of time each candle represents
79645
80336
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -79679,6 +80370,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
79679
80370
  * @method
79680
80371
  * @name btcmarkets#fetchOrderBook
79681
80372
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
80373
+ * @see https://docs.btcmarkets.net/v3/#tag/Market-Data-APIs/paths/~1v3~1markets~1{marketId}~1orderbook/get
79682
80374
  * @param {string} symbol unified symbol of the market to fetch the order book for
79683
80375
  * @param {int} [limit] the maximum amount of order book entries to return
79684
80376
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -79766,6 +80458,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
79766
80458
  * @method
79767
80459
  * @name btcmarkets#fetchTicker
79768
80460
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
80461
+ * @see https://docs.btcmarkets.net/v3/#tag/Market-Data-APIs/paths/~1v3~1markets~1{marketId}~1ticker/get
79769
80462
  * @param {string} symbol unified symbol of the market to fetch the ticker for
79770
80463
  * @param {object} [params] extra parameters specific to the exchange API endpoint
79771
80464
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -79874,6 +80567,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
79874
80567
  * @method
79875
80568
  * @name btcmarkets#fetchTrades
79876
80569
  * @description get the list of most recent trades for a particular symbol
80570
+ * @see https://docs.btcmarkets.net/v3/#tag/Market-Data-APIs/paths/~1v3~1markets~1{marketId}~1trades/get
79877
80571
  * @param {string} symbol unified symbol of the market to fetch trades for
79878
80572
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
79879
80573
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -79901,6 +80595,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
79901
80595
  * @method
79902
80596
  * @name btcmarkets#createOrder
79903
80597
  * @description create a trade order
80598
+ * @see https://docs.btcmarkets.net/v3/#tag/Order-Placement-APIs/paths/~1v3~1orders/post
79904
80599
  * @param {string} symbol unified symbol of the market to create an order in
79905
80600
  * @param {string} type 'market' or 'limit'
79906
80601
  * @param {string} side 'buy' or 'sell'
@@ -80001,6 +80696,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
80001
80696
  * @method
80002
80697
  * @name btcmarkets#cancelOrders
80003
80698
  * @description cancel multiple orders
80699
+ * @see https://docs.btcmarkets.net/v3/#tag/Batch-Order-APIs/paths/~1v3~1batchorders~1{ids}/delete
80004
80700
  * @param {string[]} ids order ids
80005
80701
  * @param {string} symbol not used by btcmarkets cancelOrders ()
80006
80702
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -80020,6 +80716,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
80020
80716
  * @method
80021
80717
  * @name btcmarkets#cancelOrder
80022
80718
  * @description cancels an open order
80719
+ * @see https://docs.btcmarkets.net/v3/#operation/cancelOrder
80023
80720
  * @param {string} id order id
80024
80721
  * @param {string} symbol not used by btcmarket cancelOrder ()
80025
80722
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -80139,6 +80836,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
80139
80836
  * @method
80140
80837
  * @name btcmarkets#fetchOrder
80141
80838
  * @description fetches information on an order made by the user
80839
+ * @see https://docs.btcmarkets.net/v3/#operation/getOrderById
80142
80840
  * @param {string} symbol not used by btcmarkets fetchOrder
80143
80841
  * @param {object} [params] extra parameters specific to the exchange API endpoint
80144
80842
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -80155,6 +80853,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
80155
80853
  * @method
80156
80854
  * @name btcmarkets#fetchOrders
80157
80855
  * @description fetches information on multiple orders made by the user
80856
+ * @see https://docs.btcmarkets.net/v3/#operation/listOrders
80158
80857
  * @param {string} symbol unified market symbol of the market orders were made in
80159
80858
  * @param {int} [since] the earliest time in ms to fetch orders for
80160
80859
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -80184,6 +80883,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
80184
80883
  * @method
80185
80884
  * @name btcmarkets#fetchOpenOrders
80186
80885
  * @description fetch all unfilled currently open orders
80886
+ * @see https://docs.btcmarkets.net/v3/#operation/listOrders
80187
80887
  * @param {string} symbol unified market symbol
80188
80888
  * @param {int} [since] the earliest time in ms to fetch open orders for
80189
80889
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -80198,6 +80898,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
80198
80898
  * @method
80199
80899
  * @name btcmarkets#fetchClosedOrders
80200
80900
  * @description fetches information on multiple closed orders made by the user
80901
+ * @see https://docs.btcmarkets.net/v3/#operation/listOrders
80201
80902
  * @param {string} symbol unified market symbol of the market orders were made in
80202
80903
  * @param {int} [since] the earliest time in ms to fetch orders for
80203
80904
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -80212,6 +80913,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
80212
80913
  * @method
80213
80914
  * @name btcmarkets#fetchMyTrades
80214
80915
  * @description fetch all trades made by the user
80916
+ * @see https://docs.btcmarkets.net/v3/#operation/getTrades
80215
80917
  * @param {string} symbol unified market symbol
80216
80918
  * @param {int} [since] the earliest time in ms to fetch trades for
80217
80919
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -80266,6 +80968,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
80266
80968
  * @method
80267
80969
  * @name btcmarkets#withdraw
80268
80970
  * @description make a withdrawal
80971
+ * @see https://docs.btcmarkets.net/v3/#tag/Fund-Management-APIs/paths/~1v3~1withdrawals/post
80269
80972
  * @param {string} code unified currency code
80270
80973
  * @param {float} amount the amount to withdraw
80271
80974
  * @param {string} address the address to withdraw to
@@ -83539,6 +84242,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
83539
84242
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
83540
84243
  * @param {int} [limit] the maximum amount of candles to fetch
83541
84244
  * @param {object} [params] extra parameters specific to the exchange API endpoint
84245
+ * @param {int} [params.until] the latest time in ms to fetch orders for
83542
84246
  * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
83543
84247
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
83544
84248
  */
@@ -83552,7 +84256,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
83552
84256
  return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1000);
83553
84257
  }
83554
84258
  const market = this.market(symbol);
83555
- const request = {
84259
+ let request = {
83556
84260
  'symbol': market['id'],
83557
84261
  };
83558
84262
  if (limit === undefined) {
@@ -83564,6 +84268,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
83564
84268
  if (limit !== undefined) {
83565
84269
  request['limit'] = limit; // max 1000, default 1000
83566
84270
  }
84271
+ [request, params] = this.handleUntilOption('end', request, params);
83567
84272
  request['interval'] = this.safeString(this.timeframes, timeframe, timeframe);
83568
84273
  let response = undefined;
83569
84274
  if (market['spot']) {
@@ -90925,6 +91630,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
90925
91630
  'brokerage/orders/batch_cancel',
90926
91631
  'brokerage/orders/edit',
90927
91632
  'brokerage/orders/edit_preview',
91633
+ 'brokerage/orders/preview',
90928
91634
  'brokerage/portfolios',
90929
91635
  'brokerage/portfolios/move_funds',
90930
91636
  'brokerage/convert/quote',
@@ -91134,11 +91840,12 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
91134
91840
  // ]
91135
91841
  // }
91136
91842
  //
91137
- const data = this.safeValue(response, 'data', []);
91138
- const pagination = this.safeValue(response, 'pagination', {});
91843
+ const data = this.safeList(response, 'data', []);
91844
+ const pagination = this.safeDict(response, 'pagination', {});
91139
91845
  const cursor = this.safeString(pagination, 'next_starting_after');
91140
- const accounts = this.safeValue(response, 'data', []);
91141
- const lastIndex = accounts.length - 1;
91846
+ const accounts = this.safeList(response, 'data', []);
91847
+ const length = accounts.length;
91848
+ const lastIndex = length - 1;
91142
91849
  const last = this.safeValue(accounts, lastIndex);
91143
91850
  if ((cursor !== undefined) && (cursor !== '')) {
91144
91851
  last['next_starting_after'] = cursor;
@@ -91187,8 +91894,9 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
91187
91894
  // "size": 9
91188
91895
  // }
91189
91896
  //
91190
- const accounts = this.safeValue(response, 'accounts', []);
91191
- const lastIndex = accounts.length - 1;
91897
+ const accounts = this.safeList(response, 'accounts', []);
91898
+ const length = accounts.length;
91899
+ const lastIndex = length - 1;
91192
91900
  const last = this.safeValue(accounts, lastIndex);
91193
91901
  const cursor = this.safeString(response, 'cursor');
91194
91902
  if ((cursor !== undefined) && (cursor !== '')) {
@@ -92920,11 +93628,12 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
92920
93628
  * @param {string} [params.stop_direction] 'UNKNOWN_STOP_DIRECTION', 'STOP_DIRECTION_STOP_UP', 'STOP_DIRECTION_STOP_DOWN' the direction the stopPrice is triggered from
92921
93629
  * @param {string} [params.end_time] '2023-05-25T17:01:05.092Z' for 'GTD' orders
92922
93630
  * @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
93631
+ * @param {boolean} [params.preview] default to false, wether to use the test/preview endpoint or not
92923
93632
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
92924
93633
  */
92925
93634
  await this.loadMarkets();
92926
93635
  const market = this.market(symbol);
92927
- const request = {
93636
+ let request = {
92928
93637
  'client_order_id': this.uuid(),
92929
93638
  'product_id': market['id'],
92930
93639
  'side': side.toUpperCase(),
@@ -93059,7 +93768,16 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
93059
93768
  }
93060
93769
  }
93061
93770
  params = this.omit(params, ['timeInForce', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'stopPrice', 'stop_price', 'stopDirection', 'stop_direction', 'clientOrderId', 'postOnly', 'post_only', 'end_time']);
93062
- const response = await this.v3PrivatePostBrokerageOrders(this.extend(request, params));
93771
+ const preview = this.safeValue2(params, 'preview', 'test', false);
93772
+ let response = undefined;
93773
+ if (preview) {
93774
+ params = this.omit(params, ['preview', 'test']);
93775
+ request = this.omit(request, 'client_order_id');
93776
+ response = await this.v3PrivatePostBrokerageOrdersPreview(this.extend(request, params));
93777
+ }
93778
+ else {
93779
+ response = await this.v3PrivatePostBrokerageOrders(this.extend(request, params));
93780
+ }
93063
93781
  //
93064
93782
  // successful order
93065
93783
  //
@@ -94311,6 +95029,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
94311
95029
  'users/self/trailing-volume',
94312
95030
  'withdrawals/fee-estimate',
94313
95031
  'conversions/{conversion_id}',
95032
+ 'conversions/fees',
94314
95033
  ],
94315
95034
  'post': [
94316
95035
  'conversions',
@@ -103402,13 +104121,15 @@ class coinlist extends _abstract_coinlist_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
103402
104121
  }
103403
104122
  takerFees = this.sortBy(takerFees, 1, true);
103404
104123
  makerFees = this.sortBy(makerFees, 1, true);
103405
- const firstTier = this.safeValue(takerFees, 0, []);
103406
- const exchangeFees = this.safeValue(this, 'fees', {});
103407
- const exchangeFeesTrading = this.safeValue(exchangeFees, 'trading', {});
103408
- const exchangeFeesTradingTiers = this.safeValue(exchangeFeesTrading, 'tiers', {});
103409
- const exchangeFeesTradingTiersTaker = this.safeValue(exchangeFeesTradingTiers, 'taker', []);
103410
- const exchangeFeesTradingTiersMaker = this.safeValue(exchangeFeesTradingTiers, 'maker', []);
103411
- if ((keysLength === exchangeFeesTradingTiersTaker.length) && (firstTier.length > 0)) {
104124
+ const firstTier = this.safeDict(takerFees, 0, []);
104125
+ const exchangeFees = this.safeDict(this, 'fees', {});
104126
+ const exchangeFeesTrading = this.safeDict(exchangeFees, 'trading', {});
104127
+ const exchangeFeesTradingTiers = this.safeDict(exchangeFeesTrading, 'tiers', {});
104128
+ const exchangeFeesTradingTiersTaker = this.safeList(exchangeFeesTradingTiers, 'taker', []);
104129
+ const exchangeFeesTradingTiersMaker = this.safeList(exchangeFeesTradingTiers, 'maker', []);
104130
+ const exchangeFeesTradingTiersTakerLength = exchangeFeesTradingTiersTaker.length;
104131
+ const firstTierLength = firstTier.length;
104132
+ if ((keysLength === exchangeFeesTradingTiersTakerLength) && (firstTierLength > 0)) {
103412
104133
  for (let i = 0; i < keysLength; i++) {
103413
104134
  takerFees[i][0] = exchangeFeesTradingTiersTaker[i][0];
103414
104135
  makerFees[i][0] = exchangeFeesTradingTiersMaker[i][0];
@@ -106879,7 +107600,8 @@ class coinmetro extends _abstract_coinmetro_js__WEBPACK_IMPORTED_MODULE_0__/* ["
106879
107600
  }
106880
107601
  let type = undefined;
106881
107602
  let referenceId = undefined;
106882
- if (descriptionArray.length > 1) {
107603
+ const length = descriptionArray.length;
107604
+ if (length > 1) {
106883
107605
  type = this.parseLedgerEntryType(descriptionArray[0]);
106884
107606
  if (descriptionArray[1] !== '-') {
106885
107607
  referenceId = descriptionArray[1];
@@ -162369,7 +163091,8 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
162369
163091
  'fetchBalance': true,
162370
163092
  'fetchBorrowRateHistories': false,
162371
163093
  'fetchBorrowRateHistory': false,
162372
- 'fetchClosedOrders': undefined,
163094
+ 'fetchCanceledOrders': true,
163095
+ 'fetchClosedOrders': true,
162373
163096
  'fetchCrossBorrowRate': false,
162374
163097
  'fetchCrossBorrowRates': false,
162375
163098
  'fetchDepositAddress': false,
@@ -163129,37 +163852,30 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
163129
163852
  id = this.safeString(trade, 'executionId');
163130
163853
  }
163131
163854
  let order = this.safeString(trade, 'order_id');
163132
- let symbolId = this.safeString(trade, 'symbol');
163855
+ let marketId = this.safeString(trade, 'symbol');
163133
163856
  let side = this.safeString(trade, 'side');
163134
163857
  let type = undefined;
163135
163858
  const priorEdit = this.safeValue(trade, 'orderPriorEdit');
163136
163859
  const priorExecution = this.safeValue(trade, 'orderPriorExecution');
163137
163860
  if (priorExecution !== undefined) {
163138
163861
  order = this.safeString(priorExecution, 'orderId');
163139
- symbolId = this.safeString(priorExecution, 'symbol');
163862
+ marketId = this.safeString(priorExecution, 'symbol');
163140
163863
  side = this.safeString(priorExecution, 'side');
163141
163864
  type = this.safeString(priorExecution, 'type');
163142
163865
  }
163143
163866
  else if (priorEdit !== undefined) {
163144
163867
  order = this.safeString(priorEdit, 'orderId');
163145
- symbolId = this.safeString(priorEdit, 'symbol');
163868
+ marketId = this.safeString(priorEdit, 'symbol');
163146
163869
  side = this.safeString(priorEdit, 'type');
163147
163870
  type = this.safeString(priorEdit, 'type');
163148
163871
  }
163149
163872
  if (type !== undefined) {
163150
163873
  type = this.parseOrderType(type);
163151
163874
  }
163152
- let symbol = undefined;
163153
- if (symbolId !== undefined) {
163154
- market = this.safeValue(this.markets_by_id, symbolId);
163155
- if (market === undefined) {
163156
- symbol = symbolId;
163157
- }
163158
- }
163159
- symbol = this.safeString(market, 'symbol', symbol);
163875
+ market = this.safeMarket(marketId, market);
163160
163876
  let cost = undefined;
163877
+ const linear = this.safeBool(market, 'linear');
163161
163878
  if ((amount !== undefined) && (price !== undefined) && (market !== undefined)) {
163162
- const linear = this.safeValue(market, 'linear');
163163
163879
  if (linear) {
163164
163880
  cost = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amount, price); // in quote
163165
163881
  }
@@ -163182,15 +163898,15 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
163182
163898
  return this.safeTrade({
163183
163899
  'info': trade,
163184
163900
  'id': id,
163901
+ 'symbol': this.safeString(market, 'symbol'),
163185
163902
  'timestamp': timestamp,
163186
163903
  'datetime': this.iso8601(timestamp),
163187
- 'symbol': symbol,
163188
163904
  'order': order,
163189
163905
  'type': type,
163190
163906
  'side': side,
163191
163907
  'takerOrMaker': takerOrMaker,
163192
163908
  'price': price,
163193
- 'amount': amount,
163909
+ 'amount': linear ? amount : undefined,
163194
163910
  'cost': cost,
163195
163911
  'fee': undefined,
163196
163912
  });
@@ -163523,6 +164239,102 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
163523
164239
  const orders = this.safeValue(response, 'openOrders', []);
163524
164240
  return this.parseOrders(orders, market, since, limit);
163525
164241
  }
164242
+ async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
164243
+ /**
164244
+ * @method
164245
+ * @name krakenfutures#fetchClosedOrders
164246
+ * @see https://docs.futures.kraken.com/#http-api-history-account-history-get-order-events
164247
+ * @description Gets all closed orders, including trigger orders, for an account from the exchange api
164248
+ * @param {string} symbol Unified market symbol
164249
+ * @param {int} [since] Timestamp (ms) of earliest order.
164250
+ * @param {int} [limit] How many orders to return.
164251
+ * @param {object} [params] Exchange specific parameters
164252
+ * @returns An array of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
164253
+ */
164254
+ await this.loadMarkets();
164255
+ let market = undefined;
164256
+ if (symbol !== undefined) {
164257
+ market = this.market(symbol);
164258
+ }
164259
+ const request = {};
164260
+ if (limit !== undefined) {
164261
+ request['count'] = limit;
164262
+ }
164263
+ if (since !== undefined) {
164264
+ request['from'] = since;
164265
+ }
164266
+ const response = await this.historyGetOrders(this.extend(request, params));
164267
+ const allOrders = this.safeList(response, 'elements', []);
164268
+ const closedOrders = [];
164269
+ for (let i = 0; i < allOrders.length; i++) {
164270
+ const order = allOrders[i];
164271
+ const event = this.safeDict(order, 'event', {});
164272
+ const orderPlaced = this.safeDict(event, 'OrderPlaced');
164273
+ if (orderPlaced !== undefined) {
164274
+ const innerOrder = this.safeDict(orderPlaced, 'order', {});
164275
+ const filled = this.safeString(innerOrder, 'filled');
164276
+ if (filled !== '0') {
164277
+ innerOrder['status'] = 'closed'; // status not available in the response
164278
+ closedOrders.push(innerOrder);
164279
+ }
164280
+ }
164281
+ }
164282
+ return this.parseOrders(closedOrders, market, since, limit);
164283
+ }
164284
+ async fetchCanceledOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
164285
+ /**
164286
+ * @method
164287
+ * @name krakenfutures#fetchCanceledOrders
164288
+ * @see https://docs.futures.kraken.com/#http-api-history-account-history-get-order-events
164289
+ * @description Gets all canceled orders, including trigger orders, for an account from the exchange api
164290
+ * @param {string} symbol Unified market symbol
164291
+ * @param {int} [since] Timestamp (ms) of earliest order.
164292
+ * @param {int} [limit] How many orders to return.
164293
+ * @param {object} [params] Exchange specific parameters
164294
+ * @returns An array of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
164295
+ */
164296
+ await this.loadMarkets();
164297
+ let market = undefined;
164298
+ if (symbol !== undefined) {
164299
+ market = this.market(symbol);
164300
+ }
164301
+ const request = {};
164302
+ if (limit !== undefined) {
164303
+ request['count'] = limit;
164304
+ }
164305
+ if (since !== undefined) {
164306
+ request['from'] = since;
164307
+ }
164308
+ const response = await this.historyGetOrders(this.extend(request, params));
164309
+ const allOrders = this.safeList(response, 'elements', []);
164310
+ const canceledAndRejected = [];
164311
+ for (let i = 0; i < allOrders.length; i++) {
164312
+ const order = allOrders[i];
164313
+ const event = this.safeDict(order, 'event', {});
164314
+ const orderPlaced = this.safeDict(event, 'OrderPlaced');
164315
+ if (orderPlaced !== undefined) {
164316
+ const innerOrder = this.safeDict(orderPlaced, 'order', {});
164317
+ const filled = this.safeString(innerOrder, 'filled');
164318
+ if (filled === '0') {
164319
+ innerOrder['status'] = 'canceled'; // status not available in the response
164320
+ canceledAndRejected.push(innerOrder);
164321
+ }
164322
+ }
164323
+ const orderCanceled = this.safeDict(event, 'OrderCancelled');
164324
+ if (orderCanceled !== undefined) {
164325
+ const innerOrder = this.safeDict(orderCanceled, 'order', {});
164326
+ innerOrder['status'] = 'canceled'; // status not available in the response
164327
+ canceledAndRejected.push(innerOrder);
164328
+ }
164329
+ const orderRejected = this.safeDict(event, 'OrderRejected');
164330
+ if (orderRejected !== undefined) {
164331
+ const innerOrder = this.safeDict(orderRejected, 'order', {});
164332
+ innerOrder['status'] = 'rejected'; // status not available in the response
164333
+ canceledAndRejected.push(innerOrder);
164334
+ }
164335
+ }
164336
+ return this.parseOrders(canceledAndRejected, market, since, limit);
164337
+ }
163526
164338
  parseOrderType(orderType) {
163527
164339
  const map = {
163528
164340
  'lmt': 'limit',
@@ -163766,6 +164578,32 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
163766
164578
  // "status": "requiredArgumentMissing",
163767
164579
  // "orderEvents": []
163768
164580
  // }
164581
+ // closed orders
164582
+ // {
164583
+ // uid: '2f00cd63-e61d-44f8-8569-adabde885941',
164584
+ // timestamp: '1707258274849',
164585
+ // event: {
164586
+ // OrderPlaced: {
164587
+ // order: {
164588
+ // uid: '85805e01-9eed-4395-8360-ed1a228237c9',
164589
+ // accountUid: '406142dd-7c5c-4a8b-acbc-5f16eca30009',
164590
+ // tradeable: 'PF_LTCUSD',
164591
+ // direction: 'Buy',
164592
+ // quantity: '0',
164593
+ // filled: '0.1',
164594
+ // timestamp: '1707258274849',
164595
+ // limitPrice: '69.2200000000',
164596
+ // orderType: 'IoC',
164597
+ // clientId: '',
164598
+ // reduceOnly: false,
164599
+ // lastUpdateTimestamp: '1707258274849'
164600
+ // },
164601
+ // reason: 'new_user_order',
164602
+ // reducedQuantity: '',
164603
+ // algoId: ''
164604
+ // }
164605
+ // }
164606
+ // }
163769
164607
  //
163770
164608
  const orderEvents = this.safeValue(order, 'orderEvents', []);
163771
164609
  const errorStatus = this.safeString(order, 'status');
@@ -163828,7 +164666,8 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
163828
164666
  let remaining = this.safeString(details, 'unfilledSize');
163829
164667
  let average = undefined;
163830
164668
  let filled2 = '0.0';
163831
- if (trades.length) {
164669
+ const tradesLength = trades.length;
164670
+ if (tradesLength > 0) {
163832
164671
  let vwapSum = '0.0';
163833
164672
  for (let i = 0; i < trades.length; i++) {
163834
164673
  const trade = trades[i];
@@ -179139,7 +179978,7 @@ class luno extends _abstract_luno_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
179139
179978
  'pair': market['id'],
179140
179979
  };
179141
179980
  if (since !== undefined) {
179142
- request['since'] = parseInt(since);
179981
+ request['since'] = this.parseToInt(since);
179143
179982
  }
179144
179983
  else {
179145
179984
  const duration = 1000 * 1000 * this.parseTimeframe(timeframe);
@@ -182556,7 +183395,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
182556
183395
  async fetchStatus(params = {}) {
182557
183396
  /**
182558
183397
  * @method
182559
- * @name mexc3#fetchStatus
183398
+ * @name mexc#fetchStatus
182560
183399
  * @description the latest known information on the availability of the exchange API
182561
183400
  * @param {object} [params] extra parameters specific to the exchange API endpoint
182562
183401
  * @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
@@ -182593,7 +183432,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
182593
183432
  async fetchTime(params = {}) {
182594
183433
  /**
182595
183434
  * @method
182596
- * @name mexc3#fetchTime
183435
+ * @name mexc#fetchTime
182597
183436
  * @description fetches the current integer timestamp in milliseconds from the exchange server
182598
183437
  * @param {object} [params] extra parameters specific to the exchange API endpoint
182599
183438
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
@@ -182619,7 +183458,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
182619
183458
  async fetchCurrencies(params = {}) {
182620
183459
  /**
182621
183460
  * @method
182622
- * @name mexc3#fetchCurrencies
183461
+ * @name mexc#fetchCurrencies
182623
183462
  * @description fetches all available currencies on an exchange
182624
183463
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#query-the-currency-information
182625
183464
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -182784,8 +183623,8 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
182784
183623
  async fetchMarkets(params = {}) {
182785
183624
  /**
182786
183625
  * @method
182787
- * @name mexc3#fetchMarkets
182788
- * @description retrieves data on all markets for mexc3
183626
+ * @name mexc#fetchMarkets
183627
+ * @description retrieves data on all markets for mexc
182789
183628
  * @param {object} [params] extra parameters specific to the exchange API endpoint
182790
183629
  * @returns {object[]} an array of objects representing market data
182791
183630
  */
@@ -183025,7 +183864,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
183025
183864
  async fetchOrderBook(symbol, limit = undefined, params = {}) {
183026
183865
  /**
183027
183866
  * @method
183028
- * @name mexc3#fetchOrderBook
183867
+ * @name mexc#fetchOrderBook
183029
183868
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#order-book
183030
183869
  * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-contract-s-depth-information
183031
183870
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
@@ -183102,7 +183941,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
183102
183941
  async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
183103
183942
  /**
183104
183943
  * @method
183105
- * @name mexc3#fetchTrades
183944
+ * @name mexc#fetchTrades
183106
183945
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#recent-trades-list
183107
183946
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#compressed-aggregate-trades-list
183108
183947
  * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-contract-transaction-data
@@ -183378,7 +184217,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
183378
184217
  async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
183379
184218
  /**
183380
184219
  * @method
183381
- * @name mexc3#fetchOHLCV
184220
+ * @name mexc#fetchOHLCV
183382
184221
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#kline-candlestick-data
183383
184222
  * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#k-line-data
183384
184223
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
@@ -183500,7 +184339,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
183500
184339
  async fetchTickers(symbols = undefined, params = {}) {
183501
184340
  /**
183502
184341
  * @method
183503
- * @name mexc3#fetchTickers
184342
+ * @name mexc#fetchTickers
183504
184343
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
183505
184344
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
183506
184345
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -183588,7 +184427,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
183588
184427
  async fetchTicker(symbol, params = {}) {
183589
184428
  /**
183590
184429
  * @method
183591
- * @name mexc3#fetchTicker
184430
+ * @name mexc#fetchTicker
183592
184431
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
183593
184432
  * @param {string} symbol unified symbol of the market to fetch the ticker for
183594
184433
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -183778,7 +184617,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
183778
184617
  async fetchBidsAsks(symbols = undefined, params = {}) {
183779
184618
  /**
183780
184619
  * @method
183781
- * @name mexc3#fetchBidsAsks
184620
+ * @name mexc#fetchBidsAsks
183782
184621
  * @description fetches the bid and ask price and volume for multiple markets
183783
184622
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
183784
184623
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -183839,7 +184678,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
183839
184678
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
183840
184679
  /**
183841
184680
  * @method
183842
- * @name mexc3#createOrder
184681
+ * @name mexc#createOrder
183843
184682
  * @description create a trade order
183844
184683
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order
183845
184684
  * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#order-under-maintenance
@@ -184120,7 +184959,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
184120
184959
  async fetchOrder(id, symbol = undefined, params = {}) {
184121
184960
  /**
184122
184961
  * @method
184123
- * @name mexc3#fetchOrder
184962
+ * @name mexc#fetchOrder
184124
184963
  * @description fetches information on an order made by the user
184125
184964
  * @param {string} symbol unified symbol of the market the order was made in
184126
184965
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -184242,7 +185081,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
184242
185081
  async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
184243
185082
  /**
184244
185083
  * @method
184245
- * @name mexc3#fetchOrders
185084
+ * @name mexc#fetchOrders
184246
185085
  * @description fetches information on multiple orders made by the user
184247
185086
  * @param {string} symbol unified market symbol of the market orders were made in
184248
185087
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -184474,7 +185313,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
184474
185313
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
184475
185314
  /**
184476
185315
  * @method
184477
- * @name mexc3#fetchOpenOrders
185316
+ * @name mexc#fetchOpenOrders
184478
185317
  * @description fetch all unfilled currently open orders
184479
185318
  * @param {string} symbol unified market symbol
184480
185319
  * @param {int} [since] the earliest time in ms to fetch open orders for
@@ -184565,7 +185404,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
184565
185404
  async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
184566
185405
  /**
184567
185406
  * @method
184568
- * @name mexc3#fetchClosedOrders
185407
+ * @name mexc#fetchClosedOrders
184569
185408
  * @description fetches information on multiple closed orders made by the user
184570
185409
  * @param {string} symbol unified market symbol of the market orders were made in
184571
185410
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -184578,7 +185417,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
184578
185417
  async fetchCanceledOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
184579
185418
  /**
184580
185419
  * @method
184581
- * @name mexc3#fetchCanceledOrders
185420
+ * @name mexc#fetchCanceledOrders
184582
185421
  * @description fetches information on multiple canceled orders made by the user
184583
185422
  * @param {string} symbol unified market symbol of the market orders were made in
184584
185423
  * @param {int} [since] timestamp in ms of the earliest order, default is undefined
@@ -184607,7 +185446,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
184607
185446
  async cancelOrder(id, symbol = undefined, params = {}) {
184608
185447
  /**
184609
185448
  * @method
184610
- * @name mexc3#cancelOrder
185449
+ * @name mexc#cancelOrder
184611
185450
  * @description cancels an open order
184612
185451
  * @param {string} id order id
184613
185452
  * @param {string} symbol unified symbol of the market the order was made in
@@ -184724,7 +185563,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
184724
185563
  async cancelOrders(ids, symbol = undefined, params = {}) {
184725
185564
  /**
184726
185565
  * @method
184727
- * @name mexc3#cancelOrders
185566
+ * @name mexc#cancelOrders
184728
185567
  * @description cancel multiple orders
184729
185568
  * @param {string[]} ids order ids
184730
185569
  * @param {string} symbol unified market symbol, default is undefined
@@ -184759,7 +185598,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
184759
185598
  async cancelAllOrders(symbol = undefined, params = {}) {
184760
185599
  /**
184761
185600
  * @method
184762
- * @name mexc3#cancelAllOrders
185601
+ * @name mexc#cancelAllOrders
184763
185602
  * @description cancel all open orders
184764
185603
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
184765
185604
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -185162,7 +186001,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
185162
186001
  async fetchAccounts(params = {}) {
185163
186002
  /**
185164
186003
  * @method
185165
- * @name mexc3#fetchAccounts
186004
+ * @name mexc#fetchAccounts
185166
186005
  * @description fetch all the accounts associated with a profile
185167
186006
  * @param {object} [params] extra parameters specific to the exchange API endpoint
185168
186007
  * @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
@@ -185189,7 +186028,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
185189
186028
  async fetchTradingFees(params = {}) {
185190
186029
  /**
185191
186030
  * @method
185192
- * @name mexc3#fetchTradingFees
186031
+ * @name mexc#fetchTradingFees
185193
186032
  * @description fetch the trading fees for multiple markets
185194
186033
  * @param {object} [params] extra parameters specific to the exchange API endpoint
185195
186034
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
@@ -185340,7 +186179,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
185340
186179
  async fetchBalance(params = {}) {
185341
186180
  /**
185342
186181
  * @method
185343
- * @name mexc3#fetchBalance
186182
+ * @name mexc#fetchBalance
185344
186183
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
185345
186184
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#account-information
185346
186185
  * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-all-informations-of-user-39-s-asset
@@ -185474,7 +186313,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
185474
186313
  async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
185475
186314
  /**
185476
186315
  * @method
185477
- * @name mexc3#fetchMyTrades
186316
+ * @name mexc#fetchMyTrades
185478
186317
  * @description fetch all trades made by the user
185479
186318
  * @param {string} symbol unified market symbol
185480
186319
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -185564,7 +186403,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
185564
186403
  async fetchOrderTrades(id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
185565
186404
  /**
185566
186405
  * @method
185567
- * @name mexc3#fetchOrderTrades
186406
+ * @name mexc#fetchOrderTrades
185568
186407
  * @description fetch all the trades made from a single order
185569
186408
  * @param {string} id order id
185570
186409
  * @param {string} symbol unified market symbol
@@ -185662,7 +186501,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
185662
186501
  async reduceMargin(symbol, amount, params = {}) {
185663
186502
  /**
185664
186503
  * @method
185665
- * @name mexc3#reduceMargin
186504
+ * @name mexc#reduceMargin
185666
186505
  * @description remove margin from a position
185667
186506
  * @param {string} symbol unified market symbol
185668
186507
  * @param {float} amount the amount of margin to remove
@@ -185674,7 +186513,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
185674
186513
  async addMargin(symbol, amount, params = {}) {
185675
186514
  /**
185676
186515
  * @method
185677
- * @name mexc3#addMargin
186516
+ * @name mexc#addMargin
185678
186517
  * @description add margin
185679
186518
  * @param {string} symbol unified market symbol
185680
186519
  * @param {float} amount amount of margin to add
@@ -185686,7 +186525,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
185686
186525
  async setLeverage(leverage, symbol = undefined, params = {}) {
185687
186526
  /**
185688
186527
  * @method
185689
- * @name mexc3#setLeverage
186528
+ * @name mexc#setLeverage
185690
186529
  * @description set the level of leverage for a market
185691
186530
  * @param {float} leverage the rate of leverage
185692
186531
  * @param {string} symbol unified market symbol
@@ -185719,7 +186558,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
185719
186558
  async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
185720
186559
  /**
185721
186560
  * @method
185722
- * @name mexc3#fetchFundingHistory
186561
+ * @name mexc#fetchFundingHistory
185723
186562
  * @description fetch the history of funding payments paid and received on this account
185724
186563
  * @param {string} symbol unified market symbol
185725
186564
  * @param {int} [since] the earliest time in ms to fetch funding history for
@@ -185834,7 +186673,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
185834
186673
  async fetchFundingRate(symbol, params = {}) {
185835
186674
  /**
185836
186675
  * @method
185837
- * @name mexc3#fetchFundingRate
186676
+ * @name mexc#fetchFundingRate
185838
186677
  * @description fetch the current funding rate
185839
186678
  * @param {string} symbol unified market symbol
185840
186679
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -185935,7 +186774,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
185935
186774
  async fetchLeverageTiers(symbols = undefined, params = {}) {
185936
186775
  /**
185937
186776
  * @method
185938
- * @name mexc3#fetchLeverageTiers
186777
+ * @name mexc#fetchLeverageTiers
185939
186778
  * @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
185940
186779
  * @param {string[]|undefined} symbols list of unified market symbols
185941
186780
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -186048,7 +186887,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
186048
186887
  async fetchDepositAddressesByNetwork(code, params = {}) {
186049
186888
  /**
186050
186889
  * @method
186051
- * @name mexc3#fetchDepositAddressesByNetwork
186890
+ * @name mexc#fetchDepositAddressesByNetwork
186052
186891
  * @description fetch a dictionary of addresses for a currency, indexed by network
186053
186892
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#deposit-address-supporting-network
186054
186893
  * @param {string} code unified currency code of the currency for the deposit address
@@ -186088,7 +186927,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
186088
186927
  async createDepositAddress(code, params = {}) {
186089
186928
  /**
186090
186929
  * @method
186091
- * @name mexc3#createDepositAddress
186930
+ * @name mexc#createDepositAddress
186092
186931
  * @description create a currency deposit address
186093
186932
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#generate-deposit-address-supporting-network
186094
186933
  * @param {string} code unified currency code of the currency for the deposit address
@@ -186128,7 +186967,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
186128
186967
  async fetchDepositAddress(code, params = {}) {
186129
186968
  /**
186130
186969
  * @method
186131
- * @name mexc3#fetchDepositAddress
186970
+ * @name mexc#fetchDepositAddress
186132
186971
  * @description fetch the deposit address for a currency associated with this account
186133
186972
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#deposit-address-supporting-network
186134
186973
  * @param {string} code unified currency code
@@ -186156,7 +186995,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
186156
186995
  async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
186157
186996
  /**
186158
186997
  * @method
186159
- * @name mexc3#fetchDeposits
186998
+ * @name mexc#fetchDeposits
186160
186999
  * @description fetch all deposits made to an account
186161
187000
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#deposit-history-supporting-network
186162
187001
  * @param {string} code unified currency code
@@ -186216,7 +187055,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
186216
187055
  async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
186217
187056
  /**
186218
187057
  * @method
186219
- * @name mexc3#fetchWithdrawals
187058
+ * @name mexc#fetchWithdrawals
186220
187059
  * @description fetch all withdrawals made from an account
186221
187060
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#withdraw-history-supporting-network
186222
187061
  * @param {string} code unified currency code
@@ -186393,7 +187232,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
186393
187232
  async fetchPosition(symbol, params = {}) {
186394
187233
  /**
186395
187234
  * @method
186396
- * @name mexc3#fetchPosition
187235
+ * @name mexc#fetchPosition
186397
187236
  * @description fetch data on a single open contract trade position
186398
187237
  * @param {string} symbol unified market symbol of the market the position is held in, default is undefined
186399
187238
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -186410,7 +187249,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
186410
187249
  async fetchPositions(symbols = undefined, params = {}) {
186411
187250
  /**
186412
187251
  * @method
186413
- * @name mexc3#fetchPositions
187252
+ * @name mexc#fetchPositions
186414
187253
  * @description fetch all open positions
186415
187254
  * @param {string[]|undefined} symbols list of unified market symbols
186416
187255
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -186550,7 +187389,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
186550
187389
  async fetchTransfers(code = undefined, since = undefined, limit = undefined, params = {}) {
186551
187390
  /**
186552
187391
  * @method
186553
- * @name mexc3#fetchTransfers
187392
+ * @name mexc#fetchTransfers
186554
187393
  * @description fetch a history of internal transfers made on an account
186555
187394
  * @param {string} code unified currency code of the currency transferred
186556
187395
  * @param {int} [since] the earliest time in ms to fetch transfers for
@@ -186637,7 +187476,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
186637
187476
  async transfer(code, amount, fromAccount, toAccount, params = {}) {
186638
187477
  /**
186639
187478
  * @method
186640
- * @name mexc3#transfer
187479
+ * @name mexc#transfer
186641
187480
  * @description transfer currency internally between wallets on the same account
186642
187481
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#user-universal-transfer
186643
187482
  * @param {string} code unified currency code
@@ -186770,7 +187609,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
186770
187609
  async withdraw(code, amount, address, tag = undefined, params = {}) {
186771
187610
  /**
186772
187611
  * @method
186773
- * @name mexc3#withdraw
187612
+ * @name mexc#withdraw
186774
187613
  * @description make a withdrawal
186775
187614
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#withdraw
186776
187615
  * @param {string} code unified currency code
@@ -186838,7 +187677,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
186838
187677
  async fetchTransactionFees(codes = undefined, params = {}) {
186839
187678
  /**
186840
187679
  * @method
186841
- * @name mexc3#fetchTransactionFees
187680
+ * @name mexc#fetchTransactionFees
186842
187681
  * @description fetch deposit and withdrawal fees
186843
187682
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#query-the-currency-information
186844
187683
  * @param {string[]|undefined} codes returns fees for all currencies if undefined
@@ -186936,7 +187775,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
186936
187775
  async fetchDepositWithdrawFees(codes = undefined, params = {}) {
186937
187776
  /**
186938
187777
  * @method
186939
- * @name mexc3#fetchDepositWithdrawFees
187778
+ * @name mexc#fetchDepositWithdrawFees
186940
187779
  * @description fetch deposit and withdrawal fees
186941
187780
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#query-the-currency-information
186942
187781
  * @param {string[]|undefined} codes returns fees for all currencies if undefined
@@ -195567,6 +196406,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
195567
196406
  'trade/easy-convert-history': 20,
195568
196407
  'trade/one-click-repay-currency-list': 20,
195569
196408
  'trade/one-click-repay-history': 20,
196409
+ 'trade/account-rate-limit': 1,
195570
196410
  // asset
195571
196411
  'asset/currencies': 5 / 3,
195572
196412
  'asset/balances': 5 / 3,
@@ -196911,7 +197751,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
196911
197751
  if ((networkId !== undefined) && (networkId.indexOf('-') >= 0)) {
196912
197752
  const parts = networkId.split('-');
196913
197753
  const chainPart = this.safeString(parts, 1, networkId);
196914
- const networkCode = this.safeNetwork(chainPart);
197754
+ const networkCode = this.networkIdToCode(chainPart, currency['code']);
196915
197755
  const precision = this.parsePrecision(this.safeString(chain, 'wdTickSz'));
196916
197756
  if (maxPrecision === undefined) {
196917
197757
  maxPrecision = precision;
@@ -198930,7 +199770,6 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
198930
199770
  * @param {int} [since] the earliest time in ms to fetch open orders for
198931
199771
  * @param {int} [limit] the maximum number of open orders structures to retrieve
198932
199772
  * @param {object} [params] extra parameters specific to the exchange API endpoint
198933
- * @param {int} [params.till] Timestamp in ms of the latest time to retrieve orders for
198934
199773
  * @param {bool} [params.stop] True if fetching trigger or conditional orders
198935
199774
  * @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
198936
199775
  * @param {string} [params.algoId] Algo ID "'433845797218942976'"
@@ -198975,12 +199814,8 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
198975
199814
  if (trailing) {
198976
199815
  request['ordType'] = 'move_order_stop';
198977
199816
  }
198978
- else if (stop || (ordType in algoOrderTypes)) {
198979
- if (stop) {
198980
- if (ordType === undefined) {
198981
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchOpenOrders() requires an "ordType" string parameter, "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"');
198982
- }
198983
- }
199817
+ else if (stop && (ordType === undefined)) {
199818
+ request['ordType'] = 'trigger';
198984
199819
  }
198985
199820
  const query = this.omit(params, ['method', 'stop', 'trigger', 'trailing']);
198986
199821
  let response = undefined;
@@ -199287,7 +200122,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
199287
200122
  * @param {int} [since] the earliest time in ms to fetch orders for
199288
200123
  * @param {int} [limit] the maximum number of order structures to retrieve
199289
200124
  * @param {object} [params] extra parameters specific to the exchange API endpoint
199290
- * @param {bool} [params.stop] True if fetching trigger or conditional orders
200125
+ * @param {bool} [params.trigger] True if fetching trigger or conditional orders
199291
200126
  * @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
199292
200127
  * @param {string} [params.algoId] Algo ID "'433845797218942976'"
199293
200128
  * @param {int} [params.until] timestamp in ms to fetch orders for
@@ -199325,12 +200160,12 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
199325
200160
  if (limit !== undefined) {
199326
200161
  request['limit'] = limit; // default 100, max 100
199327
200162
  }
199328
- const options = this.safeValue(this.options, 'fetchClosedOrders', {});
199329
- const algoOrderTypes = this.safeValue(this.options, 'algoOrderTypes', {});
200163
+ const options = this.safeDict(this.options, 'fetchClosedOrders', {});
200164
+ const algoOrderTypes = this.safeDict(this.options, 'algoOrderTypes', {});
199330
200165
  const defaultMethod = this.safeString(options, 'method', 'privateGetTradeOrdersHistory');
199331
200166
  let method = this.safeString(params, 'method', defaultMethod);
199332
200167
  const ordType = this.safeString(params, 'ordType');
199333
- const stop = this.safeValue2(params, 'stop', 'trigger');
200168
+ const stop = this.safeBool2(params, 'stop', 'trigger');
199334
200169
  const trailing = this.safeBool(params, 'trailing', false);
199335
200170
  if (trailing || stop || (ordType in algoOrderTypes)) {
199336
200171
  method = 'privateGetTradeOrdersAlgoHistory';
@@ -199339,11 +200174,9 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
199339
200174
  if (trailing) {
199340
200175
  request['ordType'] = 'move_order_stop';
199341
200176
  }
199342
- else if (stop || (ordType in algoOrderTypes)) {
199343
- if (stop) {
199344
- if (ordType === undefined) {
199345
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchClosedOrders() requires an "ordType" string parameter, "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"');
199346
- }
200177
+ else if (stop) {
200178
+ if (ordType === undefined) {
200179
+ request['ordType'] = 'trigger';
199347
200180
  }
199348
200181
  }
199349
200182
  else {
@@ -206592,6 +207425,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
206592
207425
  'addMargin': false,
206593
207426
  'cancelAllOrders': true,
206594
207427
  'cancelOrder': true,
207428
+ 'closePosition': false,
206595
207429
  'createOrder': true,
206596
207430
  'createReduceOnlyOrder': true,
206597
207431
  'createStopLimitOrder': true,
@@ -215376,13 +216210,13 @@ class poloniexfutures extends _abstract_poloniexfutures_js__WEBPACK_IMPORTED_MOD
215376
216210
  const trades = this.safeValue(data, 'items', {});
215377
216211
  return this.parseTrades(trades, market, since, limit);
215378
216212
  }
215379
- async setMarginMode(marginMode, symbol, params = {}) {
216213
+ async setMarginMode(marginMode, symbol = undefined, params = {}) {
215380
216214
  /**
215381
216215
  * @method
215382
216216
  * @name poloniexfutures#setMarginMode
215383
216217
  * @description set margin mode to 'cross' or 'isolated'
215384
216218
  * @see https://futures-docs.poloniex.com/#change-margin-mode
215385
- * @param {int} marginMode 0 (isolated) or 1 (cross)
216219
+ * @param {string} marginMode "0" (isolated) or "1" (cross)
215386
216220
  * @param {string} symbol unified market symbol
215387
216221
  * @param {object} [params] extra parameters specific to the exchange API endpoint
215388
216222
  * @returns {object} response from the exchange
@@ -215390,14 +216224,20 @@ class poloniexfutures extends _abstract_poloniexfutures_js__WEBPACK_IMPORTED_MOD
215390
216224
  if (symbol === undefined) {
215391
216225
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' setMarginMode() requires a symbol argument');
215392
216226
  }
215393
- if ((marginMode !== 0) && (marginMode !== 1)) {
215394
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' setMarginMode() marginMode must be 0 (isolated) or 1 (cross)');
216227
+ if ((marginMode !== '0') && (marginMode !== '1') && (marginMode !== 'isolated') && (marginMode !== 'cross')) {
216228
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' setMarginMode() marginMode must be 0/isolated or 1/cross');
215395
216229
  }
215396
216230
  await this.loadMarkets();
216231
+ if (marginMode === 'isolated') {
216232
+ marginMode = '0';
216233
+ }
216234
+ if (marginMode === 'cross') {
216235
+ marginMode = '1';
216236
+ }
215397
216237
  const market = this.market(symbol);
215398
216238
  const request = {
215399
216239
  'symbol': market['id'],
215400
- 'marginType': marginMode,
216240
+ 'marginType': this.parseToInt(marginMode),
215401
216241
  };
215402
216242
  return await this.privatePostMarginTypeChange(request);
215403
216243
  }
@@ -224937,8 +225777,10 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
224937
225777
  'watchTicker': true,
224938
225778
  'watchTickers': true,
224939
225779
  'watchOrderBook': true,
225780
+ 'watchOrderBookForSymbols': true,
224940
225781
  'watchOrders': true,
224941
225782
  'watchTrades': true,
225783
+ 'watchTradesForSymbols': true,
224942
225784
  'watchOHLCV': true,
224943
225785
  'watchPosition': 'emulated',
224944
225786
  'watchPositions': true,
@@ -224963,8 +225805,15 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
224963
225805
  'fetchBalanceSnapshot': true,
224964
225806
  'awaitBalanceSnapshot': false, // whether to wait for the balance snapshot before providing updates
224965
225807
  },
225808
+ //
225809
+ // orderbook channels can have:
225810
+ // - 'depth5', 'depth20', 'depth50' // these endpoints emit full Orderbooks once in every 500ms
225811
+ // - 'depth/increase100' // this endpoint is preferred, because it emits once in 100ms. however, when this value is chosen, it only affects spot-market, but contracts markets automatically `depth50` will be being used
224966
225812
  'watchOrderBook': {
224967
- 'depth': 'depth/increase100', // depth/increase100, depth5, depth20, depth50
225813
+ 'depth': 'depth/increase100',
225814
+ },
225815
+ 'watchOrderBookForSymbols': {
225816
+ 'depth': 'depth/increase100',
224968
225817
  },
224969
225818
  'ws': {
224970
225819
  'inflate': true,
@@ -225011,6 +225860,24 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
225011
225860
  }
225012
225861
  return await this.watch(url, messageHash, this.deepExtend(request, params), messageHash);
225013
225862
  }
225863
+ async subscribeMultiple(channel, type, symbols, params = {}) {
225864
+ const url = this.implodeHostname(this.urls['api']['ws'][type]['public']);
225865
+ const channelType = (type === 'spot') ? 'spot' : 'futures';
225866
+ const actionType = (type === 'spot') ? 'op' : 'action';
225867
+ const rawSubscriptions = [];
225868
+ const messageHashes = [];
225869
+ for (let i = 0; i < symbols.length; i++) {
225870
+ const market = this.market(symbols[i]);
225871
+ const message = channelType + '/' + channel + ':' + market['id'];
225872
+ rawSubscriptions.push(message);
225873
+ messageHashes.push(channel + ':' + market['symbol']);
225874
+ }
225875
+ const request = {
225876
+ 'args': rawSubscriptions,
225877
+ };
225878
+ request[actionType] = 'subscribe';
225879
+ return await this.watchMultiple(url, messageHashes, this.deepExtend(request, params), rawSubscriptions);
225880
+ }
225014
225881
  async watchBalance(params = {}) {
225015
225882
  /**
225016
225883
  * @method
@@ -225158,17 +226025,43 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
225158
226025
  * @param {object} [params] extra parameters specific to the exchange API endpoint
225159
226026
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
225160
226027
  */
226028
+ return await this.watchTradesForSymbols([symbol], since, limit, params);
226029
+ }
226030
+ async watchTradesForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
226031
+ /**
226032
+ * @method
226033
+ * @name bitmart#watchTradesForSymbols
226034
+ * @see https://developer-pro.bitmart.com/en/spot/#public-trade-channel
226035
+ * @description get the list of most recent trades for a list of symbols
226036
+ * @param {string[]} symbols unified symbol of the market to fetch trades for
226037
+ * @param {int} [since] timestamp in ms of the earliest trade to fetch
226038
+ * @param {int} [limit] the maximum amount of trades to fetch
226039
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
226040
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
226041
+ */
225161
226042
  await this.loadMarkets();
225162
- symbol = this.symbol(symbol);
225163
- const market = this.market(symbol);
225164
- let type = 'spot';
225165
- [type, params] = this.handleMarketTypeAndParams('watchTrades', market, params);
225166
- const trades = await this.subscribe('trade', symbol, type, params);
226043
+ let marketType = undefined;
226044
+ [symbols, marketType, params] = this.getParamsForMultipleSub('watchTradesForSymbols', symbols, limit, params);
226045
+ const channelName = 'trade';
226046
+ const trades = await this.subscribeMultiple(channelName, marketType, symbols, params);
225167
226047
  if (this.newUpdates) {
225168
- limit = trades.getLimit(symbol, limit);
226048
+ const first = this.safeDict(trades, 0);
226049
+ const tradeSymbol = this.safeString(first, 'symbol');
226050
+ limit = trades.getLimit(tradeSymbol, limit);
225169
226051
  }
225170
226052
  return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
225171
226053
  }
226054
+ getParamsForMultipleSub(methodName, symbols, limit = undefined, params = {}) {
226055
+ symbols = this.marketSymbols(symbols, undefined, false, true);
226056
+ const length = symbols.length;
226057
+ if (length > 20) {
226058
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' ' + methodName + '() accepts a maximum of 20 symbols in one request');
226059
+ }
226060
+ const market = this.market(symbols[0]);
226061
+ let marketType = undefined;
226062
+ [marketType, params] = this.handleMarketTypeAndParams(methodName, market, params);
226063
+ return [symbols, marketType, params];
226064
+ }
225172
226065
  async watchTicker(symbol, params = {}) {
225173
226066
  /**
225174
226067
  * @method
@@ -225706,16 +226599,15 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
225706
226599
  // ]
225707
226600
  // }
225708
226601
  //
225709
- const channel = this.safeString2(message, 'table', 'group');
225710
- const isSpot = (channel.indexOf('spot') >= 0);
225711
226602
  const data = this.safeValue(message, 'data');
225712
226603
  if (data === undefined) {
225713
226604
  return;
225714
226605
  }
225715
226606
  let stored = undefined;
226607
+ let symbol = undefined;
225716
226608
  for (let i = 0; i < data.length; i++) {
225717
226609
  const trade = this.parseWsTrade(data[i]);
225718
- const symbol = trade['symbol'];
226610
+ symbol = trade['symbol'];
225719
226611
  const tradesLimit = this.safeInteger(this.options, 'tradesLimit', 1000);
225720
226612
  stored = this.safeValue(this.trades, symbol);
225721
226613
  if (stored === undefined) {
@@ -225724,10 +226616,7 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
225724
226616
  }
225725
226617
  stored.append(trade);
225726
226618
  }
225727
- let messageHash = channel;
225728
- if (isSpot) {
225729
- messageHash += ':' + this.safeString(data[0], 'symbol');
225730
- }
226619
+ const messageHash = 'trade:' + symbol;
225731
226620
  client.resolve(stored, messageHash);
225732
226621
  }
225733
226622
  parseWsTrade(trade, market = undefined) {
@@ -226069,8 +226958,8 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
226069
226958
  // "symbol": "BTC_USDT"
226070
226959
  // }
226071
226960
  //
226072
- const asks = this.safeValue(message, 'asks', []);
226073
- const bids = this.safeValue(message, 'bids', []);
226961
+ const asks = this.safeList(message, 'asks', []);
226962
+ const bids = this.safeList(message, 'bids', []);
226074
226963
  this.handleDeltas(orderbook['asks'], asks);
226075
226964
  this.handleDeltas(orderbook['bids'], bids);
226076
226965
  const timestamp = this.safeInteger(message, 'ms_t');
@@ -226084,6 +226973,7 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
226084
226973
  handleOrderBook(client, message) {
226085
226974
  //
226086
226975
  // spot depth-all
226976
+ //
226087
226977
  // {
226088
226978
  // "data": [
226089
226979
  // {
@@ -226103,33 +226993,31 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
226103
226993
  // ],
226104
226994
  // "table": "spot/depth5"
226105
226995
  // }
226996
+ //
226106
226997
  // spot increse depth snapshot
226998
+ //
226107
226999
  // {
226108
227000
  // "data":[
226109
227001
  // {
226110
- // "asks":[
226111
- // [
226112
- // "43652.52",
226113
- // "0.02039"
226114
- // ],
226115
- // ...
226116
- // ],
226117
- // "bids":[
226118
- // [
226119
- // "43652.51",
226120
- // "0.00500"
227002
+ // "asks":[
227003
+ // [ "43652.52", "0.02039" ],
227004
+ // ...
226121
227005
  // ],
226122
- // ...
226123
- // ],
226124
- // "ms_t":1703376836487,
226125
- // "symbol":"BTC_USDT",
226126
- // "type":"snapshot", // or update
226127
- // "version":2141731
227006
+ // "bids":[
227007
+ // [ "43652.51", "0.00500" ],
227008
+ // ...
227009
+ // ],
227010
+ // "ms_t":1703376836487,
227011
+ // "symbol":"BTC_USDT",
227012
+ // "type":"snapshot", // or update
227013
+ // "version":2141731
226128
227014
  // }
226129
227015
  // ],
226130
227016
  // "table":"spot/depth/increase100"
226131
227017
  // }
227018
+ //
226132
227019
  // swap
227020
+ //
226133
227021
  // {
226134
227022
  // "group":"futures/depth50:BTCUSDT",
226135
227023
  // "data":{
@@ -226150,50 +227038,69 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
226150
227038
  // }
226151
227039
  // }
226152
227040
  //
226153
- const data = this.safeValue(message, 'data');
226154
- if (data === undefined) {
227041
+ const isSpot = ('table' in message);
227042
+ let datas = [];
227043
+ if (isSpot) {
227044
+ datas = this.safeList(message, 'data', datas);
227045
+ }
227046
+ else {
227047
+ const orderBookEntry = this.safeDict(message, 'data');
227048
+ if (orderBookEntry !== undefined) {
227049
+ datas.push(orderBookEntry);
227050
+ }
227051
+ }
227052
+ const length = datas.length;
227053
+ if (length <= 0) {
226155
227054
  return;
226156
227055
  }
226157
- const depths = this.safeValue(data, 'depths');
226158
- const isSpot = (depths === undefined);
226159
- const table = this.safeString2(message, 'table', 'group');
227056
+ const channelName = this.safeString2(message, 'table', 'group');
226160
227057
  // find limit subscribed to
226161
227058
  const limitsToCheck = ['100', '50', '20', '10', '5'];
226162
227059
  let limit = 0;
226163
227060
  for (let i = 0; i < limitsToCheck.length; i++) {
226164
227061
  const limitString = limitsToCheck[i];
226165
- if (table.indexOf(limitString) >= 0) {
227062
+ if (channelName.indexOf(limitString) >= 0) {
226166
227063
  limit = this.parseToInt(limitString);
226167
227064
  break;
226168
227065
  }
226169
227066
  }
226170
227067
  if (isSpot) {
226171
- for (let i = 0; i < data.length; i++) {
226172
- const update = data[i];
227068
+ const channel = channelName.replace('spot/', '');
227069
+ for (let i = 0; i < datas.length; i++) {
227070
+ const update = datas[i];
226173
227071
  const marketId = this.safeString(update, 'symbol');
226174
227072
  const symbol = this.safeSymbol(marketId);
226175
- let orderbook = this.safeValue(this.orderbooks, symbol);
227073
+ let orderbook = this.safeDict(this.orderbooks, symbol);
226176
227074
  if (orderbook === undefined) {
226177
227075
  orderbook = this.orderBook({}, limit);
226178
227076
  orderbook['symbol'] = symbol;
226179
227077
  this.orderbooks[symbol] = orderbook;
226180
227078
  }
226181
227079
  const type = this.safeValue(update, 'type');
226182
- if ((type === 'snapshot') || (!(table.indexOf('increase') >= 0))) {
227080
+ if ((type === 'snapshot') || (!(channelName.indexOf('increase') >= 0))) {
226183
227081
  orderbook.reset({});
226184
227082
  }
226185
227083
  this.handleOrderBookMessage(client, update, orderbook);
226186
227084
  const timestamp = this.safeInteger(update, 'ms_t');
226187
- orderbook['timestamp'] = timestamp;
226188
- orderbook['datetime'] = this.iso8601(timestamp);
226189
- const messageHash = table + ':' + marketId;
227085
+ if (orderbook['timestamp'] === undefined) {
227086
+ orderbook['timestamp'] = timestamp;
227087
+ orderbook['datetime'] = this.iso8601(timestamp);
227088
+ }
227089
+ const messageHash = channelName + ':' + marketId;
226190
227090
  client.resolve(orderbook, messageHash);
227091
+ // resolve ForSymbols
227092
+ const messageHashForMulti = channel + ':' + symbol;
227093
+ client.resolve(orderbook, messageHashForMulti);
226191
227094
  }
226192
227095
  }
226193
227096
  else {
227097
+ const tableParts = channelName.split(':');
227098
+ const channel = tableParts[0].replace('futures/', '');
227099
+ const data = datas[0]; // contract markets always contain only one member
227100
+ const depths = data['depths'];
226194
227101
  const marketId = this.safeString(data, 'symbol');
226195
227102
  const symbol = this.safeSymbol(marketId);
226196
- let orderbook = this.safeValue(this.orderbooks, symbol);
227103
+ let orderbook = this.safeDict(this.orderbooks, symbol);
226197
227104
  if (orderbook === undefined) {
226198
227105
  orderbook = this.orderBook({}, limit);
226199
227106
  orderbook['symbol'] = symbol;
@@ -226222,10 +227129,36 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
226222
227129
  const timestamp = this.safeInteger(data, 'ms_t');
226223
227130
  orderbook['timestamp'] = timestamp;
226224
227131
  orderbook['datetime'] = this.iso8601(timestamp);
226225
- const messageHash = table;
227132
+ const messageHash = channelName;
226226
227133
  client.resolve(orderbook, messageHash);
227134
+ // resolve ForSymbols
227135
+ const messageHashForMulti = channel + ':' + symbol;
227136
+ client.resolve(orderbook, messageHashForMulti);
226227
227137
  }
226228
227138
  }
227139
+ async watchOrderBookForSymbols(symbols, limit = undefined, params = {}) {
227140
+ /**
227141
+ * @method
227142
+ * @name bitmart#watchOrderBookForSymbols
227143
+ * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
227144
+ * @see https://developer-pro.bitmart.com/en/spot/#public-depth-increase-channel
227145
+ * @param {string[]} symbols unified array of symbols
227146
+ * @param {int} [limit] the maximum amount of order book entries to return
227147
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
227148
+ * @param {string} [params.depth] the type of order book to subscribe to, default is 'depth/increase100', also accepts 'depth5' or 'depth20' or depth50
227149
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
227150
+ */
227151
+ await this.loadMarkets();
227152
+ let type = undefined;
227153
+ [symbols, type, params] = this.getParamsForMultipleSub('watchOrderBookForSymbols', symbols, limit, params);
227154
+ let channel = undefined;
227155
+ [channel, params] = this.handleOptionAndParams(params, 'watchOrderBookForSymbols', 'depth', 'depth/increase100');
227156
+ if (type === 'swap' && channel === 'depth/increase100') {
227157
+ channel = 'depth50';
227158
+ }
227159
+ const orderbook = await this.subscribeMultiple(channel, type, symbols, params);
227160
+ return orderbook.limit();
227161
+ }
226229
227162
  async authenticate(type, params = {}) {
226230
227163
  this.checkRequiredCredentials();
226231
227164
  const url = this.implodeHostname(this.urls['api']['ws'][type]['private']);
@@ -231911,7 +232844,7 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
231911
232844
  const market = this.market(symbol);
231912
232845
  symbol = market['symbol'];
231913
232846
  const messageHash = 'ticker:' + symbol;
231914
- const url = this.getUrlByMarketType(symbol, false, params);
232847
+ const url = this.getUrlByMarketType(symbol, false, 'watchTicker', params);
231915
232848
  params = this.cleanParams(params);
231916
232849
  const options = this.safeValue(this.options, 'watchTicker', {});
231917
232850
  let topic = this.safeString(options, 'name', 'tickers');
@@ -231936,7 +232869,7 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
231936
232869
  await this.loadMarkets();
231937
232870
  symbols = this.marketSymbols(symbols, undefined, false);
231938
232871
  const messageHashes = [];
231939
- const url = this.getUrlByMarketType(symbols[0], false, params);
232872
+ const url = this.getUrlByMarketType(symbols[0], false, 'watchTickers', params);
231940
232873
  params = this.cleanParams(params);
231941
232874
  const options = this.safeValue(this.options, 'watchTickers', {});
231942
232875
  const topic = this.safeString(options, 'name', 'tickers');
@@ -232103,7 +233036,7 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
232103
233036
  await this.loadMarkets();
232104
233037
  const market = this.market(symbol);
232105
233038
  symbol = market['symbol'];
232106
- const url = this.getUrlByMarketType(symbol, false, params);
233039
+ const url = this.getUrlByMarketType(symbol, false, 'watchOHLCV', params);
232107
233040
  params = this.cleanParams(params);
232108
233041
  let ohlcv = undefined;
232109
233042
  const timeframeId = this.safeString(this.timeframes, timeframe, timeframe);
@@ -232221,7 +233154,7 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
232221
233154
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' watchOrderBookForSymbols() requires a non-empty array of symbols');
232222
233155
  }
232223
233156
  symbols = this.marketSymbols(symbols);
232224
- const url = this.getUrlByMarketType(symbols[0], false, params);
233157
+ const url = this.getUrlByMarketType(symbols[0], false, 'watchOrderBook', params);
232225
233158
  params = this.cleanParams(params);
232226
233159
  const market = this.market(symbols[0]);
232227
233160
  if (limit === undefined) {
@@ -232353,7 +233286,7 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
232353
233286
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' watchTradesForSymbols() requires a non-empty array of symbols');
232354
233287
  }
232355
233288
  params = this.cleanParams(params);
232356
- const url = this.getUrlByMarketType(symbols[0], false, params);
233289
+ const url = this.getUrlByMarketType(symbols[0], false, 'watchTrades', params);
232357
233290
  const topics = [];
232358
233291
  const messageHashes = [];
232359
233292
  for (let i = 0; i < symbols.length; i++) {
@@ -256339,7 +257272,7 @@ class mexc extends _mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
256339
257272
  }
256340
257273
  try {
256341
257274
  this.handleDelta(storedOrderBook, data);
256342
- const timestamp = this.safeInteger(message, 't');
257275
+ const timestamp = this.safeInteger2(message, 't', 'ts');
256343
257276
  storedOrderBook['timestamp'] = timestamp;
256344
257277
  storedOrderBook['datetime'] = this.iso8601(timestamp);
256345
257278
  }
@@ -286182,7 +287115,7 @@ class wavesexchange extends _abstract_wavesexchange_js__WEBPACK_IMPORTED_MODULE_
286182
287115
  },
286183
287116
  },
286184
287117
  'currencies': {
286185
- 'WX': this.safeCurrencyStructure({ 'id': 'EMAMLxDnv3xiz8RXg8Btj33jcEw3wLczL3JKYYmuubpc', 'numericId': undefined, 'code': 'WX', 'precision': this.parseNumber('8') }),
287118
+ 'WX': this.safeCurrencyStructure({ 'id': 'EMAMLxDnv3xiz8RXg8Btj33jcEw3wLczL3JKYYmuubpc', 'numericId': undefined, 'code': 'WX', 'precision': this.parseToInt('8') }),
286186
287119
  },
286187
287120
  'precisionMode': _base_functions_number_js__WEBPACK_IMPORTED_MODULE_1__/* .DECIMAL_PLACES */ .nr,
286188
287121
  'options': {
@@ -292837,7 +293770,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
292837
293770
  if (stopPrice !== undefined) {
292838
293771
  request['triggerPrice'] = this.priceToPrecision(symbol, stopPrice);
292839
293772
  }
292840
- const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activatedPrice', price);
293773
+ const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activatedPrice', this.numberToString(price));
292841
293774
  const trailingAmount = this.safeString2(params, 'trailingAmount', 'callbackValue');
292842
293775
  const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRate');
292843
293776
  const isTrailingAmountOrder = trailingAmount !== undefined;
@@ -304136,7 +305069,7 @@ SOFTWARE.
304136
305069
 
304137
305070
  //-----------------------------------------------------------------------------
304138
305071
  // this is updated by vss.js when building
304139
- const version = '4.2.38';
305072
+ const version = '4.2.40';
304140
305073
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
304141
305074
  //-----------------------------------------------------------------------------
304142
305075