ccxt 4.3.5__py2.py3-none-any.whl → 4.3.6__py2.py3-none-any.whl

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 (48) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/binance.py +1 -0
  3. ccxt/abstract/binancecoinm.py +1 -0
  4. ccxt/abstract/binanceus.py +1 -0
  5. ccxt/abstract/binanceusdm.py +1 -0
  6. ccxt/abstract/bingx.py +1 -0
  7. ccxt/abstract/woo.py +1 -0
  8. ccxt/async_support/__init__.py +1 -1
  9. ccxt/async_support/base/exchange.py +4 -1
  10. ccxt/async_support/binance.py +2 -0
  11. ccxt/async_support/bingx.py +40 -0
  12. ccxt/async_support/bitmex.py +22 -0
  13. ccxt/async_support/bybit.py +81 -1
  14. ccxt/async_support/coinbase.py +4 -4
  15. ccxt/async_support/coinex.py +29 -32
  16. ccxt/async_support/cryptocom.py +30 -1
  17. ccxt/async_support/htx.py +26 -0
  18. ccxt/async_support/hyperliquid.py +37 -0
  19. ccxt/async_support/kraken.py +27 -0
  20. ccxt/async_support/krakenfutures.py +26 -0
  21. ccxt/async_support/kucoinfutures.py +2 -2
  22. ccxt/async_support/okx.py +104 -1
  23. ccxt/async_support/whitebit.py +37 -0
  24. ccxt/async_support/woo.py +27 -0
  25. ccxt/base/exchange.py +4 -1
  26. ccxt/binance.py +2 -0
  27. ccxt/bingx.py +40 -0
  28. ccxt/bitmex.py +22 -0
  29. ccxt/bybit.py +81 -1
  30. ccxt/coinbase.py +4 -4
  31. ccxt/coinex.py +29 -32
  32. ccxt/cryptocom.py +30 -1
  33. ccxt/htx.py +26 -0
  34. ccxt/hyperliquid.py +37 -0
  35. ccxt/kraken.py +27 -0
  36. ccxt/krakenfutures.py +26 -0
  37. ccxt/kucoinfutures.py +2 -2
  38. ccxt/okx.py +104 -1
  39. ccxt/pro/__init__.py +1 -1
  40. ccxt/pro/bitget.py +1 -1
  41. ccxt/test/test_async.py +2 -0
  42. ccxt/test/test_sync.py +2 -0
  43. ccxt/whitebit.py +37 -0
  44. ccxt/woo.py +27 -0
  45. {ccxt-4.3.5.dist-info → ccxt-4.3.6.dist-info}/METADATA +4 -4
  46. {ccxt-4.3.5.dist-info → ccxt-4.3.6.dist-info}/RECORD +48 -48
  47. {ccxt-4.3.5.dist-info → ccxt-4.3.6.dist-info}/WHEEL +0 -0
  48. {ccxt-4.3.5.dist-info → ccxt-4.3.6.dist-info}/top_level.txt +0 -0
ccxt/cryptocom.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.cryptocom import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Currency, Int, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
9
+ from ccxt.base.types import Account, Balances, Currency, Int, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -47,6 +47,7 @@ class cryptocom(Exchange, ImplicitAPI):
47
47
  'cancelAllOrders': True,
48
48
  'cancelOrder': True,
49
49
  'cancelOrders': True,
50
+ 'cancelOrdersForSymbols': True,
50
51
  'closeAllPositions': False,
51
52
  'closePosition': True,
52
53
  'createMarketBuyOrderWithCost': False,
@@ -1353,6 +1354,34 @@ class cryptocom(Exchange, ImplicitAPI):
1353
1354
  result = self.safe_list(response, 'result', [])
1354
1355
  return self.parse_orders(result, market, None, None, params)
1355
1356
 
