ccxt 4.4.24 → 4.4.26

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 (74) hide show
  1. package/README.md +6 -6
  2. package/dist/ccxt.browser.min.js +4 -4
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/alpaca.js +257 -11
  5. package/dist/cjs/src/base/Exchange.js +14 -1
  6. package/dist/cjs/src/binance.js +2 -3
  7. package/dist/cjs/src/bingx.js +7 -1
  8. package/dist/cjs/src/bitget.js +2 -2
  9. package/dist/cjs/src/bitmart.js +3 -3
  10. package/dist/cjs/src/bitmex.js +8 -7
  11. package/dist/cjs/src/bybit.js +3 -14
  12. package/dist/cjs/src/cex.js +40 -0
  13. package/dist/cjs/src/coinex.js +48 -29
  14. package/dist/cjs/src/digifinex.js +2 -2
  15. package/dist/cjs/src/exmo.js +1 -0
  16. package/dist/cjs/src/gate.js +3 -3
  17. package/dist/cjs/src/hitbtc.js +6 -12
  18. package/dist/cjs/src/htx.js +18 -19
  19. package/dist/cjs/src/hyperliquid.js +14 -4
  20. package/dist/cjs/src/kucoin.js +2 -2
  21. package/dist/cjs/src/okx.js +3 -2
  22. package/dist/cjs/src/phemex.js +4 -2
  23. package/dist/cjs/src/pro/exmo.js +216 -3
  24. package/dist/cjs/src/whitebit.js +2 -2
  25. package/dist/cjs/src/woofipro.js +1 -1
  26. package/dist/cjs/src/xt.js +44 -28
  27. package/js/ccxt.d.ts +1 -1
  28. package/js/ccxt.js +1 -1
  29. package/js/src/abstract/alpaca.d.ts +1 -0
  30. package/js/src/abstract/bingx.d.ts +1 -0
  31. package/js/src/abstract/okx.d.ts +1 -0
  32. package/js/src/abstract/phemex.d.ts +1 -0
  33. package/js/src/alpaca.d.ts +6 -1
  34. package/js/src/alpaca.js +258 -12
  35. package/js/src/base/Exchange.d.ts +7 -6
  36. package/js/src/base/Exchange.js +14 -1
  37. package/js/src/base/types.d.ts +3 -3
  38. package/js/src/binance.d.ts +3 -14
  39. package/js/src/binance.js +2 -3
  40. package/js/src/bingx.js +7 -1
  41. package/js/src/bitget.d.ts +3 -13
  42. package/js/src/bitget.js +2 -2
  43. package/js/src/bitmart.d.ts +3 -13
  44. package/js/src/bitmart.js +3 -3
  45. package/js/src/bitmex.js +8 -7
  46. package/js/src/bybit.d.ts +3 -14
  47. package/js/src/bybit.js +3 -14
  48. package/js/src/cex.d.ts +2 -0
  49. package/js/src/cex.js +40 -0
  50. package/js/src/coinex.d.ts +3 -15
  51. package/js/src/coinex.js +48 -29
  52. package/js/src/digifinex.d.ts +3 -13
  53. package/js/src/digifinex.js +2 -2
  54. package/js/src/exmo.js +1 -0
  55. package/js/src/gate.d.ts +3 -13
  56. package/js/src/gate.js +3 -3
  57. package/js/src/hitbtc.d.ts +0 -1
  58. package/js/src/hitbtc.js +6 -12
  59. package/js/src/htx.d.ts +3 -14
  60. package/js/src/htx.js +18 -19
  61. package/js/src/hyperliquid.js +14 -4
  62. package/js/src/kucoin.d.ts +3 -13
  63. package/js/src/kucoin.js +2 -2
  64. package/js/src/okx.d.ts +3 -13
  65. package/js/src/okx.js +3 -2
  66. package/js/src/phemex.js +4 -2
  67. package/js/src/pro/exmo.d.ts +5 -1
  68. package/js/src/pro/exmo.js +216 -3
  69. package/js/src/whitebit.d.ts +3 -13
  70. package/js/src/whitebit.js +2 -2
  71. package/js/src/woo.d.ts +1 -1
  72. package/js/src/woofipro.js +1 -1
  73. package/js/src/xt.js +44 -28
  74. package/package.json +1 -1
