ccxt 4.5.55 → 4.5.56

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 (177) hide show
  1. package/README.md +209 -5
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/aftermath.js +10 -5
  5. package/dist/cjs/src/alpaca.js +2 -2
  6. package/dist/cjs/src/apex.js +25 -16
  7. package/dist/cjs/src/arkham.js +7 -4
  8. package/dist/cjs/src/ascendex.js +6 -3
  9. package/dist/cjs/src/base/Exchange.js +3 -3
  10. package/dist/cjs/src/bigone.js +7 -4
  11. package/dist/cjs/src/binance.js +4 -4
  12. package/dist/cjs/src/bingx.js +4 -4
  13. package/dist/cjs/src/bitflyer.js +2 -1
  14. package/dist/cjs/src/bitget.js +14 -3
  15. package/dist/cjs/src/bitmart.js +5 -4
  16. package/dist/cjs/src/bitmex.js +7 -4
  17. package/dist/cjs/src/bitopro.js +1 -1
  18. package/dist/cjs/src/bitrue.js +2 -1
  19. package/dist/cjs/src/bitso.js +6 -3
  20. package/dist/cjs/src/bitstamp.js +5 -3
  21. package/dist/cjs/src/bittrade.js +2 -1
  22. package/dist/cjs/src/blofin.js +2 -1
  23. package/dist/cjs/src/bybit.js +19 -17
  24. package/dist/cjs/src/bybiteu.js +1 -0
  25. package/dist/cjs/src/coinbaseexchange.js +2 -1
  26. package/dist/cjs/src/coinbaseinternational.js +15 -9
  27. package/dist/cjs/src/coinex.js +5 -3
  28. package/dist/cjs/src/coinsph.js +4 -4
  29. package/dist/cjs/src/cryptocom.js +6 -6
  30. package/dist/cjs/src/deepcoin.js +6 -3
  31. package/dist/cjs/src/delta.js +2 -1
  32. package/dist/cjs/src/deribit.js +4 -2
  33. package/dist/cjs/src/derive.js +5 -3
  34. package/dist/cjs/src/digifinex.js +2 -1
  35. package/dist/cjs/src/exmo.js +12 -39
  36. package/dist/cjs/src/foxbit.js +1 -1
  37. package/dist/cjs/src/gemini.js +4 -2
  38. package/dist/cjs/src/grvt.js +13 -7
  39. package/dist/cjs/src/hashkey.js +4 -4
  40. package/dist/cjs/src/hibachi.js +1 -1
  41. package/dist/cjs/src/hitbtc.js +2 -1
  42. package/dist/cjs/src/htx.js +9 -5
  43. package/dist/cjs/src/hyperliquid.js +19 -13
  44. package/dist/cjs/src/indodax.js +2 -1
  45. package/dist/cjs/src/kraken.js +14 -13
  46. package/dist/cjs/src/krakenfutures.js +2 -1
  47. package/dist/cjs/src/lbank.js +8 -4
  48. package/dist/cjs/src/lighter.js +1 -1
  49. package/dist/cjs/src/luno.js +1 -1
  50. package/dist/cjs/src/mercado.js +2 -1
  51. package/dist/cjs/src/mexc.js +24 -14
  52. package/dist/cjs/src/modetrade.js +1 -1
  53. package/dist/cjs/src/okx.js +6 -3
  54. package/dist/cjs/src/oxfun.js +5 -3
  55. package/dist/cjs/src/p2b.js +8 -4
  56. package/dist/cjs/src/paradex.js +3 -2
  57. package/dist/cjs/src/phemex.js +4 -2
  58. package/dist/cjs/src/poloniex.js +2 -1
  59. package/dist/cjs/src/pro/apex.js +10 -1
  60. package/dist/cjs/src/pro/aster.js +10 -9
  61. package/dist/cjs/src/pro/binance.js +3 -3
  62. package/dist/cjs/src/pro/bingx.js +7 -2
  63. package/dist/cjs/src/pro/bitmart.js +10 -0
  64. package/dist/cjs/src/pro/bitmex.js +1 -1
  65. package/dist/cjs/src/pro/grvt.js +8 -0
  66. package/dist/cjs/src/pro/htx.js +4 -4
  67. package/dist/cjs/src/pro/krakenfutures.js +16 -4
  68. package/dist/cjs/src/pro/modetrade.js +3 -3
  69. package/dist/cjs/src/pro/okx.js +4 -4
  70. package/dist/cjs/src/pro/oxfun.js +4 -4
  71. package/dist/cjs/src/pro/woo.js +4 -4
  72. package/dist/cjs/src/pro/woofipro.js +3 -3
  73. package/dist/cjs/src/pro/xt.js +1 -1
  74. package/dist/cjs/src/toobit.js +1 -1
  75. package/dist/cjs/src/woo.js +1 -1
  76. package/dist/cjs/src/woofipro.js +1 -1
  77. package/dist/cjs/src/xt.js +2 -1
  78. package/dist/cjs/src/yobit.js +4 -2
  79. package/dist/cjs/src/zebpay.js +3 -3
  80. package/js/ccxt.d.ts +1 -1
  81. package/js/ccxt.js +1 -1
  82. package/js/src/abstract/mexc.d.ts +1 -0
  83. package/js/src/aftermath.js +10 -5
  84. package/js/src/alpaca.js +2 -2
  85. package/js/src/apex.d.ts +1 -1
  86. package/js/src/apex.js +25 -16
  87. package/js/src/arkham.js +7 -4
  88. package/js/src/ascendex.js +6 -3
  89. package/js/src/base/Exchange.js +3 -3
  90. package/js/src/bigone.js +7 -4
  91. package/js/src/binance.js +4 -4
  92. package/js/src/bingx.js +4 -4
  93. package/js/src/bitflyer.js +2 -1
  94. package/js/src/bitget.js +14 -3
  95. package/js/src/bitmart.js +5 -4
  96. package/js/src/bitmex.js +7 -4
  97. package/js/src/bitopro.js +1 -1
  98. package/js/src/bitrue.js +2 -1
  99. package/js/src/bitso.js +6 -3
  100. package/js/src/bitstamp.js +5 -3
  101. package/js/src/bittrade.js +2 -1
  102. package/js/src/blofin.js +2 -1
  103. package/js/src/bybit.d.ts +1 -1
  104. package/js/src/bybit.js +19 -17
  105. package/js/src/bybiteu.js +1 -0
  106. package/js/src/coinbaseexchange.js +2 -1
  107. package/js/src/coinbaseinternational.d.ts +1 -1
  108. package/js/src/coinbaseinternational.js +15 -9
  109. package/js/src/coinex.d.ts +1 -1
  110. package/js/src/coinex.js +5 -3
  111. package/js/src/coinsph.js +4 -4
  112. package/js/src/cryptocom.js +6 -6
  113. package/js/src/deepcoin.js +6 -3
  114. package/js/src/delta.js +2 -1
  115. package/js/src/deribit.js +4 -2
  116. package/js/src/derive.js +5 -3
  117. package/js/src/digifinex.js +2 -1
  118. package/js/src/exmo.js +12 -39
  119. package/js/src/foxbit.js +1 -1
  120. package/js/src/gemini.js +4 -2
  121. package/js/src/grvt.d.ts +1 -1
  122. package/js/src/grvt.js +13 -7
  123. package/js/src/hashkey.js +4 -4
  124. package/js/src/hibachi.d.ts +1 -1
  125. package/js/src/hibachi.js +1 -1
  126. package/js/src/hitbtc.js +2 -1
  127. package/js/src/htx.js +9 -5
  128. package/js/src/hyperliquid.d.ts +4 -4
  129. package/js/src/hyperliquid.js +19 -13
  130. package/js/src/indodax.js +2 -1
  131. package/js/src/kraken.js +14 -13
  132. package/js/src/krakenfutures.js +2 -1
  133. package/js/src/lbank.js +8 -4
  134. package/js/src/lighter.d.ts +1 -1
  135. package/js/src/lighter.js +1 -1
  136. package/js/src/luno.js +1 -1
  137. package/js/src/mercado.js +2 -1
  138. package/js/src/mexc.d.ts +2 -2
  139. package/js/src/mexc.js +24 -14
  140. package/js/src/modetrade.js +1 -1
  141. package/js/src/okx.js +6 -3
  142. package/js/src/oxfun.js +5 -3
  143. package/js/src/p2b.js +8 -4
  144. package/js/src/paradex.js +3 -2
  145. package/js/src/phemex.js +4 -2
  146. package/js/src/poloniex.js +2 -1
  147. package/js/src/pro/apex.js +10 -1
  148. package/js/src/pro/aster.js +10 -9
  149. package/js/src/pro/binance.d.ts +1 -1
  150. package/js/src/pro/binance.js +3 -3
  151. package/js/src/pro/bingx.js +7 -2
  152. package/js/src/pro/bitmart.js +10 -0
  153. package/js/src/pro/bitmex.js +1 -1
  154. package/js/src/pro/grvt.js +8 -0
  155. package/js/src/pro/htx.d.ts +4 -4
  156. package/js/src/pro/htx.js +4 -4
  157. package/js/src/pro/krakenfutures.d.ts +4 -4
  158. package/js/src/pro/krakenfutures.js +16 -4
  159. package/js/src/pro/modetrade.d.ts +3 -3
  160. package/js/src/pro/modetrade.js +3 -3
  161. package/js/src/pro/okx.d.ts +4 -4
  162. package/js/src/pro/okx.js +4 -4
  163. package/js/src/pro/oxfun.d.ts +4 -4
  164. package/js/src/pro/oxfun.js +4 -4
  165. package/js/src/pro/woo.d.ts +4 -4
  166. package/js/src/pro/woo.js +4 -4
  167. package/js/src/pro/woofipro.d.ts +3 -3
  168. package/js/src/pro/woofipro.js +3 -3
  169. package/js/src/pro/xt.js +1 -1
  170. package/js/src/toobit.d.ts +1 -1
  171. package/js/src/toobit.js +1 -1
  172. package/js/src/woo.js +1 -1
  173. package/js/src/woofipro.js +1 -1
  174. package/js/src/xt.js +2 -1
  175. package/js/src/yobit.js +4 -2
  176. package/js/src/zebpay.js +3 -3
  177. package/package.json +21 -7