1357
+ def cancel_orders_for_symbols(self, orders: List[CancellationRequest], params={}):
1358
+ """
1359
+ cancel multiple orders for multiple symbols
1360
+ :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order-list-list
1361
+ :param CancellationRequest[] orders: each order should contain the parameters required by cancelOrder namely id and symbol
1362
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1363
+ :returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1364
+ """
1365
+ self.load_markets()
1366
+ orderRequests = []
1367
+ for i in range(0, len(orders)):
1368
+ order = orders[i]
1369
+ id = self.safe_string(order, 'id')
1370
+ symbol = self.safe_string(order, 'symbol')
1371
+ market = self.market(symbol)
1372
+ orderItem = {
1373
+ 'instrument_name': market['id'],
1374
+ 'order_id': str(id),
1375
+ }
1376
+ orderRequests.append(orderItem)
1377
+ request = {
1378
+ 'contingency_type': 'LIST',
1379
+ 'order_list': orderRequests,
1380
+ }
1381
+ response = self.v1PrivatePostPrivateCancelOrderList(self.extend(request, params))
1382
+ result = self.safe_list(response, 'result', [])
1383
+ return self.parse_orders(result, None, None, None, params)
1384
+
1356
1385
  def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1357
1386
  """
1358
1387
  fetch all unfilled currently open orders
ccxt/htx.py CHANGED
@@ -53,6 +53,7 @@ class htx(Exchange, ImplicitAPI):
53
53
  'borrowCrossMargin': True,
54
54
  'borrowIsolatedMargin': True,
55
55
  'cancelAllOrders': True,
56
+ 'cancelAllOrdersAfter': True,
56
57
  'cancelOrder': True,
57
58
  'cancelOrders': True,
58
59
  'createDepositAddress': None,
@@ -5628,6 +5629,31 @@ class htx(Exchange, ImplicitAPI):
5628
5629
  #
5629
5630
  return response
5630
5631
 
5632
+ def cancel_all_orders_after(self, timeout: Int, params={}):
5633
+ """
5634
+ dead man's switch, cancel all orders after the given timeout
5635
+ :see: https://huobiapi.github.io/docs/spot/v1/en/#dead-man-s-switch
5636
+ :param number timeout: time in milliseconds, 0 represents cancel the timer
5637
+ :param dict [params]: extra parameters specific to the exchange API endpoint
5638
+ :returns dict: the api result
5639
+ """
5640
+ self.load_markets()
5641
+ request: dict = {
5642
+ 'timeout': self.parse_to_int(timeout / 1000) if (timeout > 0) else 0,
5643
+ }
5644
+ response = self.v2PrivatePostAlgoOrdersCancelAllAfter(self.extend(request, params))
5645
+ #
5646
+ # {
5647
+ # "code": 200,
5648
+ # "message": "success",
5649
+ # "data": {
5650
+ # "currentTime": 1630491627230,
5651
+ # "triggerTime": 1630491637230
5652
+ # }
5653
+ # }
5654
+ #
5655
+ return response
5656
+
5631
5657
  def parse_deposit_address(self, depositAddress, currency: Currency = None):
5632
5658
  #
5633
5659
  # {
ccxt/hyperliquid.py CHANGED
@@ -42,6 +42,7 @@ class hyperliquid(Exchange, ImplicitAPI):
42
42
  'borrowCrossMargin': False,
43
43
  'borrowIsolatedMargin': False,
44
44
  'cancelAllOrders': False,
45
+ 'cancelAllOrdersAfter': True,
45
46
  'cancelOrder': True,
46
47
  'cancelOrders': True,
47
48
  'cancelOrdersForSymbols': True,
@@ -1302,6 +1303,42 @@ class hyperliquid(Exchange, ImplicitAPI):
1302
1303
  #
1303
1304
  return response
1304
1305
 
1306
+ def cancel_all_orders_after(self, timeout: Int, params={}):
1307
+ """
1308
+ dead man's switch, cancel all orders after the given timeout
1309
+ :param number timeout: time in milliseconds, 0 represents cancel the timer
1310
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1311
+ :param str [params.vaultAddress]: the vault address
1312
+ :returns dict: the api result
1313
+ """
1314
+ self.check_required_credentials()
1315
+ self.load_markets()
1316
+ params = self.omit(params, ['clientOrderId', 'client_id'])
1317
+ nonce = self.milliseconds()
1318
+ request = {
1319
+ 'nonce': nonce,
1320
+ # 'vaultAddress': vaultAddress,
1321
+ }
1322
+ cancelAction = {
1323
+ 'type': 'scheduleCancel',
1324
+ 'time': nonce + timeout,
1325
+ }
1326
+ vaultAddress = self.format_vault_address(self.safe_string(params, 'vaultAddress'))
1327
+ signature = self.sign_l1_action(cancelAction, nonce, vaultAddress)
1328
+ request['action'] = cancelAction
1329
+ request['signature'] = signature
1330
+ if vaultAddress is not None:
1331
+ params = self.omit(params, 'vaultAddress')
1332
+ request['vaultAddress'] = vaultAddress
1333
+ response = self.privatePostExchange(self.extend(request, params))
1334
+ #
1335
+ # {
1336
+ # "status":"err",
1337
+ # "response":"Cannot set scheduled cancel time until enough volume traded. Required: $1000000. Traded: $373.47205."
1338
+ # }
1339
+ #
1340
+ return response
1341
+
1305
1342
  def edit_order(self, id: str, symbol: str, type: str, side: str, amount: Num = None, price: Num = None, params={}):
1306
1343
  """