@@ -460,9 +460,43 @@ class coinex extends coinex$1 {
460
460
  'FUTURES': 'swap',
461
461
  },
462
462
  'networks': {
463
+ 'BTC': 'BTC',
463
464
  'BEP20': 'BSC',
464
- 'TRX': 'TRC20',
465
- 'ETH': 'ERC20',
465
+ 'TRC20': 'TRC20',
466
+ 'ERC20': 'ERC20',
467
+ 'BRC20': 'BRC20',
468
+ 'SOL': 'SOL',
469
+ 'TON': 'SOL',
470
+ 'BSV': 'BSV',
471
+ 'AVAXC': 'AVA_C',
472
+ 'AVAXX': 'AVA',
473
+ 'SUI': 'SUI',
474
+ 'ACA': 'ACA',
475
+ 'CHZ': 'CHILIZ',
476
+ 'ADA': 'ADA',
477
+ 'ARB': 'ARBITRUM',
478
+ 'ARBNOVA': 'ARBITRUM_NOVA',
479
+ 'OP': 'OPTIMISM',
480
+ 'APT': 'APTOS',
481
+ 'ATOM': 'ATOM',
482
+ 'FTM': 'FTM',
483
+ 'BCH': 'BCH',
484
+ 'ASTR': 'ASTR',
485
+ 'LTC': 'LTC',
486
+ 'MATIC': 'MATIC',
487
+ 'CRONOS': 'CRONOS',
488
+ 'DASH': 'DASH',
489
+ 'DOT': 'DOT',
490
+ 'ETC': 'ETC',
491
+ 'ETHW': 'ETHPOW',
492
+ 'FIL': 'FIL',
493
+ 'ZIL': 'ZIL',
494
+ 'DOGE': 'DOGE',
495
+ 'TIA': 'CELESTIA',
496
+ 'SEI': 'SEI',
497
+ 'XRP': 'XRP',
498
+ 'XMR': 'XMR',
499
+ // CSC, AE, BASE, AIPG, AKASH, POLKADOTASSETHUB ?, ALEO, STX, ALGO, ALPH, BLAST, AR, ARCH, ARDR, ARK, ARRR, MANTA, NTRN, LUNA, AURORA, AVAIL, ASC20, AVA, AYA, AZERO, BAN, BAND, BB, RUNES, BEAM, BELLSCOIN, BITCI, NEAR, AGORIC, BLOCX, BNC, BOBA, BRISE, KRC20, CANTO, CAPS, CCD, CELO, CFX, CHI, CKB, CLORE, CLV, CORE, CSPR, CTXC, DAG, DCR, DERO, DESO, DEFI, DGB, DNX, DOCK, DOGECHAIN, DYDX, DYMENSION, EGLD, ELA, ELF, ENJIN, EOSIO, ERG, ETN_SC, EVMOS, EWC, SGB, FACT, FB, FET, FIO, FIRO, NEO3, FLOW, FLARE, FLUX, LINEA, FREN, FSN, FB_BRC20, GLMR, GRIN, GRS, HACASH, HBAR, HERB, HIVE, MAPO, HMND, HNS, ZKSYNC, HTR, HUAHUA, MERLIN, ICP, ICX, INJ, IOST, IOTA, IOTX, IRIS, IRON, ONE, JOYSTREAM, KAI, KAR, KAS, KAVA, KCN, KDA, KLAY, KLY, KMD, KSM, KUB, KUJIRA, LAT, LBC, LUNC, LUKSO, MARS, METIS, MINA, MANTLE, MOB, MODE, MONA, MOVR, MTL, NEOX, NEXA, NIBI, NIMIQ, NMC, ONOMY, NRG, WAVES, NULS, OAS, OCTA, OLT, ONT, OORT, ORAI, OSMO, P3D, COMPOSABLE, PIVX, RON, POKT, POLYMESH, PRE_MARKET, PYI, QKC, QTUM, QUBIC, RSK, ROSE, ROUTE, RTM, THORCHAIN, RVN, RADIANT, SAGA, SALVIUM, SATOX, SC, SCP, _NULL, SCRT, SDN, RGBPP, SELF, SMH, SPACE, STARGAZE, STC, STEEM, STRATISEVM, STRD, STARKNET, SXP, SYS, TAIKO, TAO, TARA, TENET, THETA, TT, VENOM, VECHAIN, TOMO, VITE, VLX, VSYS, VTC, WAN, WAXP, WEMIX, XCH, XDC, XEC, XELIS, NEM, XHV, XLM, XNA, NANO, XPLA, XPR, XPRT, XRD, XTZ, XVG, XYM, ZANO, ZEC, ZEN, ZEPH, ZETA
466
500
  },
