ccxt 4.3.5 → 4.3.6

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 (58) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/ccxt.js +1 -1
  3. package/dist/cjs/src/base/Exchange.js +3 -0
  4. package/dist/cjs/src/binance.js +2 -0
  5. package/dist/cjs/src/bingx.js +45 -0
  6. package/dist/cjs/src/bitmex.js +24 -0
  7. package/dist/cjs/src/bybit.js +86 -0
  8. package/dist/cjs/src/coinbase.js +5 -4
  9. package/dist/cjs/src/coinex.js +30 -32
  10. package/dist/cjs/src/cryptocom.js +32 -0
  11. package/dist/cjs/src/htx.js +28 -0
  12. package/dist/cjs/src/hyperliquid.js +40 -0
  13. package/dist/cjs/src/kraken.js +30 -0
  14. package/dist/cjs/src/krakenfutures.js +28 -0
  15. package/dist/cjs/src/kucoinfutures.js +2 -2
  16. package/dist/cjs/src/okx.js +113 -0
  17. package/dist/cjs/src/pro/bitget.js +1 -1
  18. package/dist/cjs/src/whitebit.js +42 -0
  19. package/dist/cjs/src/woo.js +29 -0
  20. package/js/ccxt.d.ts +1 -1
  21. package/js/ccxt.js +1 -1
  22. package/js/src/abstract/binance.d.ts +1 -0
  23. package/js/src/abstract/binancecoinm.d.ts +1 -0
  24. package/js/src/abstract/binanceus.d.ts +1 -0
  25. package/js/src/abstract/binanceusdm.d.ts +1 -0
  26. package/js/src/abstract/bingx.d.ts +1 -0
  27. package/js/src/abstract/woo.d.ts +1 -0
  28. package/js/src/base/Exchange.d.ts +1 -0
  29. package/js/src/base/Exchange.js +3 -0
  30. package/js/src/binance.js +2 -0
  31. package/js/src/bingx.d.ts +1 -0
  32. package/js/src/bingx.js +45 -0
  33. package/js/src/bitmex.d.ts +1 -0
  34. package/js/src/bitmex.js +24 -0
  35. package/js/src/bybit.d.ts +2 -1
  36. package/js/src/bybit.js +86 -0
  37. package/js/src/coinbase.js +5 -4
  38. package/js/src/coinex.js +30 -32
  39. package/js/src/cryptocom.d.ts +2 -1
  40. package/js/src/cryptocom.js +32 -0
  41. package/js/src/htx.d.ts +1 -0
  42. package/js/src/htx.js +28 -0
  43. package/js/src/hyperliquid.d.ts +1 -0
  44. package/js/src/hyperliquid.js +40 -0
  45. package/js/src/kraken.d.ts +1 -0
  46. package/js/src/kraken.js +30 -0
  47. package/js/src/krakenfutures.d.ts +1 -0
  48. package/js/src/krakenfutures.js +28 -0
  49. package/js/src/kucoinfutures.js +2 -2
  50. package/js/src/okx.d.ts +3 -1
  51. package/js/src/okx.js +113 -0
  52. package/js/src/pro/bitget.d.ts +1 -1
  53. package/js/src/pro/bitget.js +1 -1
  54. package/js/src/whitebit.d.ts +1 -0
  55. package/js/src/whitebit.js +42 -0
  56. package/js/src/woo.d.ts +2 -1
  57. package/js/src/woo.js +29 -0
  58. package/package.json +1 -1
package/README.md CHANGED
@@ -213,13 +213,13 @@ console.log(version, Object.keys(exchanges));
213
213
 
214
214
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
215
215
 
216
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.5/dist/ccxt.browser.js
217
- * unpkg: https://unpkg.com/ccxt@4.3.5/dist/ccxt.browser.js
216
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.6/dist/ccxt.browser.js
217
+ * unpkg: https://unpkg.com/ccxt@4.3.6/dist/ccxt.browser.js
218
218
 
219
219
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
220
220
 