1307
1344
  edit a trade order
ccxt/kraken.py CHANGED
@@ -54,6 +54,7 @@ class kraken(Exchange, ImplicitAPI):
54
54
  'option': False,
55
55
  'addMargin': False,
56
56
  'cancelAllOrders': True,
57
+ 'cancelAllOrdersAfter': True,
57
58
  'cancelOrder': True,
58
59
  'cancelOrders': True,
59
60
  'createDepositAddress': True,
@@ -2006,6 +2007,32 @@ class kraken(Exchange, ImplicitAPI):
2006
2007
  self.load_markets()
2007
2008
  return self.privatePostCancelAll(params)
2008
2009
 
2010
+ def cancel_all_orders_after(self, timeout: Int, params={}):
2011
+ """
2012
+ dead man's switch, cancel all orders after the given timeout
2013
+ :see: https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelAllOrdersAfter
2014
+ :param number timeout: time in milliseconds, 0 represents cancel the timer
2015
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2016
+ :returns dict: the api result
2017
+ """
2018
+ if timeout > 86400000:
2019
+ raise BadRequest(self.id + 'cancelAllOrdersAfter timeout should be less than 86400000 milliseconds')
2020
+ self.load_markets()
2021
+ request: dict = {
2022
+ 'timeout': (self.parse_to_int(timeout / 1000)) if (timeout > 0) else 0,
2023
+ }
2024
+ response = self.privatePostCancelAllOrdersAfter(self.extend(request, params))
2025
+ #
2026
+ # {
2027
+ # "error": [],
2028
+ # "result": {
2029
+ # "currentTime": "2023-03-24T17:41:56Z",
2030
+ # "triggerTime": "2023-03-24T17:42:56Z"
2031
+ # }
2032
+ # }
2033
+ #
2034
+ return response
2035
+
2009
2036
  def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