467
501
  },
468
502
  'commonCurrencies': {
@@ -3752,23 +3786,15 @@ class coinex extends coinex$1 {
3752
3786
  */
3753
3787
  await this.loadMarkets();
3754
3788
  const currency = this.currency(code);
3755
- const networks = this.safeDict(currency, 'networks', {});
3756
- const network = this.safeString2(params, 'network', 'chain');
3757
- params = this.omit(params, 'network');
3758
- const networksKeys = Object.keys(networks);
3759
- const numOfNetworks = networksKeys.length;
3760
- if (networks !== undefined && numOfNetworks > 1) {
3761
- if (network === undefined) {
3762
- throw new errors.ArgumentsRequired(this.id + ' fetchDepositAddress() ' + code + ' requires a network parameter');
3763
- }
3764
- if (!(network in networks)) {
3765
- throw new errors.ExchangeError(this.id + ' fetchDepositAddress() ' + network + ' network not supported for ' + code);
3766
- }
3767
- }
3768
3789
  const request = {
3769
3790
  'ccy': currency['id'],
3770
- 'chain': network,
3771
3791
  };
3792
+ let networkCode = undefined;
3793
+ [networkCode, params] = this.handleNetworkCodeAndParams(params);
3794
+ if (networkCode === undefined) {
3795
+ throw new errors.ArgumentsRequired(this.id + ' fetchDepositAddress() requires a "network" parameter');
3796
+ }
3797
+ request['chain'] = this.networkCodeToId(networkCode); // required for on-chain, not required for inter-user transfer
3772
3798
  const response = await this.v2PrivateGetAssetsDepositAddress(this.extend(request, params));
3773
3799
  //
3774
3800
  // {
@@ -3781,13 +3807,7 @@ class coinex extends coinex$1 {
3781
3807
  // }
3782
3808
  //
3783
3809
  const data = this.safeDict(response, 'data', {});
3784
- const depositAddress = this.parseDepositAddress(data, currency);
3785
- const options = this.safeDict(this.options, 'fetchDepositAddress', {});
3786
- const fillResponseFromRequest = this.safeBool(options, 'fillResponseFromRequest', true);
3787
- if (fillResponseFromRequest) {
3788
- depositAddress['network'] = this.networkIdToCode(network, currency).toUpperCase();
3789
- }
3790
- return depositAddress;
3810
+ return this.parseDepositAddress(data, currency);
3791
3811
  }
3792
3812
  parseDepositAddress(depositAddress, currency = undefined) {
3793
3813
  //
@@ -4687,8 +4707,6 @@ class coinex extends coinex$1 {
4687
4707
  this.checkAddress(address);
4688
4708
  await this.loadMarkets();
4689
4709
  const currency = this.currency(code);
4690
- const networkCode = this.safeStringUpper2(params, 'network', 'chain');
4691
- params = this.omit(params, 'network');
4692
4710
  if (tag) {
4693
4711
  address = address + ':' + tag;
4694
4712
  }
@@ -4697,6 +4715,8 @@ class coinex extends coinex$1 {
4697
4715
  'to_address': address,
4698
4716
  'amount': this.numberToString(amount), // the actual amount without fees, https://www.coinex.com/fees
4699
4717
  };
4718
+ let networkCode = undefined;
4719
+ [networkCode, params] = this.handleNetworkCodeAndParams(params);
4700
4720
  if (networkCode !== undefined) {
4701
4721
  request['chain'] = this.networkCodeToId(networkCode); // required for on-chain, not required for inter-user transfer
4702
4722
  }
@@ -4734,6 +4754,7 @@ class coinex extends coinex$1 {
4734
4754
  const statuses = {
4735
4755
  'audit': 'pending',
4736
4756
  'pass': 'pending',
4757
+ 'audit_required': 'pending',
4737
4758
  'processing': 'pending',
4738
4759
  'confirming': 'pending',
4739
4760
  'not_pass': 'failed',
@@ -5318,17 +5339,15 @@ class coinex extends coinex$1 {
5318
5339
  market = this.safeMarket(marketId, market, undefined, 'spot');
5319
5340
  const timestamp = this.safeInteger(info, 'expired_at');
5320
5341
  return {
5321
- 'account': undefined,
5342
+ 'info': info,
5322
5343
  'symbol': market['symbol'],
5323
- 'marginMode': 'isolated',
5324
- 'marginType': undefined,
5325
5344
  'currency': this.safeCurrencyCode(this.safeString(info, 'ccy')),
5326
5345
  'interest': this.safeNumber(info, 'to_repaied_amount'),
5327
5346
  'interestRate': this.safeNumber(info, 'daily_interest_rate'),
5328
5347
  'amountBorrowed': this.safeNumber(info, 'borrow_amount'),
5348
+ 'marginMode': 'isolated',
5329
5349
  'timestamp': timestamp,
5330
5350
  'datetime': this.iso8601(timestamp),
5331
- 'info': info,
5332
5351
  };
5333
5352
  }
5334
5353
  async borrowIsolatedMargin(symbol, code, amount, params = {}) {
@@ -3100,15 +3100,15 @@ class digifinex extends digifinex$1 {
3100
3100
  const currency = (market === undefined) ? undefined : market['base'];
3101
3101
  const symbol = this.safeSymbol(marketId, market);
3102
3102
  return {
3103
- 'account': symbol,
3103
+ 'info': info,
3104
3104
  'symbol': symbol,
3105
3105
  'currency': currency,
3106
3106
  'interest': undefined,
3107
3107
  'interestRate': 0.001,
3108
3108
  'amountBorrowed': this.parseNumber(amountBorrowed),
3109
+ 'marginMode': undefined,
3109
3110
  'timestamp': undefined,
3110
3111
  'datetime': undefined,
3111
- 'info': info,
3112
3112
  };
3113
3113
  }
3114
3114
  async fetchCrossBorrowRate(code, params = {}) {
@@ -211,6 +211,7 @@ class exmo extends exmo$1 {
211
211
  'precisionMode': number.TICK_SIZE,
212
212
  'exceptions': {
213
213
  'exact': {
214
+ '140333': errors.InvalidOrder,
214
215
  '140434': errors.BadRequest,
215
216
  '40005': errors.AuthenticationError,
216
217
  '40009': errors.InvalidNonce,
@@ -6488,14 +6488,14 @@ class gate extends gate$1 {
6488
6488
  const timestamp = this.safeInteger(info, 'create_time');
6489
6489
  return {
6490
6490
  'info': info,
6491
- 'timestamp': timestamp,
6492
- 'datetime': this.iso8601(timestamp),
6493
6491
  'symbol': this.safeString(market, 'symbol'),
6494
6492
  'currency': this.safeCurrencyCode(this.safeString(info, 'currency')),
6495
- 'marginMode': marginMode,
6496
6493
  'interest': this.safeNumber(info, 'interest'),
6497
6494
  'interestRate': this.safeNumber(info, 'actual_rate'),
6498
6495
  'amountBorrowed': undefined,
6496
+ 'marginMode': marginMode,
6497
+ 'timestamp': timestamp,
6498
+ 'datetime': this.iso8601(timestamp),
6499
6499
  };
6500
6500
  }
6501
6501
  sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
@@ -851,7 +851,8 @@ class hitbtc extends hitbtc$1 {
851
851
  for (let j = 0; j < rawNetworks.length; j++) {
852
852
  const rawNetwork = rawNetworks[j];
853
853
  const networkId = this.safeString2(rawNetwork, 'protocol', 'network');
854
- const network = this.safeNetwork(networkId);
854
+ let networkCode = this.networkIdToCode(networkId);
855
+ networkCode = (networkCode !== undefined) ? networkCode.toUpperCase() : undefined;
855
856
  fee = this.safeNumber(rawNetwork, 'payout_fee');
856
857
  const networkPrecision = this.safeNumber(rawNetwork, 'precision_payout');
857
858
  const payinEnabledNetwork = this.safeBool(rawNetwork, 'payin_enabled', false);
@@ -869,10 +870,10 @@ class hitbtc extends hitbtc$1 {
869
870
  else if (!payoutEnabledNetwork) {
870
871
  withdrawEnabled = false;
871
872
  }
872
- networks[network] = {
873
+ networks[networkCode] = {
873
874
  'info': rawNetwork,
874
875
  'id': networkId,
875
- 'network': network,
876
+ 'network': networkCode,
876
877
  'fee': fee,
877
878
  'active': activeNetwork,
878
879
  'deposit': payinEnabledNetwork,
@@ -909,14 +910,6 @@ class hitbtc extends hitbtc$1 {
909
910
  }
910
911
  return result;
911
912
  }
912
- safeNetwork(networkId) {
913
- if (networkId === undefined) {
914
- return undefined;
915
- }
916
- else {
917
- return networkId.toUpperCase();
918
- }
919
- }
920
913
  async createDepositAddress(code, params = {}) {
921
914
  /**
922
915
  * @method
@@ -3557,7 +3550,8 @@ class hitbtc extends hitbtc$1 {
3557
3550
  for (let j = 0; j < networks.length; j++) {
3558
3551
  const networkEntry = networks[j];
3559
3552
  const networkId = this.safeString(networkEntry, 'network');
3560
- const networkCode = this.networkIdToCode(networkId);
3553
+ let networkCode = this.networkIdToCode(networkId);
3554
+ networkCode = (networkCode !== undefined) ? networkCode.toUpperCase() : undefined;
3561
3555
  const withdrawFee = this.safeNumber(networkEntry, 'payout_fee');
3562
3556
  const isDefault = this.safeValue(networkEntry, 'default');
3563
3557
  const withdrawResult = {
@@ -5253,17 +5253,17 @@ class htx extends htx$1 {
5253
5253
  let orderType = type.replace('buy-', '');
5254
5254
  orderType = orderType.replace('sell-', '');
5255
5255
  const options = this.safeValue(this.options, market['type'], {});
5256
- const stopPrice = this.safeString2(params, 'stopPrice', 'stop-price');
5257
- if (stopPrice === undefined) {
5256
+ const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'stop-price']);
5257
+ if (triggerPrice === undefined) {
5258
5258
  const stopOrderTypes = this.safeValue(options, 'stopOrderTypes', {});
5259
5259
  if (orderType in stopOrderTypes) {
5260
- throw new errors.ArgumentsRequired(this.id + ' createOrder() requires a stopPrice or a stop-price parameter for a stop order');
5260
+ throw new errors.ArgumentsRequired(this.id + ' createOrder() requires a triggerPrice for a stop order');
5261
5261
  }
5262
5262
  }
5263
5263
  else {
5264
5264
  const defaultOperator = (side === 'sell') ? 'lte' : 'gte';
5265
5265
  const stopOperator = this.safeString(params, 'operator', defaultOperator);
5266
- request['stop-price'] = this.priceToPrecision(symbol, stopPrice);
5266
+ request['stop-price'] = this.priceToPrecision(symbol, triggerPrice);
5267
5267
  request['operator'] = stopOperator;
5268
5268
  if ((orderType === 'limit') || (orderType === 'limit-fok')) {
5269
5269
  orderType = 'stop-' + orderType;
@@ -5340,7 +5340,7 @@ class htx extends htx$1 {
5340
5340
  if (orderType in limitOrderTypes) {
5341
5341
  request['price'] = this.priceToPrecision(symbol, price);
5342
5342
  }
5343
- params = this.omit(params, ['stopPrice', 'stop-price', 'clientOrderId', 'client-order-id', 'operator', 'timeInForce']);
5343
+ params = this.omit(params, ['triggerPrice', 'stopPrice', 'stop-price', 'clientOrderId', 'client-order-id', 'operator', 'timeInForce']);
5344
5344
  return this.extend(request, params);
5345
5345
  }
5346
5346
  createContractOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
@@ -5378,16 +5378,16 @@ class htx extends htx$1 {
5378
5378
  else if (timeInForce === 'IOC') {
5379
5379
  type = 'ioc';
5380
5380
  }
5381
- const triggerPrice = this.safeNumber2(params, 'stopPrice', 'trigger_price');
5381
+ const triggerPrice = this.safeNumberN(params, ['triggerPrice', 'stopPrice', 'trigger_price']);
5382
5382
  const stopLossTriggerPrice = this.safeNumber2(params, 'stopLossPrice', 'sl_trigger_price');
5383
5383
  const takeProfitTriggerPrice = this.safeNumber2(params, 'takeProfitPrice', 'tp_trigger_price');
5384
5384
  const trailingPercent = this.safeString2(params, 'trailingPercent', 'callback_rate');
5385
5385
  const trailingTriggerPrice = this.safeNumber(params, 'trailingTriggerPrice', price);
5386
5386
  const isTrailingPercentOrder = trailingPercent !== undefined;
5387
- const isStop = triggerPrice !== undefined;
5387
+ const isTrigger = triggerPrice !== undefined;
5388
5388
  const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
5389
5389
  const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
5390
- if (isStop) {
5390
+ if (isTrigger) {
5391
5391
  const triggerType = this.safeString2(params, 'triggerType', 'trigger_type', 'le');
5392
5392
  request['trigger_type'] = triggerType;
5393
5393
  request['trigger_price'] = this.priceToPrecision(symbol, triggerPrice);
@@ -5440,7 +5440,7 @@ class htx extends htx$1 {
5440
5440
  const broker = this.safeValue(this.options, 'broker', {});
5441
5441
  const brokerId = this.safeString(broker, 'id');
5442
5442
  request['channel_code'] = brokerId;
5443
- params = this.omit(params, ['reduceOnly', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'triggerType', 'leverRate', 'timeInForce', 'leverage', 'trailingPercent', 'trailingTriggerPrice']);
5443
+ params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'triggerType', 'leverRate', 'timeInForce', 'leverage', 'trailingPercent', 'trailingTriggerPrice']);
5444
5444
  return this.extend(request, params);
5445
5445
  }
5446
5446
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -5463,7 +5463,7 @@ class htx extends htx$1 {
5463
5463
  * @param {float} amount how much you want to trade in units of the base currency
5464
5464
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
5465
5465
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5466
- * @param {float} [params.stopPrice] the price a trigger order is triggered at
5466
+ * @param {float} [params.triggerPrice] the price a trigger order is triggered at
5467
5467
  * @param {string} [params.triggerType] *contract trigger orders only* ge: greater than or equal to, le: less than or equal to
5468
5468
  * @param {float} [params.stopLossPrice] *contract only* the price a stop-loss order is triggered at
5469
5469
  * @param {float} [params.takeProfitPrice] *contract only* the price a take-profit order is triggered at
@@ -5479,12 +5479,12 @@ class htx extends htx$1 {
5479
5479
  */
5480
5480
  await this.loadMarkets();
5481
5481
  const market = this.market(symbol);
5482
- const triggerPrice = this.safeNumber2(params, 'stopPrice', 'trigger_price');
5482
+ const triggerPrice = this.safeNumberN(params, ['triggerPrice', 'stopPrice', 'trigger_price']);
5483
5483
  const stopLossTriggerPrice = this.safeNumber2(params, 'stopLossPrice', 'sl_trigger_price');
5484
5484
  const takeProfitTriggerPrice = this.safeNumber2(params, 'takeProfitPrice', 'tp_trigger_price');
5485
5485
  const trailingPercent = this.safeNumber(params, 'trailingPercent');
5486
5486
  const isTrailingPercentOrder = trailingPercent !== undefined;
5487
- const isStop = triggerPrice !== undefined;
5487
+ const isTrigger = triggerPrice !== undefined;
5488
5488
  const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
5489
5489
  const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
5490
5490
  let response = undefined;
@@ -5502,7 +5502,7 @@ class htx extends htx$1 {
5502
5502
  [marginMode, contractRequest] = this.handleMarginModeAndParams('createOrder', contractRequest);
5503
5503
  marginMode = (marginMode === undefined) ? 'cross' : marginMode;
5504
5504
  if (marginMode === 'isolated') {
5505
- if (isStop) {
5505
+ if (isTrigger) {
5506
5506
  response = await this.contractPrivatePostLinearSwapApiV1SwapTriggerOrder(contractRequest);
5507
5507
  }
5508
5508
  else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
@@ -5516,7 +5516,7 @@ class htx extends htx$1 {
5516
5516
  }
5517
5517
  }
5518
5518
  else if (marginMode === 'cross') {
5519
- if (isStop) {
5519
+ if (isTrigger) {
5520
5520
  response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTriggerOrder(contractRequest);
5521
5521
  }
5522
5522
  else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
@@ -5536,7 +5536,7 @@ class htx extends htx$1 {
5536
5536
  throw new errors.ArgumentsRequired(this.id + ' createOrder () requires an extra parameter params["offset"] to be set to "open" or "close" when placing orders in inverse markets');
5537
5537
  }
5538
5538
  if (market['swap']) {
5539
- if (isStop) {
5539
+ if (isTrigger) {
5540
5540
  response = await this.contractPrivatePostSwapApiV1SwapTriggerOrder(contractRequest);
5541
5541
  }
5542
5542
  else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
@@ -5550,7 +5550,7 @@ class htx extends htx$1 {
5550
5550
  }
5551
5551
  }
5552
5552
  else if (market['future']) {
5553
- if (isStop) {
5553
+ if (isTrigger) {
5554
5554
  response = await this.contractPrivatePostApiV1ContractTriggerOrder(contractRequest);
5555
5555
  }
5556
5556
  else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
@@ -7301,16 +7301,15 @@ class htx extends htx$1 {
7301
7301
  const symbol = this.safeString(market, 'symbol');
7302
7302
  const timestamp = this.safeInteger(info, 'accrued-at');
7303
7303
  return {
7304
- 'account': (marginMode === 'isolated') ? symbol : 'cross',
7304
+ 'info': info,
7305
7305
  'symbol': symbol,
7306
- 'marginMode': marginMode,
7307
7306
  'currency': this.safeCurrencyCode(this.safeString(info, 'currency')),
7308
7307
  'interest': this.safeNumber(info, 'interest-amount'),
7309
7308
  'interestRate': this.safeNumber(info, 'interest-rate'),
7310
7309
  'amountBorrowed': this.safeNumber(info, 'loan-amount'),
7310
+ 'marginMode': marginMode,
7311
7311
  'timestamp': timestamp,
7312
7312
  'datetime': this.iso8601(timestamp),
7313
- 'info': info,
7314
7313
  };
7315
7314
  }
7316
7315
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
@@ -782,9 +782,18 @@ class hyperliquid extends hyperliquid$1 {
782
782
  await this.loadMarkets();
783
783
  const market = this.market(symbol);
784
784
  const until = this.safeInteger(params, 'until', this.milliseconds());
785
- const useTail = (since === undefined);
785
+ let useTail = since === undefined;
786
+ const originalSince = since;
786
787
  if (since === undefined) {
787
- since = 0;
788
+ if (limit !== undefined) {
789
+ // optimization if limit is provided
790
+ const timeframeInMilliseconds = this.parseTimeframe(timeframe) * 1000;
791
+ since = this.sum(until, timeframeInMilliseconds * limit * -1);
792
+ useTail = false;
793
+ }
794
+ else {
795
+ since = 0;
796
+ }
788
797
  }
789
798
  params = this.omit(params, ['until']);
790
799
  const request = {
@@ -813,7 +822,7 @@ class hyperliquid extends hyperliquid$1 {
813
822
  // }
814
823
  // ]
815
824
  //
816
- return this.parseOHLCVs(response, market, timeframe, since, limit, useTail);
825
+ return this.parseOHLCVs(response, market, timeframe, originalSince, limit, useTail);
817
826
  }
818
827
  parseOHLCV(ohlcv, market = undefined) {
819
828
  //
@@ -1615,7 +1624,8 @@ class hyperliquid extends hyperliquid$1 {
1615
1624
  request['startTime'] = since;
1616
1625
  }
1617
1626
  else {
1618
- request['startTime'] = this.milliseconds() - 100 * 60 * 60 * 1000;
1627
+ const maxLimit = (limit === undefined) ? 500 : limit;
1628
+ request['startTime'] = this.milliseconds() - maxLimit * 60 * 60 * 1000;
1619
1629
  }
1620
1630
  const until = this.safeInteger(params, 'until');
1621
1631
  params = this.omit(params, 'until');
@@ -4590,15 +4590,15 @@ class kucoin extends kucoin$1 {
4590
4590
  currencyId = this.safeString(info, 'currency');
4591
4591
  }
4592
4592
  return {
4593
+ 'info': info,
4593
4594
  'symbol': symbol,
4594
- 'marginMode': marginMode,
4595
4595
  'currency': this.safeCurrencyCode(currencyId),
4596
4596
  'interest': interest,
4597
4597
  'interestRate': this.safeNumber(info, 'dailyIntRate'),
4598
4598
  'amountBorrowed': amountBorrowed,
4599
+ 'marginMode': marginMode,
4599
4600
  'timestamp': timestamp,
4600
4601
  'datetime': this.iso8601(timestamp),
4601
- 'info': info,
4602
4602
  };
4603
4603
  }
4604
4604
  async fetchBorrowRateHistories(codes = undefined, since = undefined, limit = undefined, params = {}) {
@@ -395,6 +395,7 @@ class okx extends okx$1 {
395
395
  // eth staking
396
396
  'finance/staking-defi/eth/balance': 5 / 3,
397
397
  'finance/staking-defi/eth/purchase-redeem-history': 5 / 3,
398
+ 'finance/staking-defi/eth/product-info': 3,
398
399
  // copytrading
399
400
  'copytrading/current-subpositions': 1,
400
401
  'copytrading/subpositions-history': 1,
@@ -7073,15 +7074,15 @@ class okx extends okx$1 {
7073
7074
  }
7074
7075
  const timestamp = this.safeInteger(info, 'ts');
7075
7076
  return {
7077
+ 'info': info,
7076
7078
  'symbol': this.safeString(market, 'symbol'),
7077
- 'marginMode': this.safeString(info, 'mgnMode'),
7078
7079
  'currency': this.safeCurrencyCode(this.safeString(info, 'ccy')),
7079
7080
  'interest': this.safeNumber(info, 'interest'),
7080
7081
  'interestRate': this.safeNumber(info, 'interestRate'),
7081
7082
  'amountBorrowed': this.safeNumber(info, 'liab'),
7083
+ 'marginMode': this.safeString(info, 'mgnMode'),
7082
7084
  'timestamp': timestamp,
7083
7085
  'datetime': this.iso8601(timestamp),
7084
- 'info': info,
7085
7086
  };
7086
7087
  }
7087
7088
  async borrowCrossMargin(code, amount, params = {}) {
@@ -105,7 +105,7 @@ class phemex extends phemex$1 {
105
105
  'private': 'https://{hostname}',
106
106
  },
107
107
  'www': 'https://phemex.com',
108
- 'doc': 'https://github.com/phemex/phemex-api-docs',
108
+ 'doc': 'https://phemex-docs.github.io/#overview',
109
109
  'fees': 'https://phemex.com/fees-conditions',
110
110
  'referral': {
111
111
  'url': 'https://phemex.com/register?referralCode=EDNVJ',
@@ -163,6 +163,7 @@ class phemex extends phemex$1 {
163
163
  'v2': {
164
164
  'get': {
165
165
  'public/products': 5,
166
+ 'public/products-plus': 5,
166
167
  'md/v2/orderbook': 5,
167
168
  'md/v2/trade': 5,
168
169
  'md/v2/ticker/24hr': 5,
@@ -735,7 +736,7 @@ class phemex extends phemex$1 {
735
736
  'max': this.parseSafeNumber(this.safeString(market, 'maxOrderValue')),
736
737
  },
737
738
  },
738
- 'created': undefined,
739
+ 'created': this.safeInteger(market, 'listTime'),
739
740
  'info': market,
740
741
  });
741
742
  }
@@ -744,6 +745,7 @@ class phemex extends phemex$1 {
744
745
  * @method
745
746
  * @name phemex#fetchMarkets
746
747
  * @description retrieves data on all markets for phemex
748
+ * @see https://phemex-docs.github.io/#query-product-information-3
747
749
  * @param {object} [params] extra parameters specific to the exchange API endpoint
748
750
  * @returns {object[]} an array of objects representing market data
749
751
  */