@@ -3048,7 +3048,7 @@ class hashkey extends hashkey$1["default"] {
3048
3048
  [marketType, params] = this.handleMarketTypeAndParams(methodName, market, params, marketType);
3049
3049
  let response = undefined;
3050
3050
  if (marketType === 'spot') {
3051
- response = await this.privateDeleteApiV1SpotCancelOrderByIds(this.extend(request));
3051
+ response = await this.privateDeleteApiV1SpotCancelOrderByIds(request);
3052
3052
  //
3053
3053
  // {
3054
3054
  // "code": "0000",
@@ -3057,7 +3057,7 @@ class hashkey extends hashkey$1["default"] {
3057
3057
  //
3058
3058
  }
3059
3059
  else if (marketType === 'swap') {
3060
- response = this.privateDeleteApiV1FuturesCancelOrderByIds(this.extend(request));
3060
+ response = await this.privateDeleteApiV1FuturesCancelOrderByIds(request);
3061
3061
  }
3062
3062
  else {
3063
3063
  throw new errors.NotSupported(this.id + ' ' + methodName + '() is not supported for ' + marketType + ' type of markets');
@@ -4338,8 +4338,8 @@ class hashkey extends hashkey$1["default"] {
4338
4338
  return undefined;
4339
4339
  }
4340
4340
  let errorInArray = false;
4341
- let responseCodeString = this.safeString(response, 'code', undefined);
4342
- const responseCodeInteger = this.safeInteger(response, 'code', undefined); // some codes in response are returned as '0000' others as 0
4341
+ let responseCodeString = this.safeString(response, 'code');
4342
+ const responseCodeInteger = this.safeInteger(response, 'code'); // some codes in response are returned as '0000' others as 0
4343
4343
  if (responseCodeInteger === 0) {
4344
4344
  const result = this.safeList(response, 'result', []); // for batch methods
4345
4345
  for (let i = 0; i < result.length; i++) {
@@ -750,7 +750,7 @@ class hibachi extends hibachi$1["default"] {
750
750
  * @method
751
751
  * @name hibachi#fetchTradingFees
752
752
  * @description fetch the trading fee
753
- * @param params extra parameters
753
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
754
754
  * @returns {object} a map of market symbols to [fee structures]{@link https://docs.ccxt.com/?id=fee-structure}
755
755
  */
756
756
  async fetchTradingFees(params = {}) {
@@ -3445,8 +3445,9 @@ class hitbtc extends hitbtc$1["default"] {
3445
3445
  // "positions": null
3446
3446
  // }
3447
3447
  //
3448
+ const parsedAmount = this.parseNumber(amount);
3448
3449
  return this.extend(this.parseMarginModification(response, market), {
3449
- 'amount': this.parseNumber(amount),
3450
+ 'amount': parsedAmount,
3450
3451
  'type': type,
3451
3452
  });
3452
3453
  }
@@ -3419,7 +3419,7 @@ class htx extends htx$1["default"] {
3419
3419
  for (let i = 0; i < accounts.length; i++) {
3420
3420
  const account = accounts[i];
3421
3421
  const info = this.safeValue(account, 'info');
3422
- const subtype = this.safeString(info, 'subtype', undefined);
3422
+ const subtype = this.safeString(info, 'subtype');
3423
3423
  const typeFromAccount = this.safeString(account, 'type');
3424
3424
  if (type === 'margin') {
3425
3425
  if (subtype === marketId) {
@@ -3852,7 +3852,8 @@ class htx extends htx$1["default"] {
3852
3852
  // "ts": 1770293281344
3853
3853
  // }
3854
3854
  //
3855
- let result = { 'info': response };
3855
+ const finalResponse = response;
3856
+ let result = { 'info': finalResponse };
3856
3857
  const data = this.safeValue(response, 'data');
3857
3858
  if (isMultiAssetMode) {
3858
3859
  const details = this.safeList(data, 'details', []);
@@ -7587,7 +7588,8 @@ class htx extends htx$1["default"] {
7587
7588
  const sortedRequest = this.keysort(request);
7588
7589
  let auth = this.urlencode(sortedRequest, true); // true is a go only requirment
7589
7590
  // unfortunately, PHP demands double quotes for the escaped newline symbol
7590
- const payload = [method, this.hostname, url, auth].join("\n"); // eslint-disable-line quotes
7591
+ const content = [method, this.hostname, url, auth];
7592
+ const payload = content.join("\n"); // eslint-disable-line quotes
7591
7593
  const signature = this.hmac(this.encode(payload), this.encode(this.secret), sha256.sha256, 'base64');
7592
7594
  auth += '&' + this.urlencode({ 'Signature': signature });
7593
7595
  url += '?' + auth;
@@ -7669,7 +7671,8 @@ class htx extends htx$1["default"] {
7669
7671
  }
7670
7672
  let auth = this.urlencode(request, true).replace('%2c', '%2C'); // in c# it manually needs to be uppercased
7671
7673
  // unfortunately, PHP demands double quotes for the escaped newline symbol
7672
- const payload = [method, hostname, url, auth].join("\n"); // eslint-disable-line quotes
7674
+ const content2 = [method, hostname, url, auth];
7675
+ const payload = content2.join("\n"); // eslint-disable-line quotes
7673
7676
  const signature = this.hmac(this.encode(payload), this.encode(this.secret), sha256.sha256, 'base64');
7674
7677
  auth += '&' + this.urlencode({ 'Signature': signature });
7675
7678
  url += '?' + auth;
@@ -7688,8 +7691,9 @@ class htx extends htx$1["default"] {
7688
7691
  };
7689
7692
  }
7690
7693
  }
7694
+ const finalHostname = hostname; // java req
7691
7695
  url = this.implodeParams(this.urls['api'][type], {
7692
- 'hostname': hostname,
7696
+ 'hostname': finalHostname,
7693
7697
  }) + url;
7694
7698
  }
7695
7699
  return { 'url': url, 'method': method, 'body': body, 'headers': headers };
@@ -1841,8 +1841,8 @@ class hyperliquid extends hyperliquid$1["default"] {
1841
1841
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-abstraction-state
1842
1842
  * @description returns enableUnifiedMargin so the user can check if unified account is enabled
1843
1843
  * @param {string} method the method for which we want to check if unified margin is enabled, this is used to check options for specific methods (e.g. fetchBalance can have a specific option to enable unified margin)
1844
- * @param address
1845
- * @param shouldRefresh
1844
+ * @param {string} [address] the wallet address to query; defaults to the configured walletAddress
1845
+ * @param {boolean} [shouldRefresh] force a fresh request instead of returning the cached value
1846
1846
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1847
1847
  * @returns {bool} enableUnifiedMargin
1848
1848
  */
@@ -1936,8 +1936,8 @@ class hyperliquid extends hyperliquid$1["default"] {
1936
1936
  * @method
1937
1937
  * @name hyperliquid#enableUserDexAbstraction
1938
1938
  * @description If set, actions on HIP-3 perps will automatically transfer collateral from validator-operated USDC perps balance for HIP-3 DEXs where USDC is the collateral token, and spot otherwise
1939
- * @param enabled
1940
- * @param params
1939
+ * @param {boolean} enabled whether to enable user dex abstraction
1940
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1941
1941
  * @param {string} [params.type] 'userDexAbstraction' or 'agentEnableDexAbstraction' default is 'userDexAbstraction'
1942
1942
  * @returns dictionary response from the exchange
1943
1943
  */
@@ -2149,7 +2149,7 @@ class hyperliquid extends hyperliquid$1["default"] {
2149
2149
  ordersToBeParsed.push(order);
2150
2150
  }
2151
2151
  }
2152
- return this.parseOrders(ordersToBeParsed, undefined);
2152
+ return this.parseOrders(ordersToBeParsed);
2153
2153
  }
2154
2154
  createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
2155
2155
  const market = this.market(symbol);
@@ -2193,10 +2193,11 @@ class hyperliquid extends hyperliquid$1["default"] {
2193
2193
  else {
2194
2194
  triggerPrice = this.priceToPrecision(symbol, stopLossPrice);
2195
2195
  }
2196
+ const tpSlType = (isTp) ? 'tp' : 'sl';
2196
2197
  orderType['trigger'] = {
2197
2198
  'isMarket': isMarket,
2198
2199
  'triggerPx': triggerPrice,
2199
- 'tpsl': (isTp) ? 'tp' : 'sl',
2200
+ 'tpsl': tpSlType,
2200
2201
  };
2201
2202
  }
2202
2203
  else {
@@ -2517,9 +2518,10 @@ class hyperliquid extends hyperliquid$1["default"] {
2517
2518
  else {
2518
2519
  cancelAction['type'] = 'cancel';
2519
2520
  for (let i = 0; i < ids.length; i++) {
2521
+ const o = this.parseToNumeric(ids[i]);
2520
2522
  cancelReq.push({
2521
2523
  'a': baseId,
2522
- 'o': this.parseToNumeric(ids[i]),
2524
+ 'o': o,
2523
2525
  });
2524
2526
  }
2525
2527
  }
@@ -2727,10 +2729,11 @@ class hyperliquid extends hyperliquid$1["default"] {
2727
2729
  else {
2728
2730
  triggerPrice = this.priceToPrecision(symbol, stopLossPrice);
2729
2731
  }
2732
+ const tpSlType = (isTp) ? 'tp' : 'sl';
2730
2733
  orderType['trigger'] = {
2731
2734
  'isMarket': isMarket,
2732
2735
  'triggerPx': triggerPrice,
2733
- 'tpsl': (isTp) ? 'tp' : 'sl',
2736
+ 'tpsl': tpSlType,
2734
2737
  };
2735
2738
  }
2736
2739
  else {
@@ -3321,8 +3324,9 @@ class hyperliquid extends hyperliquid$1["default"] {
3321
3324
  //
3322
3325
  const error = this.safeString(order, 'error');
3323
3326
  if (error !== undefined) {
3327
+ const finalOrder = order; // java req
3324
3328
  return this.safeOrder({
3325
- 'info': order,
3329
+ 'info': finalOrder,
3326
3330
  'status': 'rejected',
3327
3331
  });
3328
3332
  }
@@ -3357,6 +3361,7 @@ class hyperliquid extends hyperliquid$1["default"] {
3357
3361
  if (tif !== undefined) {
3358
3362
  postOnly = (tif === 'ALO');
3359
3363
  }
3364
+ const triggerPx = this.safeBool(entry, 'isTrigger') ? this.safeNumber(entry, 'triggerPx') : undefined;
3360
3365
  return this.safeOrder({
3361
3366
  'info': order,
3362
3367
  'id': this.safeString(entry, 'oid'),
@@ -3372,7 +3377,7 @@ class hyperliquid extends hyperliquid$1["default"] {
3372
3377
  'reduceOnly': this.safeBool(entry, 'reduceOnly'),
3373
3378
  'side': side,
3374
3379
  'price': this.safeString(entry, 'limitPx'),
3375
- 'triggerPrice': this.safeBool(entry, 'isTrigger') ? this.safeNumber(entry, 'triggerPx') : undefined,
3380
+ 'triggerPrice': triggerPx,
3376
3381
  'amount': totalAmount,
3377
3382
  'cost': undefined,
3378
3383
  'average': this.safeString(entry, 'avgPx'),
@@ -3644,7 +3649,7 @@ class hyperliquid extends hyperliquid$1["default"] {
3644
3649
  const data = this.safeList(response, 'assetPositions', []);
3645
3650
  const result = [];
3646
3651
  for (let i = 0; i < data.length; i++) {
3647
- result.push(this.parsePosition(data[i], undefined));
3652
+ result.push(this.parsePosition(data[i]));
3648
3653
  }
3649
3654
  return this.filterByArrayPositions(result, 'symbol', symbols, false);
3650
3655
  }
@@ -3958,10 +3963,11 @@ class hyperliquid extends hyperliquid$1["default"] {
3958
3963
  vaultAddress = this.formatVaultAddress(vaultAddress);
3959
3964
  strAmount = strAmount + ' subaccount:' + vaultAddress;
3960
3965
  }
3966
+ const strAmountFinal = strAmount; // java req
3961
3967
  const toPerp = (toAccount === 'perp') || (toAccount === 'swap');
3962
3968
  const transferPayload = {
3963
3969
  'hyperliquidChain': isSandboxMode ? 'Testnet' : 'Mainnet',
3964
- 'amount': strAmount,
3970
+ 'amount': strAmountFinal,
3965
3971
  'toPerp': toPerp,
3966
3972
  'nonce': nonce,
3967
3973
  };
@@ -3971,7 +3977,7 @@ class hyperliquid extends hyperliquid$1["default"] {
3971
3977
  'hyperliquidChain': transferPayload['hyperliquidChain'],
3972
3978
  'signatureChainId': '0x66eee',
3973
3979
  'type': 'usdClassTransfer',
3974
- 'amount': strAmount,
3980
+ 'amount': strAmountFinal,
3975
3981
  'toPerp': toPerp,
3976
3982
  'nonce': nonce,
3977
3983
  },
@@ -1391,10 +1391,11 @@ class indodax extends indodax$1["default"] {
1391
1391
  network = this.networkIdToCode(networkId).toUpperCase();
1392
1392
  }
1393
1393
  }
1394
+ const finalNetwork = network; // java req
1394
1395
  result[code] = {
1395
1396
  'info': {},
1396
1397
  'currency': code,
1397
- 'network': network,
1398
+ 'network': finalNetwork,
1398
1399
  'address': address,
1399
1400
  'tag': undefined,
1400
1401
  };
@@ -1733,10 +1733,11 @@ class kraken extends kraken$1["default"] {
1733
1733
  const amount = this.safeValue(rawOrder, 'amount');
1734
1734
  const price = this.safeValue(rawOrder, 'price');
1735
1735
  const orderParams = this.safeDict(rawOrder, 'params', {});
1736
+ const parsedAmount = this.amountToPrecision(market['symbol'], amount);
1736
1737
  const req = {
1737
1738
  'type': side,
1738
1739
  'ordertype': type,
1739
- 'volume': this.amountToPrecision(market['symbol'], amount),
1740
+ 'volume': parsedAmount,
1740
1741
  };
1741
1742
  const orderRequest = this.orderRequest('createOrders', marketId, type, req, amount, price, orderParams);
1742
1743
  ordersRequests.push(orderRequest[0]);
@@ -2074,12 +2075,12 @@ class kraken extends kraken$1["default"] {
2074
2075
  stopLossPrice = triggerPrice;
2075
2076
  }
2076
2077
  }
2077
- let finalType = this.parseOrderType(rawType);
2078
+ let typeParsed = this.parseOrderType(rawType);
2078
2079
  // unlike from endpoints which provide eg: "take-profit-limit"
2079
2080
  // for "space-delimited" orders we dont have market/limit suffixes, their format is
2080
2081
  // eg: `stop loss > limit 123`, so we need to parse them manually
2081
- if (this.inArray(finalType, ['stop loss', 'take profit'])) {
2082
- finalType = (price === undefined) ? 'market' : 'limit';
2082
+ if (this.inArray(typeParsed, ['stop loss', 'take profit'])) {
2083
+ typeParsed = (price === undefined) ? 'market' : 'limit';
2083
2084
  }
2084
2085
  const amendId = this.safeString(order, 'amend_id');
2085
2086
  if (amendId !== undefined) {
@@ -2094,7 +2095,7 @@ class kraken extends kraken$1["default"] {
2094
2095
  'lastTradeTimestamp': undefined,
2095
2096
  'status': status,
2096
2097
  'symbol': symbol,
2097
- 'type': finalType,
2098
+ 'type': typeParsed,
2098
2099
  'timeInForce': undefined,
2099
2100
  'postOnly': isPostOnly,
2100
2101
  'side': side,
@@ -3496,16 +3497,16 @@ class kraken extends kraken$1["default"] {
3496
3497
  async transfer(code, amount, fromAccount, toAccount, params = {}) {
3497
3498
  await this.loadMarkets();
3498
3499
  const currency = this.currency(code);
3499
- fromAccount = this.parseAccountType(fromAccount);
3500
- toAccount = this.parseAccountType(toAccount);
3500
+ const fromAccountParsed = this.parseAccountType(fromAccount);
3501
+ const toAccountParsed = this.parseAccountType(toAccount);
3501
3502
  const request = {
3502
3503
  'amount': this.currencyToPrecision(code, amount),
3503
- 'from': fromAccount,
3504
- 'to': toAccount,
3504
+ 'from': fromAccountParsed,
3505
+ 'to': toAccountParsed,
3505
3506
  'asset': currency['id'],
3506
3507
  };
3507
- if (fromAccount !== 'Spot Wallet') {
3508
- throw new errors.BadRequest(this.id + ' transfer cannot transfer from ' + fromAccount + ' to ' + toAccount + '. Use krakenfutures instead to transfer from the futures account.');
3508
+ if (fromAccountParsed !== 'Spot Wallet') {
3509
+ throw new errors.BadRequest(this.id + ' transfer cannot transfer from ' + fromAccountParsed + ' to ' + toAccountParsed + '. Use krakenfutures instead to transfer from the futures account.');
3509
3510
  }
3510
3511
  const response = await this.privatePostWalletTransfer(this.extend(request, params));
3511
3512
  //
@@ -3520,8 +3521,8 @@ class kraken extends kraken$1["default"] {
3520
3521
  const transfer = this.parseTransfer(response, currency);
3521
3522
  return this.extend(transfer, {
3522
3523
  'amount': amount,
3523
- 'fromAccount': fromAccount,
3524
- 'toAccount': toAccount,
3524
+ 'fromAccount': fromAccountParsed,
3525
+ 'toAccount': toAccountParsed,
3525
3526
  });
3526
3527
  }
3527
3528
  parseTransfer(transfer, currency = undefined) {
@@ -2050,6 +2050,7 @@ class krakenfutures extends krakenfutures$1["default"] {
2050
2050
  const innerStatus = this.safeString(order, 'status');
2051
2051
  const fetchOrderPriceTriggerOptions = this.safeDict(orderDictFromFetchOrder, 'priceTriggerOptions', {});
2052
2052
  const fetchOrderTriggerPrice = this.safeString(fetchOrderPriceTriggerOptions, 'triggerPrice');
2053
+ const unifiedSymbol = this.safeSymbol(this.safeString(orderDictFromFetchOrder, 'symbol'), market);
2053
2054
  return this.safeOrder({
2054
2055
  'info': order,
2055
2056
  'id': this.safeString(orderDictFromFetchOrder, 'orderId'),
@@ -2058,7 +2059,7 @@ class krakenfutures extends krakenfutures$1["default"] {
2058
2059
  'datetime': datetime,
2059
2060
  'lastTradeTimestamp': undefined,
2060
2061
  'lastUpdateTimestamp': this.parse8601(this.safeString(orderDictFromFetchOrder, 'lastUpdateTimestamp')),
2061
- 'symbol': this.safeSymbol(this.safeString(orderDictFromFetchOrder, 'symbol'), market),
2062
+ 'symbol': unifiedSymbol,
2062
2063
  'type': undefined,
2063
2064
  'timeInForce': undefined,
2064
2065
  'postOnly': undefined,
@@ -1060,9 +1060,10 @@ class lbank extends lbank$1["default"] {
1060
1060
  let fee = undefined;
1061
1061
  const feeCost = this.safeString(trade, 'tradeFee');
1062
1062
  if (feeCost !== undefined) {
1063
+ const feeCurr = (side === 'buy') ? market['base'] : market['quote'];
1063
1064
  fee = {
1064
1065
  'cost': feeCost,
1065
- 'currency': (side === 'buy') ? market['base'] : market['quote'],
1066
+ 'currency': feeCurr,
1066
1067
  'rate': this.safeString(trade, 'tradeFeeRate'),
1067
1068
  };
1068
1069
  }
@@ -1185,11 +1186,13 @@ class lbank extends lbank$1["default"] {
1185
1186
  const duration = this.parseTimeframe(timeframe);
1186
1187
  since = this.milliseconds() - (duration * 1000 * limit);
1187
1188
  }
1189
+ const parsedSince = this.parseToInt(since / 1000);
1190
+ const parsedLimit = Math.min(limit + 1, 2000); // max 2000;
1188
1191
  const request = {
1189
1192
  'symbol': market['id'],
1190
1193
  'type': this.safeString(this.timeframes, timeframe, timeframe),
1191
- 'time': this.parseToInt(since / 1000),
1192
- 'size': Math.min(limit + 1, 2000), // max 2000
1194
+ 'time': parsedSince,
1195
+ 'size': parsedLimit,
1193
1196
  };
1194
1197
  const response = await this.spotPublicGetKline(this.extend(request, params));
1195
1198
  const ohlcvs = this.safeList(response, 'data', []);
@@ -2978,9 +2981,10 @@ class lbank extends lbank$1["default"] {
2978
2981
  else {
2979
2982
  signatureMethod = 'HmacSHA256';
2980
2983
  }
2984
+ const finalSig = signatureMethod; // java req
2981
2985
  const auth = this.rawencode(this.keysort(this.extend({
2982
2986
  'echostr': echostr,
2983
- 'signature_method': signatureMethod,
2987
+ 'signature_method': finalSig,
2984
2988
  'timestamp': timestamp,
2985
2989
  }, query)));
2986
2990
  const encoded = this.encode(auth);
@@ -443,7 +443,7 @@ class lighter extends lighter$1["default"] {
443
443
  * @method
444
444
  * @name lighter#preLoadLighterLibrary
445
445
  * @description if the required credentials are available in options, it will pre-load the lighter Signer to avoid delaying sensitive calls like createOrder the first time they're executed
446
- * @param params
446
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
447
447
  * @returns {boolean} true if the signer was loaded, false otherwise
448
448
  */
449
449
  async preLoadLighterLibrary(params = {}) {
@@ -1276,7 +1276,7 @@ class luno extends luno$1["default"] {
1276
1276
  const firstWord = this.safeString(words, 0);
1277
1277
  const thirdWord = this.safeString(words, 2);
1278
1278
  const fourthWord = this.safeString(words, 3);
1279
- let type = this.safeString(types, firstWord, undefined);
1279
+ let type = this.safeString(types, firstWord);
1280
1280
  if ((type === undefined) && (thirdWord === 'fee')) {
1281
1281
  type = 'fee';
1282
1282
  }
@@ -685,6 +685,7 @@ class mercado extends mercado$1["default"] {
685
685
  const filled = this.safeString(order, 'executed_quantity');
686
686
  const lastTradeTimestamp = this.safeTimestamp(order, 'updated_timestamp');
687
687
  const rawTrades = this.safeValue(order, 'operations', []);
688
+ const symbol = market['symbol'];
688
689
  return this.safeOrder({
689
690
  'info': order,
690
691
  'id': id,
@@ -692,7 +693,7 @@ class mercado extends mercado$1["default"] {
692
693
  'timestamp': timestamp,
693
694
  'datetime': this.iso8601(timestamp),
694
695
  'lastTradeTimestamp': lastTradeTimestamp,
695
- 'symbol': market['symbol'],
696
+ 'symbol': symbol,
696
697
  'type': 'limit',
697
698
  'timeInForce': undefined,
698
699
  'postOnly': undefined,
@@ -322,6 +322,7 @@ class mexc extends mexc$1["default"] {
322
322
  'position/funding_records': 2,
323
323
  'position/position_mode': 2,
324
324
  'order/list/open_orders/{symbol}': 2,
325
+ 'order/list/open_orders': 2,
325
326
  'order/list/history_orders': 2,
326
327
  'order/list/order_deals/v3': 2,
327
328
  'order/external/{symbol}/{external_oid}': 2,
@@ -2596,8 +2597,10 @@ class mexc extends mexc$1["default"] {
2596
2597
  // Trigger
2597
2598
  // {"success":true,"code":0,"data":259208506303929856}
2598
2599
  //
2599
- const data = this.safeString(response, 'data');
2600
- return this.safeOrder({ 'id': data }, market);
2600
+ // {"success":true,"code":0,"data":{"orderId":"814218083416790528","ts":1779795118533}}
2601
+ //
2602
+ const data = this.safeDict(response, 'data');
2603
+ return this.safeOrder({ 'id': this.safeString(data, 'orderId'), 'timestamp': this.safeInteger(data, 'ts') }, market);
2601
2604
  }
2602
2605
  /**
2603
2606
  * @method
@@ -3130,8 +3133,12 @@ class mexc extends mexc$1["default"] {
3130
3133
  return this.parseOrders(response, market, since, limit);
3131
3134
  }
3132
3135
  else {
3133
- // TO_DO: another possible way is through: open_orders/{symbol}, but as they have same ratelimits, and less granularity, i think historical orders are more convenient, as it supports more params (however, theoretically, open-orders endpoint might be sligthly fast)
3134
- return await this.fetchOrdersByState(2, symbol, since, limit, params);
3136
+ if (limit === undefined) {
3137
+ request['page_size'] = 100; // max
3138
+ }
3139
+ const swapResponse = await this.contractPrivateGetOrderListOpenOrders(this.extend(request, params));
3140
+ const data = this.safeList(swapResponse, 'data', []);
3141
+ return this.parseOrders(data, market, since, limit, params);
3135
3142
  }
3136
3143
  }
3137
3144
  /**
@@ -3920,7 +3927,7 @@ class mexc extends mexc$1["default"] {
3920
3927
  for (let i = 0; i < wallet.length; i++) {
3921
3928
  const entry = wallet[i];
3922
3929
  const marketId = this.safeString(entry, 'symbol');
3923
- const symbol = this.safeSymbol(marketId, undefined);
3930
+ const symbol = this.safeSymbol(marketId);
3924
3931
  const base = this.safeValue(entry, 'baseAsset', {});
3925
3932
  const quote = this.safeValue(entry, 'quoteAsset', {});
3926
3933
  const baseCode = this.safeCurrencyCode(this.safeString(base, 'asset'));
@@ -4730,14 +4737,17 @@ class mexc extends mexc$1["default"] {
4730
4737
  }
4731
4738
  while (Precise["default"].stringLt(floor, maxVol)) {
4732
4739
  const cap = Precise["default"].stringAdd(floor, riskIncrVol);
4740
+ const minNotional = this.parseNumber(floor);
4741
+ const mainMarginRate = this.parseNumber(maintenanceMarginRate);
4742
+ const maxLev = this.parseNumber(Precise["default"].stringDiv('1', initialMarginRate));
4733
4743
  tiers.push({
4734
4744
  'tier': this.parseNumber(Precise["default"].stringDiv(cap, riskIncrVol)),
4735
4745
  'symbol': this.safeSymbol(marketId, market, undefined, 'contract'),
4736
4746
  'currency': this.safeCurrencyCode(quoteId),
4737
- 'minNotional': this.parseNumber(floor),
4747
+ 'minNotional': minNotional,
4738
4748
  'maxNotional': this.parseNumber(cap),
4739
- 'maintenanceMarginRate': this.parseNumber(maintenanceMarginRate),
4740
- 'maxLeverage': this.parseNumber(Precise["default"].stringDiv('1', initialMarginRate)),
4749
+ 'maintenanceMarginRate': mainMarginRate,
4750
+ 'maxLeverage': maxLev,
4741
4751
  'info': info,
4742
4752
  });
4743
4753
  initialMarginRate = Precise["default"].stringAdd(initialMarginRate, riskIncrImr);
@@ -5363,8 +5373,8 @@ class mexc extends mexc$1["default"] {
5363
5373
  * @description fetch a history of internal transfers made on an account
5364
5374
  * @see https://mexcdevelop.github.io/apidocs/spot_v2_en/#get-internal-assets-transfer-records
5365
5375
  * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-user-39-s-asset-transfer-records
5366
- * @see https://www.mexc.com/api-docs/spot-v3/wallet-endpoints#query-user-universal-transfer-history * @param {string} code unified currency code of the currency transferred
5367
- * @param code
5376
+ * @see https://www.mexc.com/api-docs/spot-v3/wallet-endpoints#query-user-universal-transfer-history
5377
+ * @param {string} [code] unified currency code of the currency transferred
5368
5378
  * @param {int} [since] the earliest time in ms to fetch transfers for
5369
5379
  * @param {int} [limit] the maximum number of transfers structures to retrieve
5370
5380
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -6102,8 +6112,8 @@ class mexc extends mexc$1["default"] {
6102
6112
  if (market['spot']) {
6103
6113
  throw new errors.BadSymbol(this.id + ' setMarginMode() supports contract markets only');
6104
6114
  }
6105
- marginMode = marginMode.toLowerCase();
6106
- if (marginMode !== 'isolated' && marginMode !== 'cross') {
6115
+ const marginModeLower = marginMode.toLowerCase();
6116
+ if (marginModeLower !== 'isolated' && marginModeLower !== 'cross') {
6107
6117
  throw new errors.BadRequest(this.id + ' setMarginMode() marginMode argument should be isolated or cross');
6108
6118
  }
6109
6119
  const leverage = this.safeInteger(params, 'leverage');
@@ -6113,7 +6123,7 @@ class mexc extends mexc$1["default"] {
6113
6123
  const direction = this.safeStringLower2(params, 'direction', 'positionId');
6114
6124
  const request = {
6115
6125
  'leverage': leverage,
6116
- 'openType': (marginMode === 'isolated') ? 1 : 2,
6126
+ 'openType': (marginModeLower === 'isolated') ? 1 : 2,
6117
6127
  };
6118
6128
  if (symbol !== undefined) {
6119
6129
  request['symbol'] = market['id'];
@@ -6229,7 +6239,7 @@ class mexc extends mexc$1["default"] {
6229
6239
  if (success === true) {
6230
6240
  return undefined;
6231
6241
  }
6232
- const responseCode = this.safeString(response, 'code', undefined);
6242
+ const responseCode = this.safeString(response, 'code');
6233
6243
  if ((responseCode !== undefined) && (responseCode !== '200') && (responseCode !== '0')) {
6234
6244
  const feedback = this.id + ' ' + body;
6235
6245
  this.throwBroadlyMatchedException(this.exceptions['broad'], body, feedback);
@@ -1405,7 +1405,7 @@ class modetrade extends modetrade$1["default"] {
1405
1405
  'fok': 'FOK',
1406
1406
  'post_only': 'PO',
1407
1407
  };
1408
- return this.safeString(timeInForces, timeInForce, undefined);
1408
+ return this.safeString(timeInForces, timeInForce);
1409
1409
  }
1410
1410
  parseOrderStatus(status) {
1411
1411
  if (status !== undefined) {
@@ -1823,6 +1823,9 @@ class okx extends okx$1["default"] {
1823
1823
  let maxLeverage = this.safeString(market, 'lever', '1');
1824
1824
  maxLeverage = Precise["default"].stringMax(maxLeverage, '1');
1825
1825
  const maxSpotCost = this.safeNumber(market, 'maxMktSz');
1826
+ const leverageAboveOne = Precise["default"].stringGt(maxLeverage, '1');
1827
+ const quoteEqualSettle = (quoteId === settleId);
1828
+ const baseEqualSettle = (baseId === settleId);
1826
1829
  const status = this.safeString(market, 'state');
1827
1830
  const instIdCode = this.safeInteger(market, 'instIdCode');
1828
1831
  return this.extend(fees, {
@@ -1837,14 +1840,14 @@ class okx extends okx$1["default"] {
1837
1840
  'settleId': settleId,
1838
1841
  'type': type,
1839
1842
  'spot': spot,
1840
- 'margin': spot && (Precise["default"].stringGt(maxLeverage, '1')),
1843
+ 'margin': spot && leverageAboveOne,
1841
1844
  'swap': swap,
1842
1845
  'future': future,
1843
1846
  'option': option,
1844
1847
  'active': status === 'live',
1845
1848
  'contract': contract,
1846
- 'linear': contract ? (quoteId === settleId) : undefined,
1847
- 'inverse': contract ? (baseId === settleId) : undefined,
1849
+ 'linear': contract ? quoteEqualSettle : undefined,
1850
+ 'inverse': contract ? baseEqualSettle : undefined,
1848
1851
  'contractSize': contract ? this.safeNumber(market, 'ctVal') : undefined,
1849
1852
  'expiry': expiry,
1850
1853
  'expiryDatetime': this.iso8601(expiry),
@@ -2266,9 +2266,11 @@ class oxfun extends oxfun$1["default"] {
2266
2266
  */
2267
2267
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
2268
2268
  await this.loadMarkets();
2269
+ const responseType = this.safeString(params, 'responseType', 'FULL');
2270
+ const timestamp = this.safeInteger(params, 'timestamp', this.milliseconds());
2269
2271
  const request = {
2270
- 'responseType': this.safeString(params, 'responseType', 'FULL'),
2271
- 'timestamp': this.safeInteger(params, 'timestamp', this.milliseconds()),
2272
+ 'responseType': responseType,
2273
+ 'timestamp': timestamp,
2272
2274
  };
2273
2275
  params = this.omit(params, ['responseType', 'timestamp']);
2274
2276
  const recvWindow = this.safeInteger(params, 'recvWindow');
@@ -2918,7 +2920,7 @@ class oxfun extends oxfun$1["default"] {
2918
2920
  return undefined;
2919
2921
  }
2920
2922
  if (code !== 200) {
2921
- const responseCode = this.safeString(response, 'code', undefined);
2923
+ const responseCode = this.safeString(response, 'code');
2922
2924
  const feedback = this.id + ' ' + body;
2923
2925
  this.throwBroadlyMatchedException(this.exceptions['broad'], body, feedback);
2924
2926
  this.throwExactlyMatchedException(this.exceptions['exact'], responseCode, feedback);
@@ -1113,10 +1113,12 @@ class p2b extends p2b$1["default"] {
1113
1113
  throw new errors.BadRequest(this.id + ' fetchMyTrades () the time between since and params["until"] cannot be greater than 24 hours');
1114
1114
  }
1115
1115
  const market = this.market(symbol);
1116
+ const sinceSec = this.parseToInt(since / 1000);
1117
+ const untilSec = this.parseToInt(until / 1000);
1116
1118
  const request = {
1117
1119
  'market': market['id'],
1118
- 'startTime': this.parseToInt(since / 1000),
1119
- 'endTime': this.parseToInt(until / 1000),
1120
+ 'startTime': sinceSec,
1121
+ 'endTime': untilSec,
1120
1122
  };
1121
1123
  if (limit !== undefined) {
1122
1124
  request['limit'] = limit;
@@ -1189,9 +1191,11 @@ class p2b extends p2b$1["default"] {
1189
1191
  if ((until - since) > 86400000) {
1190
1192
  throw new errors.BadRequest(this.id + ' fetchClosedOrders () the time between since and params["until"] cannot be greater than 24 hours');
1191
1193
  }
1194
+ const sinceSec = this.parseToInt(since / 1000);
1195
+ const untilSec = this.parseToInt(until / 1000);
1192
1196
  const request = {
1193
- 'startTime': this.parseToInt(since / 1000),
1194
- 'endTime': this.parseToInt(until / 1000),
1197
+ 'startTime': sinceSec,
1198
+ 'endTime': untilSec,
1195
1199
  };
1196
1200
  if (market !== undefined) {
1197
1201
  request['market'] = market['id'];
@@ -627,6 +627,7 @@ class paradex extends paradex$1["default"] {
627
627
  else {
628
628
  expiry = undefined;
629
629
  }
630
+ const expireDatetime = (expiry === 0) ? undefined : this.iso8601(expiry);
630
631
  return this.safeMarketStructure({
631
632
  'id': marketId,
632
633
  'symbol': symbol,
@@ -650,7 +651,7 @@ class paradex extends paradex$1["default"] {
650
651
  'maker': makerFee,
651
652
  'contractSize': this.parseNumber('1'),
652
653
  'expiry': expiry,
653
- 'expiryDatetime': (expiry === 0) ? undefined : this.iso8601(expiry),
654
+ 'expiryDatetime': expireDatetime,
654
655
  'strike': this.parseNumber(strikePrice),
655
656
  'optionType': this.safeStringLower(market, 'option_type'),
656
657
  'precision': {
@@ -1496,7 +1497,7 @@ class paradex extends paradex$1["default"] {
1496
1497
  'GTC': 'GTC',
1497
1498
  'POST_ONLY': 'PO',
1498
1499
  };
1499
- return this.safeString(timeInForces, timeInForce, undefined);
1500
+ return this.safeString(timeInForces, timeInForce);
1500
1501
  }
1501
1502
  parseOrderStatus(status) {
1502
1503
  if (status !== undefined) {