2010
2037
  """
2011
2038
  fetch all unfilled currently open orders
ccxt/krakenfutures.py CHANGED
@@ -46,6 +46,7 @@ class krakenfutures(Exchange, ImplicitAPI):
46
46
  'future': True,
47
47
  'option': False,
48
48
  'cancelAllOrders': True,
49
+ 'cancelAllOrdersAfter': True,
49
50
  'cancelOrder': True,
50
51
  'cancelOrders': True,
51
52
  'createMarketOrder': False,
@@ -1207,6 +1208,31 @@ class krakenfutures(Exchange, ImplicitAPI):
1207
1208
  response = self.privatePostCancelallorders(self.extend(request, params))
1208
1209
  return response
1209
1210
 
1211
+ def cancel_all_orders_after(self, timeout: Int, params={}):
1212
+ """
1213
+ dead man's switch, cancel all orders after the given timeout
1214
+ :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-dead-man-39-s-switch
1215
+ :param number timeout: time in milliseconds, 0 represents cancel the timer
1216
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1217
+ :returns dict: the api result
1218
+ """
1219
+ self.load_markets()
1220
+ request: dict = {
1221
+ 'timeout': (self.parse_to_int(timeout / 1000)) if (timeout > 0) else 0,
1222
+ }
1223
+ response = self.privatePostCancelallordersafter(self.extend(request, params))
1224
+ #
1225
+ # {
1226
+ # "result": "success",
1227
+ # "serverTime": "2018-06-19T16:51:23.839Z",
1228
+ # "status": {
1229
+ # "currentTime": "2018-06-19T16:51:23.839Z",
1230
+ # "triggerTime": "0"
1231
+ # }
1232
+ # }
1233
+ #
1234
+ return response
1235
+
1210
1236
  def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1211
1237
  """
1212
1238
  :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-get-open-orders
ccxt/kucoinfutures.py CHANGED
@@ -2093,8 +2093,8 @@ class kucoinfutures(kucoin, ImplicitAPI):
2093
2093
  # symbol(str) [optional] Symbol of the contract
2094
2094
  # side(str) [optional] buy or sell
2095
2095
  # type(str) [optional] limit, market, limit_stop or market_stop
2096
- # startAt(long) [optional] Start time(milisecond)
2097
- # endAt(long) [optional] End time(milisecond)
2096
+ # startAt(long) [optional] Start time(millisecond)
2097
+ # endAt(long) [optional] End time(millisecond)
2098
2098
  }
2099
2099
  market = None
2100
2100
  if symbol is not None:
ccxt/okx.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.okx import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Conversion, Currencies, Currency, Greeks, Int, Leverage, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Balances, Conversion, Currencies, Currency, Greeks, Int, Leverage, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from typing import Any
12
12
  from ccxt.base.errors import ExchangeError
@@ -54,8 +54,10 @@ class okx(Exchange, ImplicitAPI):
54
54
  'option': True,
55
55
  'addMargin': True,
56
56
  'cancelAllOrders': False,
57
+ 'cancelAllOrdersAfter': True,
57
58
  'cancelOrder': True,
58
59
  'cancelOrders': True,
60
+ 'cancelOrdersForSymbols': True,
59
61
  'closeAllPositions': False,
60
62
  'closePosition': True,
61
63
  'createConvertTrade': True,
@@ -3083,6 +3085,107 @@ class okx(Exchange, ImplicitAPI):
3083
3085
  ordersData = self.safe_list(response, 'data', [])
3084
3086
  return self.parse_orders(ordersData, market, None, None, params)
3085
3087
 
