ccxt 4.5.10 → 4.5.12

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 (113) hide show
  1. package/README.md +32 -33
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -6
  4. package/dist/cjs/src/apex.js +9 -0
  5. package/dist/cjs/src/base/Exchange.js +15 -3
  6. package/dist/cjs/src/base/functions/throttle.js +1 -1
  7. package/dist/cjs/src/binance.js +1 -1
  8. package/dist/cjs/src/bingx.js +1 -1
  9. package/dist/cjs/src/bitfinex.js +4 -2
  10. package/dist/cjs/src/bitget.js +20 -2
  11. package/dist/cjs/src/bitmart.js +2 -2
  12. package/dist/cjs/src/btcmarkets.js +4 -2
  13. package/dist/cjs/src/bybit.js +28 -7
  14. package/dist/cjs/src/coinbase.js +1 -0
  15. package/dist/cjs/src/coincatch.js +2 -1
  16. package/dist/cjs/src/deribit.js +21 -19
  17. package/dist/cjs/src/kraken.js +4 -0
  18. package/dist/cjs/src/krakenfutures.js +26 -5
  19. package/dist/cjs/src/kucoin.js +1 -1
  20. package/dist/cjs/src/latoken.js +1 -0
  21. package/dist/cjs/src/mexc.js +1 -0
  22. package/dist/cjs/src/okx.js +18 -9
  23. package/dist/cjs/src/onetrading.js +2 -1
  24. package/dist/cjs/src/phemex.js +1 -0
  25. package/dist/cjs/src/pro/alpaca.js +17 -1
  26. package/dist/cjs/src/pro/apex.js +17 -0
  27. package/dist/cjs/src/pro/binance.js +5 -5
  28. package/dist/cjs/src/pro/bitget.js +10 -3
  29. package/dist/cjs/src/pro/coinbase.js +8 -7
  30. package/dist/cjs/src/pro/htx.js +22 -3
  31. package/dist/cjs/src/pro/hyperliquid.js +4 -0
  32. package/dist/cjs/src/pro/kraken.js +282 -458
  33. package/dist/cjs/src/pro/mexc.js +16 -11
  34. package/dist/cjs/src/pro/woo.js +48 -4
  35. package/dist/cjs/src/probit.js +1 -1
  36. package/dist/cjs/src/woo.js +20 -2
  37. package/dist/cjs/src/xt.js +1 -1
  38. package/js/ccxt.d.ts +2 -8
  39. package/js/ccxt.js +2 -6
  40. package/js/src/abstract/coinbase.d.ts +1 -0
  41. package/js/src/abstract/coinbaseadvanced.d.ts +1 -0
  42. package/js/src/abstract/phemex.d.ts +1 -0
  43. package/js/src/abstract/xt.d.ts +1 -1
  44. package/js/src/apex.js +9 -0
  45. package/js/src/base/Exchange.d.ts +5 -2
  46. package/js/src/base/Exchange.js +15 -3
  47. package/js/src/base/functions/throttle.js +1 -1
  48. package/js/src/binance.js +1 -1
  49. package/js/src/bingx.js +1 -1
  50. package/js/src/bitfinex.d.ts +1 -1
  51. package/js/src/bitfinex.js +4 -2
  52. package/js/src/bitget.d.ts +15 -2
  53. package/js/src/bitget.js +20 -2
  54. package/js/src/bithumb.d.ts +1 -1
  55. package/js/src/bitmart.js +2 -2
  56. package/js/src/bitmex.d.ts +1 -1
  57. package/js/src/bitopro.d.ts +1 -1
  58. package/js/src/bitso.d.ts +1 -1
  59. package/js/src/bittrade.d.ts +1 -1
  60. package/js/src/blofin.d.ts +1 -1
  61. package/js/src/btcmarkets.d.ts +1 -1
  62. package/js/src/btcmarkets.js +4 -2
  63. package/js/src/bybit.d.ts +1 -1
  64. package/js/src/bybit.js +28 -7
  65. package/js/src/coinbase.d.ts +1 -1
  66. package/js/src/coinbase.js +1 -0
  67. package/js/src/coincatch.js +2 -1
  68. package/js/src/coinex.d.ts +1 -1
  69. package/js/src/cryptocom.d.ts +1 -1
  70. package/js/src/deribit.js +21 -19
  71. package/js/src/digifinex.d.ts +1 -1
  72. package/js/src/hibachi.d.ts +1 -1
  73. package/js/src/htx.d.ts +1 -1
  74. package/js/src/hyperliquid.d.ts +1 -1
  75. package/js/src/kraken.d.ts +1 -1
  76. package/js/src/kraken.js +4 -0
  77. package/js/src/krakenfutures.js +26 -5
  78. package/js/src/kucoin.js +1 -1
  79. package/js/src/kucoinfutures.d.ts +1 -1
  80. package/js/src/latoken.js +1 -0
  81. package/js/src/mexc.d.ts +1 -1
  82. package/js/src/mexc.js +1 -0
  83. package/js/src/oceanex.d.ts +1 -1
  84. package/js/src/okx.d.ts +1 -1
  85. package/js/src/okx.js +18 -9
  86. package/js/src/onetrading.d.ts +1 -1
  87. package/js/src/onetrading.js +2 -1
  88. package/js/src/phemex.js +1 -0
  89. package/js/src/pro/alpaca.js +17 -1
  90. package/js/src/pro/apex.d.ts +2 -0
  91. package/js/src/pro/apex.js +18 -1
  92. package/js/src/pro/binance.js +5 -5
  93. package/js/src/pro/bitget.d.ts +1 -0
  94. package/js/src/pro/bitget.js +10 -3
  95. package/js/src/pro/bitvavo.d.ts +2 -2
  96. package/js/src/pro/coinbase.js +8 -7
  97. package/js/src/pro/htx.js +22 -3
  98. package/js/src/pro/hyperliquid.js +4 -0
  99. package/js/src/pro/kraken.d.ts +7 -8
  100. package/js/src/pro/kraken.js +282 -458
  101. package/js/src/pro/mexc.js +16 -11
  102. package/js/src/pro/woo.js +48 -4
  103. package/js/src/probit.js +1 -1
  104. package/js/src/timex.d.ts +1 -1
  105. package/js/src/woo.js +20 -2
  106. package/js/src/xt.js +1 -1
  107. package/package.json +1 -1
  108. package/js/src/abstract/okcoin.d.ts +0 -77
  109. package/js/src/abstract/okcoin.js +0 -11
  110. package/js/src/okcoin.d.ts +0 -346
  111. package/js/src/okcoin.js +0 -3214
  112. package/js/src/pro/okcoin.d.ts +0 -91
  113. package/js/src/pro/okcoin.js +0 -763