221
221
  ```HTML
222
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.5/dist/ccxt.browser.js"></script>
222
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.6/dist/ccxt.browser.js"></script>
223
223
  ```
224
224
 
225
225
  Creates a global `ccxt` object:
package/dist/cjs/ccxt.js CHANGED
@@ -182,7 +182,7 @@ var woo$1 = require('./src/pro/woo.js');
182
182
 
183
183
  //-----------------------------------------------------------------------------
184
184
  // this is updated by vss.js when building
185
- const version = '4.3.5';
185
+ const version = '4.3.6';
186
186
  Exchange["default"].ccxtVersion = version;
187
187
  const exchanges = {
188
188
  'ace': ace,
@@ -4711,6 +4711,9 @@ class Exchange {
4711
4711
  async cancelAllOrders(symbol = undefined, params = {}) {
4712
4712
  throw new errors.NotSupported(this.id + ' cancelAllOrders() is not supported yet');
4713
4713
  }
4714
+ async cancelAllOrdersAfter(timeout, params = {}) {
4715
+ throw new errors.NotSupported(this.id + ' cancelAllOrdersAfter() is not supported yet');
4716
+ }
4714
4717
  async cancelOrdersForSymbols(orders, params = {}) {
4715
4718
  throw new errors.NotSupported(this.id + ' cancelOrdersForSymbols() is not supported yet');
4716
4719
  }
@@ -321,6 +321,7 @@ class binance extends binance$1 {
321
321
  'capital/deposit/subAddress': 0.1,
322
322
  'capital/deposit/subHisrec': 0.1,
323
323
  'capital/withdraw/history': 1800,
324
+ 'capital/withdraw/address/list': 10,
324
325
  'capital/contract/convertible-coins': 4.0002,
325
326
  'convert/tradeFlow': 20.001,
326
327
  'convert/exchangeInfo': 50,
@@ -4107,6 +4108,7 @@ class binance extends binance$1 {
4107
4108
  * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
4108
4109
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4109
4110
  * @param {string} [params.subType] "linear" or "inverse"
4111
+ * @param {string} [params.type] 'spot', 'option', use params["subType"] for swap and future markets
4110
4112
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
4111
4113
  */
4112
4114
  await this.loadMarkets();
@@ -32,6 +32,7 @@ class bingx extends bingx$1 {
32
32
  'option': false,
33
33
  'addMargin': true,
34
34
  'cancelAllOrders': true,
35
+ 'cancelAllOrdersAfter': true,
35
36
  'cancelOrder': true,
36
37
  'cancelOrders': true,
37
38
  'closeAllPositions': true,
@@ -228,6 +229,7 @@ class bingx extends bingx$1 {
228
229
  'trade/order': 3,
229
230
  'trade/batchOrders': 3,
230
231
  'trade/closeAllPositions': 3,
232
+ 'trade/cancelAllAfter': 3,
231
233
  'trade/marginType': 3,
232
234
  'trade/leverage': 3,
233
235
  'trade/positionMargin': 3,
@@ -2749,6 +2751,49 @@ class bingx extends bingx$1 {
2749
2751
  //
2750
2752
  return response;
2751
2753
  }
2754
+ async cancelAllOrdersAfter(timeout, params = {}) {
2755
+ /**
2756
+ * @method
2757
+ * @name bingx#cancelAllOrdersAfter
2758
+ * @description dead man's switch, cancel all orders after the given timeout
2759
+ * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20all%20orders%20in%20countdown
2760
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Cancel%20all%20orders%20in%20countdown
2761
+ * @param {number} timeout time in milliseconds, 0 represents cancel the timer
2762
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2763
+ * @param {string} [params.type] spot or swap market
2764
+ * @returns {object} the api result
2765
+ */
2766
+ await this.loadMarkets();
2767
+ const isActive = (timeout > 0);
2768
+ const request = {
2769
+ 'type': (isActive) ? 'ACTIVATE' : 'CLOSE',
2770
+ 'timeOut': (isActive) ? (this.parseToInt(timeout / 1000)) : 0,
2771
+ };
2772
+ let response = undefined;
2773
+ let type = undefined;
2774
+ [type, params] = this.handleMarketTypeAndParams('cancelAllOrdersAfter', undefined, params);
2775
+ if (type === 'spot') {
2776
+ response = await this.spotV1PrivatePostTradeCancelAllAfter(this.extend(request, params));
2777
+ }
2778
+ else if (type === 'swap') {
2779
+ response = await this.swapV2PrivatePostTradeCancelAllAfter(this.extend(request, params));
2780
+ }
2781
+ else {
2782
+ throw new errors.NotSupported(this.id + ' cancelAllOrdersAfter() is not supported for ' + type + ' markets');
2783
+ }
2784
+ //
2785
+ // {
2786
+ // code: '0',
2787
+ // msg: '',
2788
+ // data: {
2789
+ // triggerTime: '1712645434',
2790
+ // status: 'ACTIVATED',
2791
+ // note: 'All your perpetual pending orders will be closed automatically at 2024-04-09 06:50:34 UTC(+0),before that you can cancel the timer, or extend triggerTime time by this request'
2792
+ // }
2793
+ // }
2794
+ //
2795
+ return response;
2796
+ }
2752
2797
  async fetchOrder(id, symbol = undefined, params = {}) {
2753
2798
  /**
2754
2799
  * @method
@@ -36,6 +36,7 @@ class bitmex extends bitmex$1 {
36
36
  'option': false,
37
37
  'addMargin': undefined,
38
38
  'cancelAllOrders': true,
39
+ 'cancelAllOrdersAfter': true,
39
40
  'cancelOrder': true,
40
41
  'cancelOrders': true,
41
42
  'closeAllPositions': false,
@@ -2116,6 +2117,29 @@ class bitmex extends bitmex$1 {
2116
2117
  //
2117
2118
  return this.parseOrders(response, market);
2118
2119
  }
2120
+ async cancelAllOrdersAfter(timeout, params = {}) {
2121
+ /**
2122
+ * @method
2123
+ * @name bitmex#cancelAllOrdersAfter
2124
+ * @description dead man's switch, cancel all orders after the given timeout
2125
+ * @see https://www.bitmex.com/api/explorer/#!/Order/Order_cancelAllAfter
2126
+ * @param {number} timeout time in milliseconds, 0 represents cancel the timer
2127
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2128
+ * @returns {object} the api result
2129
+ */
2130
+ await this.loadMarkets();
2131
+ const request = {
2132
+ 'timeout': (timeout > 0) ? this.parseToInt(timeout / 1000) : 0,
2133
+ };
2134
+ const response = await this.privatePostOrderCancelAllAfter(this.extend(request, params));
2135
+ //
2136
+ // {
2137
+ // now: '2024-04-09T09:01:56.560Z',
2138
+ // cancelTime: '2024-04-09T09:01:56.660Z'
2139
+ // }
2140
+ //
2141
+ return response;
2142
+ }
2119
2143
  async fetchLeverages(symbols = undefined, params = {}) {
2120
2144
  /**
2121
2145
  * @method
@@ -35,6 +35,8 @@ class bybit extends bybit$1 {
35
35
  'borrowCrossMargin': true,
36
36
  'cancelAllOrders': true,
37
37
  'cancelOrder': true,
38
+ 'cancelOrders': true,
39
+ 'cancelOrdersForSymbols': true,
38
40
  'closeAllPositions': false,
39
41
  'closePosition': false,
40
42
  'createMarketBuyOrderWithCost': true,
@@ -4382,6 +4384,90 @@ class bybit extends bybit$1 {
4382
4384
  const row = this.safeList(result, 'list', []);
4383
4385
  return this.parseOrders(row, market);
4384
4386
  }
4387
+ async cancelOrdersForSymbols(orders, params = {}) {
4388
+ /**
4389
+ * @method
4390
+ * @name bybit#cancelOrdersForSymbols
4391
+ * @description cancel multiple orders for multiple symbols
4392
+ * @see https://bybit-exchange.github.io/docs/v5/order/batch-cancel
4393
+ * @param {string[]} ids order ids
4394
+ * @param {string} symbol unified symbol of the market the order was made in
4395
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4396
+ * @param {string[]} [params.clientOrderIds] client order ids
4397
+ * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
4398
+ */
4399
+ await this.loadMarkets();
4400
+ const ordersRequests = [];
4401
+ let category = undefined;
4402
+ for (let i = 0; i < orders.length; i++) {
4403
+ const order = orders[i];
4404
+ const symbol = this.safeString(order, 'symbol');
4405
+ const market = this.market(symbol);
4406
+ let currentCategory = undefined;
4407
+ [currentCategory, params] = this.getBybitType('cancelOrders', market, params);
4408
+ if (currentCategory === 'inverse') {
4409
+ throw new errors.NotSupported(this.id + ' cancelOrdersForSymbols does not allow inverse orders');
4410
+ }
4411
+ if ((category !== undefined) && (category !== currentCategory)) {
4412
+ throw new errors.ExchangeError(this.id + ' cancelOrdersForSymbols requires all orders to be of the same category (linear, spot or option))');
4413
+ }
4414
+ category = currentCategory;
4415
+ const id = this.safeString(order, 'id');
4416
+ const clientOrderId = this.safeString(order, 'clientOrderId');
4417
+ let idKey = 'orderId';
4418
+ if (clientOrderId !== undefined) {
4419
+ idKey = 'orderLinkId';
4420
+ }
4421
+ const orderItem = {
4422
+ 'symbol': market['id'],
4423
+ };
4424
+ orderItem[idKey] = (idKey === 'orderId') ? id : clientOrderId;
4425
+ ordersRequests.push(orderItem);
4426
+ }
4427
+ const request = {
4428
+ 'category': category,
4429
+ 'request': ordersRequests,
4430
+ };
4431
+ const response = await this.privatePostV5OrderCancelBatch(this.extend(request, params));
4432
+ //
4433
+ // {
4434
+ // "retCode": "0",
4435
+ // "retMsg": "OK",
4436
+ // "result": {
4437
+ // "list": [
4438
+ // {
4439
+ // "category": "spot",
4440
+ // "symbol": "BTCUSDT",
4441
+ // "orderId": "1636282505818800896",
4442
+ // "orderLinkId": "1636282505818800897"
4443
+ // },
4444
+ // {
4445
+ // "category": "spot",
4446
+ // "symbol": "BTCUSDT",
4447
+ // "orderId": "1636282505818800898",
4448
+ // "orderLinkId": "1636282505818800899"
4449
+ // }
4450
+ // ]
4451
+ // },
4452
+ // "retExtInfo": {
4453
+ // "list": [
4454
+ // {
4455
+ // "code": "0",
4456
+ // "msg": "OK"
4457
+ // },
4458
+ // {
4459
+ // "code": "0",
4460
+ // "msg": "OK"
4461
+ // }
4462
+ // ]
4463
+ // },
4464
+ // "time": "1709796158501"
4465
+ // }
4466
+ //
4467
+ const result = this.safeDict(response, 'result', {});
4468
+ const row = this.safeList(result, 'list', []);
4469
+ return this.parseOrders(row, undefined);
4470
+ }
4385
4471
  async cancelAllUsdcOrders(symbol = undefined, params = {}) {
4386
4472
  if (symbol === undefined) {
4387
4473
  throw new errors.ArgumentsRequired(this.id + ' cancelAllUsdcOrders() requires a symbol argument');
@@ -3428,12 +3428,13 @@ class coinbase extends coinbase$1 {
3428
3428
  sinceString = Precise["default"].stringSub(now, requestedDuration.toString());
3429
3429
  }
3430
3430
  request['start'] = sinceString;
3431
- let endString = this.numberToString(until);
3432
- if (until === undefined) {
3431
+ if (until !== undefined) {
3432
+ request['end'] = this.numberToString(this.parseToInt(until / 1000));
3433
+ }
3434
+ else {
3433
3435
  // 300 candles max
3434
- endString = Precise["default"].stringAdd(sinceString, requestedDuration.toString());
3436
+ request['end'] = Precise["default"].stringAdd(sinceString, requestedDuration.toString());
3435
3437
  }
3436
- request['end'] = endString;
3437
3438
  const response = await this.v3PrivateGetBrokerageProductsProductIdCandles(this.extend(request, params));
3438
3439
  //
3439
3440
  // {
@@ -1129,14 +1129,13 @@ class coinex extends coinex$1 {
1129
1129
  //
1130
1130
  // Spot and Swap fetchTrades (public)
1131
1131
  //
1132
- // {
1133
- // "id": 2611511379,
1134
- // "type": "buy",
1135
- // "price": "192.63",
1136
- // "amount": "0.02266931",
1137
- // "date": 1638990110,
1138
- // "date_ms": 1638990110518
1139
- // },
1132
+ // {
1133
+ // "amount": "0.00049432",
1134
+ // "created_at": 1713849825667,
1135
+ // "deal_id": 4137517302,
1136
+ // "price": "66251",
1137
+ // "side": "buy"
1138
+ // }
1140
1139
  //
1141
1140
  // Spot and Margin fetchMyTrades (private)
1142
1141
  //
@@ -1190,9 +1189,9 @@ class coinex extends coinex$1 {
1190
1189
  //
1191
1190
  let timestamp = this.safeTimestamp2(trade, 'create_time', 'time');
1192
1191
  if (timestamp === undefined) {
1193
- timestamp = this.safeInteger(trade, 'date_ms');
1192
+ timestamp = this.safeInteger(trade, 'created_at');
1194
1193
  }
1195
- const tradeId = this.safeString(trade, 'id');
1194
+ const tradeId = this.safeString2(trade, 'id', 'deal_id');
1196
1195
  const orderId = this.safeString(trade, 'order_id');
1197
1196
  const priceString = this.safeString(trade, 'price');
1198
1197
  const amountString = this.safeString(trade, 'amount');
@@ -1229,11 +1228,11 @@ class coinex extends coinex$1 {
1229
1228
  side = 'buy';
1230
1229
  }
1231
1230
  if (side === undefined) {
1232
- side = this.safeString(trade, 'type');
1231
+ side = this.safeString2(trade, 'type', 'side');
1233
1232
  }
1234
1233
  }
1235
1234
  else {
1236
- side = this.safeString(trade, 'type');
1235
+ side = this.safeString2(trade, 'type', 'side');
1237
1236
  }
1238
1237
  return this.safeTrade({
1239
1238
  'info': trade,
@@ -1255,9 +1254,9 @@ class coinex extends coinex$1 {
1255
1254
  /**
1256
1255
  * @method
1257
1256
  * @name coinex#fetchTrades
1258
- * @description get the list of most recent trades for a particular symbol
1259
- * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market005_market_deals
1260
- * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http011_market_deals
1257
+ * @description get the list of the most recent trades for a particular symbol
1258
+ * @see https://docs.coinex.com/api/v2/spot/market/http/list-market-deals
1259
+ * @see https://docs.coinex.com/api/v2/futures/market/http/list-market-deals
1261
1260
  * @param {string} symbol unified symbol of the market to fetch trades for
1262
1261
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
1263
1262
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -1275,28 +1274,27 @@ class coinex extends coinex$1 {
1275
1274
  }
1276
1275
  let response = undefined;
1277
1276
  if (market['swap']) {
1278
- response = await this.v1PerpetualPublicGetMarketDeals(this.extend(request, params));
1277
+ response = await this.v2PublicGetFuturesDeals(this.extend(request, params));
1279
1278
  }
1280
1279
  else {
1281
- response = await this.v1PublicGetMarketDeals(this.extend(request, params));
1280
+ response = await this.v2PublicGetSpotDeals(this.extend(request, params));
1282
1281
  }
1283
1282
  //
1284
1283
  // Spot and Swap
1285
1284
  //
1286
- // {
1287
- // "code": 0,
1288
- // "data": [
1289
- // {
1290
- // "id": 2611511379,
1291
- // "type": "buy",
1292
- // "price": "192.63",
1293
- // "amount": "0.02266931",
1294
- // "date": 1638990110,
1295
- // "date_ms": 1638990110518
1296
- // },
1297
- // ],
1298
- // "message": "OK"
1299
- // }
1285
+ // {
1286
+ // "code": 0,
1287
+ // "data": [
1288
+ // {
1289
+ // "amount": "0.00049432",
1290
+ // "created_at": 1713849825667,
1291
+ // "deal_id": 4137517302,
1292
+ // "price": "66251",
1293
+ // "side": "buy"
1294
+ // },
1295
+ // ],
1296
+ // "message": "OK"
1297
+ // }
1300
1298
  //
1301
1299
  return this.parseTrades(response['data'], market, since, limit);
1302
1300
  }
@@ -4484,7 +4482,7 @@ class coinex extends coinex$1 {
4484
4482
  }
4485
4483
  async fetchFundingRates(symbols = undefined, params = {}) {
4486
4484
  /**
4487
- * @method
4485
+ * @method
4488
4486
  * @name coinex#fetchFundingRates
4489
4487
  * @description fetch the current funding rates
4490
4488
  * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http009_market_ticker_all
@@ -32,6 +32,7 @@ class cryptocom extends cryptocom$1 {
32
32
  'cancelAllOrders': true,
33
33
  'cancelOrder': true,
34
34
  'cancelOrders': true,
35
+ 'cancelOrdersForSymbols': true,
35
36
  'closeAllPositions': false,
36
37
  'closePosition': true,
37
38
  'createMarketBuyOrderWithCost': false,
@@ -1464,6 +1465,37 @@ class cryptocom extends cryptocom$1 {
1464
1465
  const result = this.safeList(response, 'result', []);
1465
1466
  return this.parseOrders(result, market, undefined, undefined, params);
1466
1467
  }
1468
+ async cancelOrdersForSymbols(orders, params = {}) {
1469
+ /**
1470
+ * @method
1471
+ * @name cryptocom#cancelOrdersForSymbols
1472
+ * @description cancel multiple orders for multiple symbols
1473
+ * @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order-list-list
1474
+ * @param {CancellationRequest[]} orders each order should contain the parameters required by cancelOrder namely id and symbol
1475
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1476
+ * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1477
+ */
1478
+ await this.loadMarkets();
1479
+ const orderRequests = [];
1480
+ for (let i = 0; i < orders.length; i++) {
1481
+ const order = orders[i];
1482
+ const id = this.safeString(order, 'id');
1483
+ const symbol = this.safeString(order, 'symbol');
1484
+ const market = this.market(symbol);
1485
+ const orderItem = {
1486
+ 'instrument_name': market['id'],
1487
+ 'order_id': id.toString(),
1488
+ };
1489
+ orderRequests.push(orderItem);
1490
+ }
1491
+ const request = {
1492
+ 'contingency_type': 'LIST',
1493
+ 'order_list': orderRequests,
1494
+ };
1495
+ const response = await this.v1PrivatePostPrivateCancelOrderList(this.extend(request, params));
1496
+ const result = this.safeList(response, 'result', []);
1497
+ return this.parseOrders(result, undefined, undefined, undefined, params);
1498
+ }
1467
1499
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1468
1500
  /**
1469
1501
  * @method
@@ -35,6 +35,7 @@ class htx extends htx$1 {
35
35
  'borrowCrossMargin': true,
36
36
  'borrowIsolatedMargin': true,
37
37
  'cancelAllOrders': true,
38
+ 'cancelAllOrdersAfter': true,
38
39
  'cancelOrder': true,
39
40
  'cancelOrders': true,
40
41
  'createDepositAddress': undefined,
@@ -6163,6 +6164,33 @@ class htx extends htx$1 {
6163
6164
  //
6164
6165
  return response;
6165
6166
  }
6167
+ async cancelAllOrdersAfter(timeout, params = {}) {
6168
+ /**
6169
+ * @method
6170
+ * @name huobi#cancelAllOrdersAfter
6171
+ * @description dead man's switch, cancel all orders after the given timeout
6172
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#dead-man-s-switch
6173
+ * @param {number} timeout time in milliseconds, 0 represents cancel the timer
6174
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
6175
+ * @returns {object} the api result
6176
+ */
6177
+ await this.loadMarkets();
6178
+ const request = {
6179
+ 'timeout': (timeout > 0) ? this.parseToInt(timeout / 1000) : 0,
6180
+ };
6181
+ const response = await this.v2PrivatePostAlgoOrdersCancelAllAfter(this.extend(request, params));
6182
+ //
6183
+ // {
6184
+ // "code": 200,
6185
+ // "message": "success",
6186
+ // "data": {
6187
+ // "currentTime": 1630491627230,
6188
+ // "triggerTime": 1630491637230
6189
+ // }
6190
+ // }
6191
+ //
6192
+ return response;
6193
+ }
6166
6194
  parseDepositAddress(depositAddress, currency = undefined) {
6167
6195
  //
6168
6196
  // {
@@ -35,6 +35,7 @@ class hyperliquid extends hyperliquid$1 {
35
35
  'borrowCrossMargin': false,
36
36
  'borrowIsolatedMargin': false,
37
37
  'cancelAllOrders': false,
38
+ 'cancelAllOrdersAfter': true,
38
39
  'cancelOrder': true,
39
40
  'cancelOrders': true,
40
41
  'cancelOrdersForSymbols': true,
@@ -1361,6 +1362,45 @@ class hyperliquid extends hyperliquid$1 {
1361
1362
  //
1362
1363
  return response;
1363
1364
  }
1365
+ async cancelAllOrdersAfter(timeout, params = {}) {
1366
+ /**
1367
+ * @method
1368
+ * @name hyperliquid#cancelAllOrdersAfter
1369
+ * @description dead man's switch, cancel all orders after the given timeout
1370
+ * @param {number} timeout time in milliseconds, 0 represents cancel the timer
1371
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1372
+ * @param {string} [params.vaultAddress] the vault address
1373
+ * @returns {object} the api result
1374
+ */
1375
+ this.checkRequiredCredentials();
1376
+ await this.loadMarkets();
1377
+ params = this.omit(params, ['clientOrderId', 'client_id']);
1378
+ const nonce = this.milliseconds();
1379
+ const request = {
1380
+ 'nonce': nonce,
1381
+ // 'vaultAddress': vaultAddress,
1382
+ };
1383
+ const cancelAction = {
1384
+ 'type': 'scheduleCancel',
1385
+ 'time': nonce + timeout,
1386
+ };
1387
+ const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
1388
+ const signature = this.signL1Action(cancelAction, nonce, vaultAddress);
1389
+ request['action'] = cancelAction;
1390
+ request['signature'] = signature;
1391
+ if (vaultAddress !== undefined) {
1392
+ params = this.omit(params, 'vaultAddress');
1393
+ request['vaultAddress'] = vaultAddress;
1394
+ }
1395
+ const response = await this.privatePostExchange(this.extend(request, params));
1396
+ //
1397
+ // {
1398
+ // "status":"err",
1399
+ // "response":"Cannot set scheduled cancel time until enough volume traded. Required: $1000000. Traded: $373.47205."
1400
+ // }
1401
+ //
1402
+ return response;
1403
+ }
1364
1404
  async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
1365
1405
  /**
1366
1406
  * @method
@@ -36,6 +36,7 @@ class kraken extends kraken$1 {
36
36
  'option': false,
37
37
  'addMargin': false,
38
38
  'cancelAllOrders': true,
39
+ 'cancelAllOrdersAfter': true,
39
40
  'cancelOrder': true,
40
41
  'cancelOrders': true,
41
42
  'createDepositAddress': true,
@@ -2136,6 +2137,35 @@ class kraken extends kraken$1 {
2136
2137
  await this.loadMarkets();
2137
2138
  return await this.privatePostCancelAll(params);
2138
2139
  }
2140
+ async cancelAllOrdersAfter(timeout, params = {}) {
2141
+ /**
2142
+ * @method
2143
+ * @name kraken#cancelAllOrdersAfter
2144
+ * @description dead man's switch, cancel all orders after the given timeout
2145
+ * @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelAllOrdersAfter
2146
+ * @param {number} timeout time in milliseconds, 0 represents cancel the timer
2147
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2148
+ * @returns {object} the api result
2149
+ */
2150
+ if (timeout > 86400000) {
2151
+ throw new errors.BadRequest(this.id + 'cancelAllOrdersAfter timeout should be less than 86400000 milliseconds');
2152
+ }
2153
+ await this.loadMarkets();
2154
+ const request = {
2155
+ 'timeout': (timeout > 0) ? (this.parseToInt(timeout / 1000)) : 0,
2156
+ };
2157
+ const response = await this.privatePostCancelAllOrdersAfter(this.extend(request, params));
2158
+ //
2159
+ // {
2160
+ // "error": [ ],
2161
+ // "result": {
2162
+ // "currentTime": "2023-03-24T17:41:56Z",
2163
+ // "triggerTime": "2023-03-24T17:42:56Z"
2164
+ // }
2165
+ // }
2166
+ //
2167
+ return response;
2168
+ }
2139
2169
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
2140
2170
  /**
2141
2171
  * @method
@@ -31,6 +31,7 @@ class krakenfutures extends krakenfutures$1 {
31
31
  'future': true,
32
32
  'option': false,
33
33
  'cancelAllOrders': true,
34
+ 'cancelAllOrdersAfter': true,
34
35
  'cancelOrder': true,
35
36
  'cancelOrders': true,
36
37
  'createMarketOrder': false,
@@ -1269,6 +1270,33 @@ class krakenfutures extends krakenfutures$1 {
1269
1270
  const response = await this.privatePostCancelallorders(this.extend(request, params));
1270
1271
  return response;
1271
1272
  }
1273
+ async cancelAllOrdersAfter(timeout, params = {}) {
1274
+ /**
1275
+ * @method
1276
+ * @name krakenfutures#cancelAllOrdersAfter
1277
+ * @description dead man's switch, cancel all orders after the given timeout
1278
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-dead-man-39-s-switch
1279
+ * @param {number} timeout time in milliseconds, 0 represents cancel the timer
1280
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1281
+ * @returns {object} the api result
1282
+ */
1283
+ await this.loadMarkets();
1284
+ const request = {
1285
+ 'timeout': (timeout > 0) ? (this.parseToInt(timeout / 1000)) : 0,
1286
+ };
1287
+ const response = await this.privatePostCancelallordersafter(this.extend(request, params));
1288
+ //
1289
+ // {
1290
+ // "result": "success",
1291
+ // "serverTime": "2018-06-19T16:51:23.839Z",
1292
+ // "status": {
1293
+ // "currentTime": "2018-06-19T16:51:23.839Z",
1294
+ // "triggerTime": "0"
1295
+ // }
1296
+ // }
1297
+ //
1298
+ return response;
1299
+ }
1272
1300
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1273
1301
  /**
1274
1302
  * @method
@@ -2195,8 +2195,8 @@ class kucoinfutures extends kucoinfutures$1 {
2195
2195
  // symbol (String) [optional] Symbol of the contract
2196
2196
  // side (String) [optional] buy or sell
2197
2197
  // type (String) [optional] limit, market, limit_stop or market_stop
2198
- // startAt (long) [optional] Start time (milisecond)
2199
- // endAt (long) [optional] End time (milisecond)
2198
+ // startAt (long) [optional] Start time (millisecond)
2199
+ // endAt (long) [optional] End time (millisecond)
2200
2200
  };
2201
2201
  let market = undefined;
2202
2202
  if (symbol !== undefined) {