3088
+ def cancel_orders_for_symbols(self, orders: List[CancellationRequest], params={}):
3089
+ """
3090
+ cancel multiple orders for multiple symbols
3091
+ :see: https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-multiple-orders
3092
+ :see: https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order
3093
+ :param CancellationRequest[] orders: each order should contain the parameters required by cancelOrder namely id and symbol
3094
+ :param dict [params]: extra parameters specific to the exchange API endpoint
3095
+ :param boolean [params.trigger]: whether the order is a stop/trigger order
3096
+ :param boolean [params.trailing]: set to True if you want to cancel trailing orders
3097
+ :returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
3098
+ """
3099
+ self.load_markets()
3100
+ request = []
3101
+ options = self.safe_dict(self.options, 'cancelOrders', {})
3102
+ defaultMethod = self.safe_string(options, 'method', 'privatePostTradeCancelBatchOrders')
3103
+ method = self.safe_string(params, 'method', defaultMethod)
3104
+ stop = self.safe_bool_2(params, 'stop', 'trigger')
3105
+ trailing = self.safe_bool(params, 'trailing', False)
3106
+ isStopOrTrailing = stop or trailing
3107
+ if isStopOrTrailing:
3108
+ method = 'privatePostTradeCancelAlgos'
3109
+ for i in range(0, len(orders)):
3110
+ order = orders[i]
3111
+ id = self.safe_string(order, 'id')
3112
+ clientOrderId = self.safe_string_2(order, 'clOrdId', 'clientOrderId')
3113
+ symbol = self.safe_string(order, 'symbol')
3114
+ market = self.market(symbol)
3115
+ idKey = 'ordId'
3116
+ if isStopOrTrailing:
3117
+ idKey = 'algoId'
3118
+ elif clientOrderId is not None:
3119
+ idKey = 'clOrdId'
3120
+ requestItem = {
3121
+ 'instId': market['id'],
3122
+ }
3123
+ requestItem[idKey] = clientOrderId if (clientOrderId is not None) else id
3124
+ request.append(requestItem)
3125
+ response = None
3126
+ if method == 'privatePostTradeCancelAlgos':
3127
+ response = self.privatePostTradeCancelAlgos(request) # * dont self.extend with params, otherwise ARRAY will be turned into OBJECT
3128
+ else:
3129
+ response = self.privatePostTradeCancelBatchOrders(request) # * dont self.extend with params, otherwise ARRAY will be turned into OBJECT
3130
+ #
3131
+ # {
3132
+ # "code": "0",
3133
+ # "data": [
3134
+ # {
3135
+ # "clOrdId": "e123456789ec4dBC1123456ba123b45e",
3136
+ # "ordId": "405071912345641543",
3137
+ # "sCode": "0",
3138
+ # "sMsg": ""
3139
+ # },
3140
+ # ...
3141
+ # ],
3142
+ # "msg": ""
3143
+ # }
3144
+ #
3145
+ # Algo order
3146
+ #
3147
+ # {
3148
+ # "code": "0",
3149
+ # "data": [
3150
+ # {
3151
+ # "algoId": "431375349042380800",
3152
+ # "sCode": "0",
3153
+ # "sMsg": ""
3154
+ # }
3155
+ # ],
3156
+ # "msg": ""
3157
+ # }
3158
+ #
3159
+ ordersData = self.safe_list(response, 'data', [])
3160
+ return self.parse_orders(ordersData, None, None, None, params)
3161
+
3162
+ def cancel_all_orders_after(self, timeout: Int, params={}):
3163
+ """
3164
+ dead man's switch, cancel all orders after the given timeout
3165
+ :see: https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-all-after
3166
+ :param number timeout: time in milliseconds, 0 represents cancel the timer
3167
+ :param dict [params]: extra parameters specific to the exchange API endpoint
3168
+ :returns dict: the api result
3169
+ """
3170
+ self.load_markets()
3171
+ request: dict = {
3172
+ 'timeOut': self.parse_to_int(timeout / 1000) if (timeout > 0) else 0,
3173
+ }
3174
+ response = self.privatePostTradeCancelAllAfter(self.extend(request, params))
3175
+ #
3176
+ # {
3177
+ # "code":"0",
3178
+ # "msg":"",
3179
+ # "data":[
3180
+ # {
3181
+ # "triggerTime":"1587971460",
3182
+ # "ts":"1587971400"
3183
+ # }
3184
+ # ]
3185
+ # }
3186
+ #
3187
+ return response
3188
+
3086
3189
  def parse_order_status(self, status):