package/js/src/bitmart.js CHANGED
@@ -1014,7 +1014,7 @@ export default class bitmart extends Exchange {
1014
1014
  'swap': false,
1015
1015
  'future': false,
1016
1016
  'option': false,
1017
- 'active': true,
1017
+ 'active': this.safeStringLower2(market, 'status', 'trade_status') === 'trading',
1018
1018
  'contract': false,
1019
1019
  'linear': undefined,
1020
1020
  'inverse': undefined,
@@ -1131,7 +1131,7 @@ export default class bitmart extends Exchange {
1131
1131
  'swap': isSwap,
1132
1132
  'future': isFutures,
1133
1133
  'option': false,
1134
- 'active': true,
1134
+ 'active': this.safeStringLower(market, 'status') === 'trading',
1135
1135
  'contract': true,
1136
1136
  'linear': true,
1137
1137
  'inverse': false,
@@ -233,7 +233,7 @@ export default class bitmex extends Exchange {
233
233
  * @param {object} [params] extra parameters specific to the exchange API endpoint
234
234
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
235
235
  */
236
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<Order[]>;
236
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
237
237
  /**
238
238
  * @method
239
239
  * @name bitmex#cancelAllOrders
@@ -143,7 +143,7 @@ export default class bitopro extends Exchange {
143
143
  * @param {object} [params] extra parameters specific to the exchange API endpoint
144
144
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
145
145
  */
146
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<Order[]>;
146
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
147
147
  /**
148
148
  * @method
149
149
  * @name bitopro#cancelAllOrders
package/js/src/bitso.d.ts CHANGED
@@ -142,7 +142,7 @@ export default class bitso extends Exchange {
142
142
  * @param {object} [params] extra parameters specific to the exchange API endpoint
143
143
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
144
144
  */
145
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<Order[]>;
145
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
146
146
  /**
147
147
  * @method
148
148
  * @name bitso#cancelAllOrders
@@ -234,7 +234,7 @@ export default class bittrade extends Exchange {
234
234
  * @param {object} [params] extra parameters specific to the exchange API endpoint
235
235
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
236
236
  */
237
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<any[]>;
237
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
238
238
  parseCancelOrders(orders: any): any[];
239
239
  /**
240
240
  * @method
@@ -276,7 +276,7 @@ export default class blofin extends Exchange {
276
276
  * @param {boolean} [params.trigger] whether the order is a stop/trigger order
277
277
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
278
278
  */
279
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<Order[]>;
279
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
280
280
  /**
281
281
  * @method
282
282
  * @name blofin#transfer
@@ -150,7 +150,7 @@ export default class btcmarkets extends Exchange {
150
150
  * @param {object} [params] extra parameters specific to the exchange API endpoint
151
151
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
152
152
  */
153
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<Order[]>;
153
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
154
154
  /**
155
155
  * @method
156
156
  * @name btcmarkets#cancelOrder
@@ -1013,11 +1013,13 @@ export default class btcmarkets extends Exchange {
1013
1013
  */
1014
1014
  async cancelOrders(ids, symbol = undefined, params = {}) {
1015
1015
  await this.loadMarkets();
1016
+ const numericIds = [];
1016
1017
  for (let i = 0; i < ids.length; i++) {
1017
- ids[i] = parseInt(ids[i]);
1018
+ // numericIds[i] = parseInt (ids[i]);
1019
+ numericIds.push(parseInt(ids[i]));
1018
1020
  }
1019
1021
  const request = {
1020
- 'ids': ids,
1022
+ 'ids': numericIds,
1021
1023
  };
1022
1024
  const response = await this.privateDeleteBatchordersIds(this.extend(request, params));
1023
1025
  //
package/js/src/bybit.d.ts CHANGED
@@ -322,7 +322,7 @@ export default class bybit extends Exchange {
322
322
  * @param {string[]} [params.clientOrderIds] client order ids
323
323
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
324
324
  */
325
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<Order[]>;
325
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
326
326
  /**
327
327
  * @method
328
328
  * @name bybit#cancelAllOrdersAfter
package/js/src/bybit.js CHANGED
@@ -185,7 +185,7 @@ export default class bybit extends Exchange {
185
185
  'https://github.com/bybit-exchange',
186
186
  ],
187
187
  'fees': 'https://help.bybit.com/hc/en-us/articles/360039261154',
188
- 'referral': 'https://www.bybit.com/register?affiliate_id=35953',
188
+ 'referral': 'https://www.bybit.com/invite?ref=XDK12WP',
189
189
  },
190
190
  'api': {
191
191
  'public': {
@@ -4108,7 +4108,7 @@ export default class bybit extends Exchange {
4108
4108
  if (triggerPrice !== undefined) {
4109
4109
  request['orderFilter'] = 'StopOrder';
4110
4110
  }
4111
- else if (stopLossTriggerPrice !== undefined || takeProfitTriggerPrice !== undefined || isStopLoss || isTakeProfit) {
4111
+ else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
4112
4112
  request['orderFilter'] = 'tpslOrder';
4113
4113
  }
4114
4114
  }
@@ -4131,7 +4131,8 @@ export default class bybit extends Exchange {
4131
4131
  params = this.omit(params, 'cost');
4132
4132
  // if the cost is inferable, let's keep the old logic and ignore marketUnit, to minimize the impact of the changes
4133
4133
  const isMarketBuyAndCostInferable = (lowerCaseType === 'market') && (side === 'buy') && ((price !== undefined) || (cost !== undefined));
4134
- if (market['spot'] && (type === 'market') && isUTA && !isMarketBuyAndCostInferable) {
4134
+ const isMarketOrder = lowerCaseType === 'market';
4135
+ if (market['spot'] && isMarketOrder && isUTA && !isMarketBuyAndCostInferable) {
4135
4136
  // UTA account can specify the cost of the order on both sides
4136
4137
  if ((cost !== undefined) || (price !== undefined)) {
4137
4138
  request['marketUnit'] = 'quoteCoin';
@@ -4150,7 +4151,7 @@ export default class bybit extends Exchange {
4150
4151
  request['qty'] = amountString;
4151
4152
  }
4152
4153
  }
4153
- else if (market['spot'] && (type === 'market') && (side === 'buy')) {
4154
+ else if (market['spot'] && isMarketOrder && (side === 'buy')) {
4154
4155
  // classic accounts
4155
4156
  // for market buy it requires the amount of quote currency to spend
4156
4157
  let createMarketBuyOrderRequiresPrice = true;
@@ -4226,6 +4227,16 @@ export default class bybit extends Exchange {
4226
4227
  request['slOrderType'] = 'Limit';
4227
4228
  request['slLimitPrice'] = this.getPrice(symbol, slLimitPrice);
4228
4229
  }
4230
+ else {
4231
+ // for spot market, we need to add this
4232
+ if (market['spot']) {
4233
+ request['slOrderType'] = 'Market';
4234
+ }
4235
+ }
4236
+ // for spot market, we need to add this
4237
+ if (market['spot'] && isMarketOrder) {
4238
+ throw new InvalidOrder(this.id + ' createOrder(): attached stopLoss is not supported for spot market orders');
4239
+ }
4229
4240
  }
4230
4241
  if (isTakeProfit) {
4231
4242
  const tpTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
@@ -4236,6 +4247,16 @@ export default class bybit extends Exchange {
4236
4247
  request['tpOrderType'] = 'Limit';
4237
4248
  request['tpLimitPrice'] = this.getPrice(symbol, tpLimitPrice);
4238
4249
  }
4250
+ else {
4251
+ // for spot market, we need to add this
4252
+ if (market['spot']) {
4253
+ request['tpOrderType'] = 'Market';
4254
+ }
4255
+ }
4256
+ // for spot market, we need to add this
4257
+ if (market['spot'] && isMarketOrder) {
4258
+ throw new InvalidOrder(this.id + ' createOrder(): attached takeProfit is not supported for spot market orders');
4259
+ }
4239
4260
  }
4240
4261
  }
4241
4262
  if (!market['spot'] && hedged) {
@@ -6630,7 +6651,7 @@ export default class bybit extends Exchange {
6630
6651
  }
6631
6652
  const notional = this.safeString2(position, 'positionValue', 'cumExitValue');
6632
6653
  const unrealisedPnl = this.omitZero(this.safeString(position, 'unrealisedPnl'));
6633
- let initialMarginString = this.safeStringN(position, ['positionIM', 'cumEntryValue']);
6654
+ let initialMarginString = this.safeString2(position, 'positionIM', 'cumEntryValue');
6634
6655
  let maintenanceMarginString = this.safeString(position, 'positionMM');
6635
6656
  const timestamp = this.safeIntegerN(position, ['createdTime', 'createdAt']);
6636
6657
  let lastUpdateTimestamp = this.parse8601(this.safeString(position, 'updated_at'));
@@ -6667,7 +6688,7 @@ export default class bybit extends Exchange {
6667
6688
  const maintenanceMarginPriceDifference = Precise.stringAbs(Precise.stringSub(liquidationPrice, bustPrice));
6668
6689
  maintenanceMarginString = Precise.stringMul(maintenanceMarginPriceDifference, size);
6669
6690
  // Initial Margin = Contracts x Entry Price / Leverage
6670
- if (entryPrice !== undefined) {
6691
+ if ((entryPrice !== undefined) && (initialMarginString === undefined)) {
6671
6692
  initialMarginString = Precise.stringDiv(Precise.stringMul(size, entryPrice), leverage);
6672
6693
  }
6673
6694
  }
@@ -6680,7 +6701,7 @@ export default class bybit extends Exchange {
6680
6701
  const multiply = Precise.stringMul(bustPrice, liquidationPrice);
6681
6702
  maintenanceMarginString = Precise.stringDiv(Precise.stringMul(size, difference), multiply);
6682
6703
  // Initial Margin = Leverage x Contracts / EntryPrice
6683
- if (entryPrice !== undefined) {
6704
+ if ((entryPrice !== undefined) && (initialMarginString === undefined)) {
6684
6705
  initialMarginString = Precise.stringDiv(size, Precise.stringMul(entryPrice, leverage));
6685
6706
  }
6686
6707
  }
@@ -279,7 +279,7 @@ export default class coinbase extends Exchange {
279
279
  * @param {object} [params] extra parameters specific to the exchange API endpoint
280
280
  * @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
281
281
  */
282
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<Order[]>;
282
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
283
283
  /**
284
284
  * @method
285
285
  * @name coinbase#editOrder
@@ -281,6 +281,7 @@ export default class coinbase extends Exchange {
281
281
  'brokerage/intx/positions/{portfolio_uuid}/{symbol}': 1,
282
282
  'brokerage/payment_methods': 1,
283
283
  'brokerage/payment_methods/{payment_method_id}': 1,
284
+ 'brokerage/key_permissions': 1,
284
285
  },
285
286
  'post': {
286
287
  'brokerage/orders': 1,
@@ -373,7 +373,8 @@ export default class coincatch extends Exchange {
373
373
  'StratisEVM': 'STRAT',
374
374
  'ChilizChain': 'ChilizChain',
375
375
  'StellarLumens': 'XLM',
376
- 'CronosChain': 'CRO', // todo check
376
+ 'CronosChain': 'CRO',
377
+ 'Optimism': 'Optimism',
377
378
  },
378
379
  },
379
380
  'features': {
@@ -207,7 +207,7 @@ export default class coinex extends Exchange {
207
207
  * @param {boolean} [params.trigger] set to true for canceling stop orders
208
208
  * @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
209
209
  */
210
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<any[]>;
210
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
211
211
  /**
212
212
  * @method
213
213
  * @name coinex#editOrder
@@ -200,7 +200,7 @@ export default class cryptocom extends Exchange {
200
200
  * @param {object} [params] extra parameters specific to the exchange API endpoint
201
201
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
202
202
  */
203
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<Order[]>;
203
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
204
204
  /**
205
205
  * @method
206
206
  * @name cryptocom#cancelOrdersForSymbols
package/js/src/deribit.js CHANGED
@@ -617,24 +617,26 @@ export default class deribit extends Exchange {
617
617
  const response = await this.publicGetGetCurrencies(params);
618
618
  //
619
619
  // {
620
- // "jsonrpc": "2.0",
621
- // "result": [
622
- // {
623
- // "withdrawal_priorities": [],
624
- // "withdrawal_fee": 0.01457324,
625
- // "min_withdrawal_fee": 0.000001,
626
- // "min_confirmations": 1,
627
- // "fee_precision": 8,
628
- // "currency_long": "Solana",
629
- // "currency": "SOL",
630
- // "coin_type": "SOL"
631
- // },
632
- // ...
633
- // ],
634
- // "usIn": 1688652701456124,
635
- // "usOut": 1688652701456390,
636
- // "usDiff": 266,
637
- // "testnet": true
620
+ // "jsonrpc": "2.0",
621
+ // "result": [
622
+ // {
623
+ // "currency": "XRP",
624
+ // "network_fee": "1.5e-5",
625
+ // "min_withdrawal_fee": "0.0001",
626
+ // "apr": "0.0",
627
+ // "withdrawal_fee": "0.0001",
628
+ // "network_currency": "XRP",
629
+ // "coin_type": "XRP",
630
+ // "withdrawal_priorities": [],
631
+ // "min_confirmations": "1",
632
+ // "currency_long": "XRP",
633
+ // "in_cross_collateral_pool": false
634
+ // },
635
+ // ],
636
+ // "usIn": "1760110326693923",
637
+ // "usOut": "1760110326944891",
638
+ // "usDiff": "250968",
639
+ // "testnet": false
638
640
  // }
639
641
  //
640
642
  const data = this.safeList(response, 'result', []);
@@ -653,7 +655,7 @@ export default class deribit extends Exchange {
653
655
  'withdraw': undefined,
654
656
  'type': 'crypto',
655
657
  'fee': this.safeNumber(currency, 'withdrawal_fee'),
656
- 'precision': this.parseNumber(this.parsePrecision(this.safeString(currency, 'fee_precision'))),
658
+ 'precision': undefined,
657
659
  'limits': {
658
660
  'amount': {
659
661
  'min': undefined,
@@ -188,7 +188,7 @@ export default class digifinex extends Exchange {
188
188
  * @param {object} [params] extra parameters specific to the exchange API endpoint
189
189
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
190
190
  */
191
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<any[]>;
191
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
192
192
  parseOrderStatus(status: Str): string;
193
193
  parseOrder(order: Dict, market?: Market): Order;
194
194
  /**
@@ -150,7 +150,7 @@ export default class hibachi extends Exchange {
150
150
  * @param {object} [params] extra parameters specific to the exchange API endpoint
151
151
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
152
152
  */
153
- cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<any[]>;
153
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
154
154
  /**
155
155
  * @method
156
156
  * @name hibachi#cancelAllOrders
package/js/src/htx.d.ts CHANGED
@@ -495,7 +495,7 @@ export default class htx extends Exchange {
495
495
  * @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
496
496
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
497
497
  */
498
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<any[]>;
498
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
499
499
  parseCancelOrders(orders: any): any[];
500
500
  /**
501
501
  * @method
@@ -245,7 +245,7 @@ export default class hyperliquid extends Exchange {
245
245
  * @param {string} [params.subAccountAddress] sub account user address
246
246
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
247
247
  */
248
- cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<any[]>;
248
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
249
249
  cancelOrdersRequest(ids: string[], symbol?: Str, params?: {}): Dict;
250
250
  /**
251
251
  * @method
@@ -298,7 +298,7 @@ export default class kraken extends Exchange {
298
298
  * @param {object} [params] extra parameters specific to the exchange API endpoint
299
299
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
300
300
  */
301
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<Order[]>;
301
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
302
302
  /**
303
303
  * @method
304
304
  * @name kraken#cancelAllOrders
package/js/src/kraken.js CHANGED
@@ -1729,6 +1729,10 @@ export default class kraken extends Exchange {
1729
1729
  const statuses = {
1730
1730
  'pending': 'open',
1731
1731
  'open': 'open',
1732
+ 'pending_new': 'open',
1733
+ 'new': 'open',
1734
+ 'partially_filled': 'open',
1735
+ 'filled': 'closed',
1732
1736
  'closed': 'closed',
1733
1737
  'canceled': 'canceled',
1734
1738
  'expired': 'expired',
@@ -1841,6 +1841,22 @@ export default class krakenfutures extends Exchange {
1841
1841
  // }
1842
1842
  // }
1843
1843
  //
1844
+ // {
1845
+ // uid: '85805e01-9eed-4395-8360-ed1a228237c9',
1846
+ // accountUid: '406142dd-7c5c-4a8b-acbc-5f16eca30009',
1847
+ // tradeable: 'PF_LTCUSD',
1848
+ // direction: 'Buy',
1849
+ // quantity: '0',
1850
+ // filled: '0.1',
1851
+ // timestamp: '1707258274849',
1852
+ // limitPrice: '69.2200000000',
1853
+ // orderType: 'IoC',
1854
+ // clientId: '',
1855
+ // reduceOnly: false,
1856
+ // lastUpdateTimestamp: '1707258274849',
1857
+ // status: 'closed'
1858
+ // }
1859
+ //
1844
1860
  const orderEvents = this.safeValue(order, 'orderEvents', []);
1845
1861
  const errorStatus = this.safeString(order, 'status');
1846
1862
  const orderEventsLength = orderEvents.length;
@@ -1962,20 +1978,25 @@ export default class krakenfutures extends Exchange {
1962
1978
  if (type === 'ioc' || this.parseOrderType(type) === 'market') {
1963
1979
  timeInForce = 'ioc';
1964
1980
  }
1981
+ let symbol = this.safeString(market, 'symbol');
1982
+ if ('tradeable' in details) {
1983
+ symbol = this.safeSymbol(this.safeString(details, 'tradeable'), market);
1984
+ }
1985
+ const ts = this.safeInteger(details, 'timestamp', timestamp);
1965
1986
  return this.safeOrder({
1966
1987
  'info': order,
1967
1988
  'id': id,
1968
1989
  'clientOrderId': this.safeStringN(details, ['clientOrderId', 'clientId', 'cliOrdId']),
1969
- 'timestamp': timestamp,
1970
- 'datetime': this.iso8601(timestamp),
1990
+ 'timestamp': ts,
1991
+ 'datetime': this.iso8601(ts),
1971
1992
  'lastTradeTimestamp': undefined,
1972
- 'lastUpdateTimestamp': lastUpdateTimestamp,
1973
- 'symbol': this.safeString(market, 'symbol'),
1993
+ 'lastUpdateTimestamp': this.safeInteger(details, 'lastUpdateTimestamp', lastUpdateTimestamp),
1994
+ 'symbol': symbol,
1974
1995
  'type': this.parseOrderType(type),
1975
1996
  'timeInForce': timeInForce,
1976
1997
  'postOnly': type === 'post',
1977
1998
  'reduceOnly': this.safeBool2(details, 'reduceOnly', 'reduce_only'),
1978
- 'side': this.safeString(details, 'side'),
1999
+ 'side': this.safeStringLower2(details, 'side', 'direction'),
1979
2000
  'price': price,
1980
2001
  'triggerPrice': this.safeString(details, 'triggerPrice'),
1981
2002
  'amount': amount,
package/js/src/kucoin.js CHANGED
@@ -1609,7 +1609,7 @@ export default class kucoin extends Exchange {
1609
1609
  const networkCodeNew = this.networkIdToCode(this.safeString(chain, 'chainId'), this.safeString(currency, 'code'));
1610
1610
  resultNew['networks'][networkCodeNew] = {
1611
1611
  'withdraw': {
1612
- 'fee': this.safeNumber(chain, 'withdrawMinFee'),
1612
+ 'fee': this.safeNumber2(chain, 'withdrawalMinFee', 'withdrawMinFee'),
1613
1613
  'percentage': false,
1614
1614
  },
1615
1615
  'deposit': {
@@ -234,7 +234,7 @@ export default class kucoinfutures extends kucoin {
234
234
  * @param {string[]} [params.clientOrderIds] client order ids
235
235
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
236
236
  */
237
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<Order[]>;
237
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
238
238
  /**
239
239
  * @method
240
240
  * @name kucoinfutures#cancelAllOrders
package/js/src/latoken.js CHANGED
@@ -1607,6 +1607,7 @@ export default class latoken extends Exchange {
1607
1607
  'TRANSACTION_STATUS_CHECKING': 'pending',
1608
1608
  'TRANSACTION_STATUS_CANCELLED': 'canceled',
1609
1609
  'TRANSACTION_STATUS_FAILED': 'failed',
1610
+ 'TRANSACTION_STATUS_REJECTED': 'rejected',
1610
1611
  };
1611
1612
  return this.safeString(statuses, status, status);
1612
1613
  }
package/js/src/mexc.d.ts CHANGED
@@ -354,7 +354,7 @@ export default class mexc extends Exchange {
354
354
  * @param {object} [params] extra parameters specific to the exchange API endpoint
355
355
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
356
356
  */
357
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<Order[]>;
357
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
358
358
  /**
359
359
  * @method
360
360
  * @name mexc#cancelAllOrders
package/js/src/mexc.js CHANGED
@@ -3591,6 +3591,7 @@ export default class mexc extends Exchange {
3591
3591
  'timestamp': timestamp,
3592
3592
  'datetime': this.iso8601(timestamp),
3593
3593
  'lastTradeTimestamp': undefined,
3594
+ 'lastUpdateTimestamp': this.safeInteger(order, 'updateTime'),
3594
3595
  'status': this.parseOrderStatus(this.safeString2(order, 'status', 'state')),
3595
3596
  'symbol': market['symbol'],
3596
3597
  'type': this.parseOrderType(typeRaw),
@@ -199,7 +199,7 @@ export default class oceanex extends Exchange {
199
199
  * @param {object} [params] extra parameters specific to the exchange API endpoint
200
200
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
201
201
  */
202
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<Order[]>;
202
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
203
203
  /**
204
204
  * @method
205
205
  * @name oceanex#cancelAllOrders
package/js/src/okx.d.ts CHANGED
@@ -314,7 +314,7 @@ export default class okx extends Exchange {
314
314
  * @param {boolean} [params.trailing] set to true if you want to cancel trailing orders
315
315
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
316
316
  */
317
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<Order[]>;
317
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
318
318
  /**
319
319
  * @method
320
320
  * @name okx#cancelOrdersForSymbols
package/js/src/okx.js CHANGED
@@ -185,7 +185,7 @@ export default class okx extends Exchange {
185
185
  'referral': {
186
186
  // old reflink 0% discount https://www.okx.com/join/1888677
187
187
  // new reflink 20% discount https://www.okx.com/join/CCXT2023
188
- 'url': 'https://www.okx.com/join/CCXT2023',
188
+ 'url': 'https://www.okx.com/join/CCXTCOM',
189
189
  'discount': 0.2,
190
190
  },
191
191
  'test': {
@@ -1303,7 +1303,8 @@ export default class okx extends Exchange {
1303
1303
  },
1304
1304
  'fetchOHLCV': {
1305
1305
  'limit': 300,
1306
- 'historical': 100,
1306
+ 'mark': 100,
1307
+ 'index': 100,
1307
1308
  },
1308
1309
  },
1309
1310
  'spot': {
@@ -1329,6 +1330,12 @@ export default class okx extends Exchange {
1329
1330
  },
1330
1331
  },
1331
1332
  },
1333
+ 'currencies': {
1334
+ 'USD': this.safeCurrencyStructure({ 'id': 'USD', 'code': 'USD', 'precision': this.parseNumber('0.0001') }),
1335
+ 'EUR': this.safeCurrencyStructure({ 'id': 'EUR', 'code': 'EUR', 'precision': this.parseNumber('0.0001') }),
1336
+ 'AED': this.safeCurrencyStructure({ 'id': 'AED', 'code': 'AED', 'precision': this.parseNumber('0.0001') }),
1337
+ 'GBP': this.safeCurrencyStructure({ 'id': 'GBP', 'code': 'GBP', 'precision': this.parseNumber('0.0001') }),
1338
+ },
1332
1339
  'commonCurrencies': {
1333
1340
  // the exchange refers to ERC20 version of Aeternity (AEToken)
1334
1341
  'AE': 'AET',
@@ -2471,16 +2478,18 @@ export default class okx extends Exchange {
2471
2478
  if (paginate) {
2472
2479
  return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 200);
2473
2480
  }
2474
- const price = this.safeString(params, 'price');
2481
+ const priceType = this.safeString(params, 'price');
2482
+ const isMarkOrIndex = this.inArray(priceType, ['mark', 'index']);
2475
2483
  params = this.omit(params, 'price');
2476
2484
  const options = this.safeDict(this.options, 'fetchOHLCV', {});
2477
2485
  const timezone = this.safeString(options, 'timezone', 'UTC');
2478
2486
  const limitIsUndefined = (limit === undefined);
2479
2487
  if (limit === undefined) {
2480
- limit = 100; // default 100, max 100
2488
+ limit = 100; // default 100, max 300
2481
2489
  }
2482
2490
  else {
2483
- limit = Math.min(limit, 300); // max 100
2491
+ const maxLimit = isMarkOrIndex ? 100 : 300; // default 300, only 100 if 'mark' or 'index'
2492
+ limit = Math.min(limit, maxLimit);
2484
2493
  }
2485
2494
  const duration = this.parseTimeframe(timeframe);
2486
2495
  let bar = this.safeString(this.timeframes, timeframe, timeframe);
@@ -2500,8 +2509,8 @@ export default class okx extends Exchange {
2500
2509
  const historyBorder = now - ((1440 - 1) * durationInMilliseconds);
2501
2510
  if (since < historyBorder) {
2502
2511
  defaultType = 'HistoryCandles';
2503
- const maxLimit = (price !== undefined) ? 100 : 300;
2504
- limit = Math.min(limit, maxLimit); // max 300 for historical endpoint
2512
+ const maxLimit = isMarkOrIndex ? 100 : 300;
2513
+ limit = Math.min(limit, maxLimit);
2505
2514
  }
2506
2515
  const startTime = Math.max(since - 1, 0);
2507
2516
  request['before'] = startTime;
@@ -2517,7 +2526,7 @@ export default class okx extends Exchange {
2517
2526
  params = this.omit(params, 'type');
2518
2527
  const isHistoryCandles = (type === 'HistoryCandles');
2519
2528
  let response = undefined;
2520
- if (price === 'mark') {
2529
+ if (priceType === 'mark') {
2521
2530
  if (isHistoryCandles) {
2522
2531
  response = await this.publicGetMarketHistoryMarkPriceCandles(this.extend(request, params));
2523
2532
  }
@@ -2525,7 +2534,7 @@ export default class okx extends Exchange {
2525
2534
  response = await this.publicGetMarketMarkPriceCandles(this.extend(request, params));
2526
2535
  }
2527
2536
  }
2528
- else if (price === 'index') {
2537
+ else if (priceType === 'index') {
2529
2538
  request['instId'] = market['info']['instFamily']; // okx index candles require instFamily instead of instId
2530
2539
  if (isHistoryCandles) {
2531
2540
  response = await this.publicGetMarketHistoryIndexCandles(this.extend(request, params));
@@ -158,7 +158,7 @@ export default class onetrading extends Exchange {
158
158
  * @param {object} [params] extra parameters specific to the exchange API endpoint
159
159
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
160
160
  */
161
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<any>;
161
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
162
162
  /**
163
163
  * @method
164
164
  * @name onetrading#fetchOrder
@@ -1489,7 +1489,8 @@ export default class onetrading extends Exchange {
1489
1489
  // "a10e9bd1-8f72-4cfe-9f1b-7f1c8a9bd8ee"
1490
1490
  // ]
1491
1491
  //
1492
- return response;
1492
+ const order = this.safeOrder({ 'info': response });
1493
+ return [order];
1493
1494
  }
1494
1495
  /**
1495
1496
  * @method
package/js/src/phemex.js CHANGED
@@ -193,6 +193,7 @@ export default class phemex extends Exchange {
193
193
  'accounts/accountPositions': 1,
194
194
  'g-accounts/accountPositions': 1,
195
195
  'g-accounts/positions': 25,
196
+ 'g-accounts/risk-unit': 1,
196
197
  'api-data/futures/funding-fees': 5,
197
198
  'api-data/g-futures/funding-fees': 5,
198
199
  'api-data/futures/orders': 5,