3087
3190
  statuses = {
3088
3191
  'canceled': 'canceled',
ccxt/pro/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.3.5'
7
+ __version__ = '4.3.6'
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
ccxt/pro/bitget.py CHANGED
@@ -947,7 +947,7 @@ class bitget(ccxt.async_support.bitget):
947
947
  limit = orders.getLimit(symbol, limit)
948
948
  return self.filter_by_symbol_since_limit(orders, symbol, since, limit, True)
949
949
 
950
- def handle_order(self, client: Client, message, subscription=None):
950
+ def handle_order(self, client: Client, message):
951
951
  #
952
952
  # spot
953
953
  #
ccxt/test/test_async.py CHANGED
@@ -496,6 +496,8 @@ class testMainClass(baseMainTestClass):
496
496
  final_skips['datetime'] = final_skips['timestamp']
497
497
  if ('bid' in final_skips) and not ('ask' in final_skips):
498
498
  final_skips['ask'] = final_skips['bid']
499
+ if ('baseVolume' in final_skips) and not ('quoteVolume' in final_skips):
500
+ final_skips['quoteVolume'] = final_skips['baseVolume']
499
501
  return final_skips
500
502
 
501
503
  async def test_safe(self, method_name, exchange, args=[], is_public=False):
ccxt/test/test_sync.py CHANGED
@@ -495,6 +495,8 @@ class testMainClass(baseMainTestClass):
495
495
  final_skips['datetime'] = final_skips['timestamp']
496
496
  if ('bid' in final_skips) and not ('ask' in final_skips):
497
497
  final_skips['ask'] = final_skips['bid']
498
+ if ('baseVolume' in final_skips) and not ('quoteVolume' in final_skips):
499
+ final_skips['quoteVolume'] = final_skips['baseVolume']
498
500
  return final_skips
499
501
 
500
502
  def test_safe(self, method_name, exchange, args=[], is_public=False):
ccxt/whitebit.py CHANGED
@@ -42,6 +42,7 @@ class whitebit(Exchange, ImplicitAPI):
42
42
  'future': False,
43
43
  'option': False,
44
44
  'cancelAllOrders': True,
45
+ 'cancelAllOrdersAfter': True,
45
46
  'cancelOrder': True,
46
47
  'cancelOrders': False,
47
48
  'createOrder': True,
@@ -1332,6 +1333,42 @@ class whitebit(Exchange, ImplicitAPI):
1332
1333
  #
1333
1334
  return response
1334
1335
 
1336
+ def cancel_all_orders_after(self, timeout: Int, params={}):
1337
+ """
1338
+ dead man's switch, cancel all orders after the given timeout
1339
+ :see: https://docs.whitebit.com/private/http-trade-v4/#sync-kill-switch-timer
1340
+ :param number timeout: time in milliseconds, 0 represents cancel the timer
1341
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1342
+ :param str [params.types]: Order types value. Example: "spot", "margin", "futures" or None
1343
+ :param str [params.symbol]: symbol unified symbol of the market the order was made in
1344
+ :returns dict: the api result
1345
+ """
1346
+ self.load_markets()
1347
+ symbol = self.safe_string(params, 'symbol')
1348
+ if symbol is None:
1349
+ raise ArgumentsRequired(self.id + ' cancelAllOrdersAfter() requires a symbol argument in params')
1350
+ market = self.market(symbol)
1351
+ params = self.omit(params, 'symbol')
1352
+ isBiggerThanZero = (timeout > 0)
1353
+ request: dict = {
1354
+ 'market': market['id'],
1355
+ # 'timeout': self.number_to_string(timeout / 1000) if (timeout > 0) else null,
1356
+ }
1357
+ if isBiggerThanZero:
1358
+ request['timeout'] = self.number_to_string(timeout / 1000)
1359
+ else:
1360
+ request['timeout'] = 'null'
1361
+ response = self.v4PrivatePostOrderKillSwitch(self.extend(request, params))
1362
+ #
1363
+ # {
1364
+ # "market": "BTC_USDT", # currency market,
1365
+ # "startTime": 1662478154, # now timestamp,
1366
+ # "cancellationTime": 1662478154, # now + timer_value,
1367
+ # "types": ["spot", "margin"]
1368
+ # }
1369
+ #
1370
+ return response
1371
+
1335
1372
  def parse_balance(self, response) -> Balances:
1336
1373
  balanceKeys = list(response.keys())
1337
1374
  result = {}
ccxt/woo.py CHANGED
@@ -41,6 +41,7 @@ class woo(Exchange, ImplicitAPI):
41
41
  'option': False,
42
42
  'addMargin': False,
43
43
  'cancelAllOrders': True,
44
+ 'cancelAllOrdersAfter': True,
44
45
  'cancelOrder': True,
45
46
  'cancelWithdraw': False, # exchange have that endpoint disabled atm, but was once implemented in ccxt per old docs: https://kronosresearch.github.io/wootrade-documents/#cancel-withdraw-request
46
47
  'closeAllPositions': False,
@@ -208,6 +209,7 @@ class woo(Exchange, ImplicitAPI):
208
209
  },
209
210
  'post': {
210
211
  'order': 5, # 2 requests per 1 second per symbol
212
+ 'order/cancel_all_after': 1,
211
213
  'asset/main_sub_transfer': 30, # 20 requests per 60 seconds
212
214
  'asset/ltv': 30,
213
215
  'asset/withdraw': 30, # implemented in ccxt, disabled on the exchange side https://kronosresearch.github.io/wootrade-documents/#token-withdraw
@@ -1203,6 +1205,31 @@ class woo(Exchange, ImplicitAPI):
1203
1205
  #
1204
1206
  return response
1205
1207
 
1208
+ def cancel_all_orders_after(self, timeout: Int, params={}):
1209
+ """
1210
+ dead man's switch, cancel all orders after the given timeout
1211
+ :see: https://docs.woo.org/#cancel-all-after
1212
+ :param number timeout: time in milliseconds, 0 represents cancel the timer
1213
+ :param boolean activated: countdown
1214
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1215
+ :returns dict: the api result
1216
+ """
1217
+ self.load_markets()
1218
+ request: dict = {
1219
+ 'trigger_after': timeout if (timeout > 0) else 0,
1220
+ }
1221
+ response = self.v1PrivatePostOrderCancelAllAfter(self.extend(request, params))
1222
+ #
1223
+ # {
1224
+ # "success": True,
1225
+ # "data": {
1226
+ # "expected_trigger_time": 1711534302938
1227
+ # },
1228
+ # "timestamp": 1711534302943
1229
+ # }
1230
+ #
1231
+ return response
1232
+
1206
1233
  def fetch_order(self, id: str, symbol: Str = None, params={}):
1207
1234
  """
1208
1235
  :see: https://docs.woo.org/#get-algo-order
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ccxt
3
- Version: 4.3.5
3
+ Version: 4.3.6
4
4
  Summary: A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges
5
5
  Home-page: https://ccxt.com
6
6
  Author: Igor Kroitor
@@ -262,13 +262,13 @@ console.log(version, Object.keys(exchanges));
262
262
 
263
263
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
264
264
 
265
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.5/dist/ccxt.browser.js
266
- * unpkg: https://unpkg.com/ccxt@4.3.5/dist/ccxt.browser.js
265
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.6/dist/ccxt.browser.js
266
+ * unpkg: https://unpkg.com/ccxt@4.3.6/dist/ccxt.browser.js
267
267
 
268
268
  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.
269
269
 
270
270
  ```HTML
271
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.5/dist/ccxt.browser.js"></script>
271
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.6/dist/ccxt.browser.js"></script>
272
272
  ```
273
273
 
274
274
  Creates a global `ccxt` object: