ccxt 4.3.88__py2.py3-none-any.whl → 4.3.90__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 (105) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/ace.py +1 -0
  3. ccxt/alpaca.py +3 -2
  4. ccxt/ascendex.py +102 -116
  5. ccxt/async_support/__init__.py +1 -1
  6. ccxt/async_support/ace.py +1 -0
  7. ccxt/async_support/alpaca.py +3 -2
  8. ccxt/async_support/ascendex.py +102 -116
  9. ccxt/async_support/base/exchange.py +1 -1
  10. ccxt/async_support/bigone.py +1 -0
  11. ccxt/async_support/bingx.py +30 -17
  12. ccxt/async_support/bit2c.py +1 -0
  13. ccxt/async_support/bitbank.py +1 -0
  14. ccxt/async_support/bitfinex.py +1 -0
  15. ccxt/async_support/bitfinex2.py +21 -22
  16. ccxt/async_support/bitflyer.py +1 -0
  17. ccxt/async_support/bitget.py +3 -2
  18. ccxt/async_support/bitmart.py +4 -8
  19. ccxt/async_support/bitmex.py +1 -0
  20. ccxt/async_support/bitopro.py +1 -0
  21. ccxt/async_support/bitrue.py +62 -71
  22. ccxt/async_support/bitso.py +1 -0
  23. ccxt/async_support/bitstamp.py +1 -0
  24. ccxt/async_support/bitvavo.py +1 -0
  25. ccxt/async_support/blockchaincom.py +1 -0
  26. ccxt/async_support/btcalpha.py +1 -0
  27. ccxt/async_support/btcbox.py +1 -0
  28. ccxt/async_support/btcmarkets.py +1 -0
  29. ccxt/async_support/bybit.py +2 -0
  30. ccxt/async_support/cex.py +1 -0
  31. ccxt/async_support/coinbaseexchange.py +1 -0
  32. ccxt/async_support/coinbaseinternational.py +2 -1
  33. ccxt/async_support/coinex.py +1 -16
  34. ccxt/async_support/cryptocom.py +0 -12
  35. ccxt/async_support/hitbtc.py +1 -0
  36. ccxt/async_support/huobijp.py +0 -8
  37. ccxt/async_support/kraken.py +48 -48
  38. ccxt/async_support/latoken.py +1 -0
  39. ccxt/async_support/mexc.py +1 -61
  40. ccxt/async_support/okcoin.py +4 -9
  41. ccxt/async_support/okx.py +1 -8
  42. ccxt/async_support/onetrading.py +1 -0
  43. ccxt/async_support/phemex.py +1 -0
  44. ccxt/async_support/poloniexfutures.py +1 -0
  45. ccxt/async_support/probit.py +1 -0
  46. ccxt/async_support/vertex.py +1 -0
  47. ccxt/async_support/whitebit.py +5 -3
  48. ccxt/async_support/woo.py +1 -0
  49. ccxt/async_support/woofipro.py +1 -0
  50. ccxt/base/exchange.py +6 -4
  51. ccxt/bigone.py +1 -0
  52. ccxt/bingx.py +30 -17
  53. ccxt/bit2c.py +1 -0
  54. ccxt/bitbank.py +1 -0
  55. ccxt/bitfinex.py +1 -0
  56. ccxt/bitfinex2.py +21 -22
  57. ccxt/bitflyer.py +1 -0
  58. ccxt/bitget.py +3 -2
  59. ccxt/bitmart.py +4 -8
  60. ccxt/bitmex.py +1 -0
  61. ccxt/bitopro.py +1 -0
  62. ccxt/bitrue.py +62 -71
  63. ccxt/bitso.py +1 -0
  64. ccxt/bitstamp.py +1 -0
  65. ccxt/bitvavo.py +1 -0
  66. ccxt/blockchaincom.py +1 -0
  67. ccxt/btcalpha.py +1 -0
  68. ccxt/btcbox.py +1 -0
  69. ccxt/btcmarkets.py +1 -0
  70. ccxt/bybit.py +2 -0
  71. ccxt/cex.py +1 -0
  72. ccxt/coinbaseexchange.py +1 -0
  73. ccxt/coinbaseinternational.py +2 -1
  74. ccxt/coinex.py +1 -16
  75. ccxt/cryptocom.py +0 -12
  76. ccxt/hitbtc.py +1 -0
  77. ccxt/huobijp.py +0 -8
  78. ccxt/kraken.py +48 -48
  79. ccxt/latoken.py +1 -0
  80. ccxt/mexc.py +1 -61
  81. ccxt/okcoin.py +4 -9
  82. ccxt/okx.py +1 -8
  83. ccxt/onetrading.py +1 -0
  84. ccxt/phemex.py +1 -0
  85. ccxt/poloniexfutures.py +1 -0
  86. ccxt/pro/__init__.py +1 -1
  87. ccxt/pro/binance.py +280 -0
  88. ccxt/pro/bingx.py +235 -85
  89. ccxt/pro/bithumb.py +4 -0
  90. ccxt/pro/bitvavo.py +1 -0
  91. ccxt/pro/bybit.py +253 -2
  92. ccxt/pro/cex.py +1 -0
  93. ccxt/pro/coinex.py +941 -662
  94. ccxt/pro/lbank.py +1 -2
  95. ccxt/pro/okx.py +142 -2
  96. ccxt/probit.py +1 -0
  97. ccxt/vertex.py +1 -0
  98. ccxt/whitebit.py +5 -3
  99. ccxt/woo.py +1 -0
  100. ccxt/woofipro.py +1 -0
  101. {ccxt-4.3.88.dist-info → ccxt-4.3.90.dist-info}/METADATA +4 -4
  102. {ccxt-4.3.88.dist-info → ccxt-4.3.90.dist-info}/RECORD +105 -105
  103. {ccxt-4.3.88.dist-info → ccxt-4.3.90.dist-info}/LICENSE.txt +0 -0
  104. {ccxt-4.3.88.dist-info → ccxt-4.3.90.dist-info}/WHEEL +0 -0
  105. {ccxt-4.3.88.dist-info → ccxt-4.3.90.dist-info}/top_level.txt +0 -0
ccxt/pro/bithumb.py CHANGED
@@ -37,6 +37,7 @@ class bithumb(ccxt.async_support.bithumb):
37
37
  async def watch_ticker(self, symbol: str, params={}) -> Ticker:
38
38
  """
39
39
  watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
40
+ :see: https://apidocs.bithumb.com/v1.2.0/reference/%EB%B9%97%EC%8D%B8-%EA%B1%B0%EB%9E%98%EC%86%8C-%EC%A0%95%EB%B3%B4-%EC%88%98%EC%8B%A0
40
41
  :param str symbol: unified symbol of the market to fetch the ticker for
41
42
  :param dict [params]: extra parameters specific to the exchange API endpoint
42
43
  :param str [params.channel]: the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers
@@ -56,6 +57,7 @@ class bithumb(ccxt.async_support.bithumb):
56
57
  async def watch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
57
58
  """
58
59
  watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
60
+ :see: https://apidocs.bithumb.com/v1.2.0/reference/%EB%B9%97%EC%8D%B8-%EA%B1%B0%EB%9E%98%EC%86%8C-%EC%A0%95%EB%B3%B4-%EC%88%98%EC%8B%A0
59
61
  :param str[] symbols: unified symbol of the market to fetch the ticker for
60
62
  :param dict [params]: extra parameters specific to the exchange API endpoint
61
63
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
@@ -165,6 +167,7 @@ class bithumb(ccxt.async_support.bithumb):
165
167
 
166
168
  async def watch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
167
169
  """
170
+ :see: https://apidocs.bithumb.com/v1.2.0/reference/%EB%B9%97%EC%8D%B8-%EA%B1%B0%EB%9E%98%EC%86%8C-%EC%A0%95%EB%B3%B4-%EC%88%98%EC%8B%A0
168
171
  watches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
169
172
  :param str symbol: unified symbol of the market to fetch the order book for
170
173
  :param int [limit]: the maximum amount of order book entries to return
@@ -248,6 +251,7 @@ class bithumb(ccxt.async_support.bithumb):
248
251
  async def watch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
249
252
  """
250
253
  get the list of most recent trades for a particular symbol
254
+ :see: https://apidocs.bithumb.com/v1.2.0/reference/%EB%B9%97%EC%8D%B8-%EA%B1%B0%EB%9E%98%EC%86%8C-%EC%A0%95%EB%B3%B4-%EC%88%98%EC%8B%A0
251
255
  :param str symbol: unified symbol of the market to fetch trades for
252
256
  :param int [since]: timestamp in ms of the earliest trade to fetch
253
257
  :param int [limit]: the maximum amount of trades to fetch
ccxt/pro/bitvavo.py CHANGED
@@ -602,6 +602,7 @@ class bitvavo(ccxt.async_support.bitvavo):
602
602
  """
603
603
  :see: https://docs.bitvavo.com/#tag/General/paths/~1assets/get
604
604
  fetches information on an order made by the user
605
+ :param str id: the order id
605
606
  :param str symbol: unified symbol of the market the order was made in
606
607
  :param dict [params]: extra parameters specific to the bitvavo api endpoint
607
608
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
ccxt/pro/bybit.py CHANGED
@@ -10,10 +10,12 @@ import hashlib
10
10
  from ccxt.base.types import Balances, Int, Liquidation, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade
11
11
  from ccxt.async_support.base.ws.client import Client
12
12
  from typing import List
13
+ from typing import Any
13
14
  from ccxt.base.errors import ExchangeError
14
15
  from ccxt.base.errors import AuthenticationError
15
16
  from ccxt.base.errors import ArgumentsRequired
16
17
  from ccxt.base.errors import BadRequest
18
+ from ccxt.base.errors import UnsubscribeError
17
19
 
18
20
 
19
21
  class bybit(ccxt.async_support.bybit):
@@ -377,6 +379,44 @@ class bybit(ccxt.async_support.bybit):
377
379
  return result
378
380
  return self.filter_by_array(self.tickers, 'symbol', symbols)
379
381
 
382
+ async def un_watch_tickers(self, symbols: Strings = None, params={}) -> Any:
383
+ """
384
+ unWatches a price ticker
385
+ :see: https://bybit-exchange.github.io/docs/v5/websocket/public/ticker
386
+ :see: https://bybit-exchange.github.io/docs/v5/websocket/public/etp-ticker
387
+ :param str[] symbols: unified symbol of the market to fetch the ticker for
388
+ :param dict [params]: extra parameters specific to the exchange API endpoint
389
+ :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
390
+ """
391
+ await self.load_markets()
392
+ symbols = self.market_symbols(symbols, None, False)
393
+ options = self.safe_value(self.options, 'watchTickers', {})
394
+ topic = self.safe_string(options, 'name', 'tickers')
395
+ messageHashes = []
396
+ subMessageHashes = []
397
+ marketIds = self.market_ids(symbols)
398
+ topics = []
399
+ for i in range(0, len(marketIds)):
400
+ marketId = marketIds[i]
401
+ symbol = symbols[i]
402
+ topics.append(topic + '.' + marketId)
403
+ subMessageHashes.append('ticker:' + symbol)
404
+ messageHashes.append('unsubscribe:ticker:' + symbol)
405
+ url = await self.get_url_by_market_type(symbols[0], False, 'watchTickers', params)
406
+ return await self.un_watch_topics(url, 'ticker', symbols, messageHashes, subMessageHashes, topics, params)
407
+
408
+ async def un_watch_ticker(self, symbols: str, params={}) -> Any:
409
+ """
410
+ unWatches a price ticker
411
+ :see: https://bybit-exchange.github.io/docs/v5/websocket/public/ticker
412
+ :see: https://bybit-exchange.github.io/docs/v5/websocket/public/etp-ticker
413
+ :param str symbol: unified symbol of the market to fetch the ticker for
414
+ :param dict [params]: extra parameters specific to the exchange API endpoint
415
+ :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
416
+ """
417
+ await self.load_markets()
418
+ return await self.un_watch_tickers([symbols], params)
419
+
380
420
  def handle_ticker(self, client: Client, message):
381
421
  #
382
422
  # linear
@@ -689,6 +729,49 @@ class bybit(ccxt.async_support.bybit):
689
729
  orderbook = await self.watch_topics(url, messageHashes, topics, params)
690
730
  return orderbook.limit()
691
731
 
732
+ async def un_watch_order_book_for_symbols(self, symbols: Strings, params={}) -> Any:
733
+ """
734
+ unsubscribe from the orderbook channel
735
+ :see: https://bybit-exchange.github.io/docs/v5/websocket/public/orderbook
736
+ :param str[] symbols: unified symbol of the market to unwatch the trades for
737
+ :param int [params.limit]: orderbook limit, default is None
738
+ :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
739
+ """
740
+ await self.load_markets()
741
+ symbols = self.market_symbols(symbols, None, False)
742
+ channel = 'orderbook.'
743
+ limit = self.safe_integer(params, 'limit')
744
+ if limit is not None:
745
+ params = self.omit(params, 'limit')
746
+ else:
747
+ firstMarket = self.market(symbols[0])
748
+ limit = 50 if firstMarket['spot'] else 500
749
+ channel += str(limit)
750
+ subMessageHashes = []
751
+ messageHashes = []
752
+ topics = []
753
+ for i in range(0, len(symbols)):
754
+ symbol = symbols[i]
755
+ market = self.market(symbol)
756
+ marketId = market['id']
757
+ topic = channel + '.' + marketId
758
+ messageHashes.append('unsubscribe:orderbook:' + symbol)
759
+ subMessageHashes.append('orderbook:' + symbol)
760
+ topics.append(topic)
761
+ url = await self.get_url_by_market_type(symbols[0], False, 'watchOrderBook', params)
762
+ return await self.un_watch_topics(url, 'orderbook', symbols, messageHashes, subMessageHashes, topics, params)
763
+
764
+ async def un_watch_order_book(self, symbol: str, params={}) -> Any:
765
+ """
766
+ unsubscribe from the orderbook channel
767
+ :see: https://bybit-exchange.github.io/docs/v5/websocket/public/orderbook
768
+ :param str[] symbols: unified symbol of the market to unwatch the trades for
769
+ :param int [params.limit]: orderbook limit, default is None
770
+ :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
771
+ """
772
+ await self.load_markets()
773
+ return await self.un_watch_order_book_for_symbols([symbol], params)
774
+
692
775
  def handle_order_book(self, client: Client, message):
693
776
  #
694
777
  # {
@@ -802,6 +885,39 @@ class bybit(ccxt.async_support.bybit):
802
885
  limit = trades.getLimit(tradeSymbol, limit)
803
886
  return self.filter_by_since_limit(trades, since, limit, 'timestamp', True)
804
887
 
888
+ async def un_watch_trades_for_symbols(self, symbols: Strings, params={}) -> Any:
889
+ """
890
+ unsubscribe from the trades channel
891
+ :see: https://bybit-exchange.github.io/docs/v5/websocket/public/trade
892
+ :param str[] symbols: unified symbol of the market to unwatch the trades for
893
+ :returns any: status of the unwatch request
894
+ """
895
+ await self.load_markets()
896
+ symbols = self.market_symbols(symbols, None, False, True)
897
+ url = await self.get_url_by_market_type(symbols[0], False, 'unWatchTradesForSymbols', params)
898
+ messageHashes = []
899
+ topics = []
900
+ subMessageHashes = []
901
+ for i in range(0, len(symbols)):
902
+ symbol = symbols[i]
903
+ market = self.market(symbol)
904
+ topic = 'publicTrade.' + market['id']
905
+ topics.append(topic)
906
+ messageHash = 'unsubscribe:trade:' + symbol
907
+ messageHashes.append(messageHash)
908
+ subMessageHashes.append('trade:' + symbol)
909
+ return await self.un_watch_topics(url, 'trade', symbols, messageHashes, subMessageHashes, topics, params)
910
+
911
+ async def un_watch_trades(self, symbol: str, params={}) -> Any:
912
+ """
913
+ unsubscribe from the trades channel
914
+ :see: https://bybit-exchange.github.io/docs/v5/websocket/public/trade
915
+ :param str symbol: unified symbol of the market to unwatch the trades for
916
+ :returns any: status of the unwatch request
917
+ """
918
+ await self.load_markets()
919
+ return await self.un_watch_trades_for_symbols([symbol], params)
920
+
805
921
  def handle_trades(self, client: Client, message):
806
922
  #
807
923
  # {
@@ -948,6 +1064,32 @@ class bybit(ccxt.async_support.bybit):
948
1064
  limit = trades.getLimit(symbol, limit)
949
1065
  return self.filter_by_symbol_since_limit(trades, symbol, since, limit, True)
950
1066
 
1067
+ async def un_watch_my_trades(self, symbol: Str = None, params={}) -> Any:
1068
+ """
1069
+ unWatches information on multiple trades made by the user
1070
+ :see: https://bybit-exchange.github.io/docs/v5/websocket/private/execution
1071
+ :param str symbol: unified market symbol of the market orders were made in
1072
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1073
+ :param boolean [params.unifiedMargin]: use unified margin account
1074
+ :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1075
+ """
1076
+ method = 'watchMyTrades'
1077
+ messageHash = 'unsubscribe:myTrades'
1078
+ subHash = 'myTrades'
1079
+ await self.load_markets()
1080
+ if symbol is not None:
1081
+ symbol = self.symbol(symbol)
1082
+ subHash += ':' + symbol
1083
+ url = await self.get_url_by_market_type(symbol, True, method, params)
1084
+ await self.authenticate(url)
1085
+ topicByMarket: dict = {
1086
+ 'spot': 'ticketInfo',
1087
+ 'unified': 'execution',
1088
+ 'usdc': 'user.openapi.perp.trade',
1089
+ }
1090
+ topic = self.safe_value(topicByMarket, self.get_private_type(url))
1091
+ return await self.un_watch_topics(url, 'myTrades', [], [messageHash], [subHash], [topic], params)
1092
+
951
1093
  def handle_my_trades(self, client: Client, message):
952
1094
  #
953
1095
  # spot
@@ -1195,7 +1337,7 @@ class bybit(ccxt.async_support.bybit):
1195
1337
  topic = 'liquidation.' + market['id']
1196
1338
  newLiquidation = await self.watch_topics(url, [messageHash], [topic], params)
1197
1339
  if self.newUpdates:
1198
- return [newLiquidation]
1340
+ return newLiquidation
1199
1341
  return self.filter_by_symbols_since_limit(self.liquidations, [symbol], since, limit, True)
1200
1342
 
1201
1343
  def handle_liquidation(self, client: Client, message):
@@ -1281,6 +1423,32 @@ class bybit(ccxt.async_support.bybit):
1281
1423
  limit = orders.getLimit(symbol, limit)
1282
1424
  return self.filter_by_symbol_since_limit(orders, symbol, since, limit, True)
1283
1425
 
1426
+ async def un_watch_orders(self, symbol: Str = None, params={}) -> Any:
1427
+ """
1428
+ unWatches information on multiple orders made by the user
1429
+ :see: https://bybit-exchange.github.io/docs/v5/websocket/private/order
1430
+ :param str symbol: unified market symbol of the market orders were made in
1431
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1432
+ :param boolean [params.unifiedMargin]: use unified margin account
1433
+ :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1434
+ """
1435
+ await self.load_markets()
1436
+ method = 'watchOrders'
1437
+ messageHash = 'unsubscribe:orders'
1438
+ subHash = 'orders'
1439
+ if symbol is not None:
1440
+ symbol = self.symbol(symbol)
1441
+ subHash += ':' + symbol
1442
+ url = await self.get_url_by_market_type(symbol, True, method, params)
1443
+ await self.authenticate(url)
1444
+ topicsByMarket: dict = {
1445
+ 'spot': ['order', 'stopOrder'],
1446
+ 'unified': ['order'],
1447
+ 'usdc': ['user.openapi.perp.order'],
1448
+ }
1449
+ topics = self.safe_value(topicsByMarket, self.get_private_type(url))
1450
+ return await self.un_watch_topics(url, 'orders', [], [messageHash], [subHash], topics, params)
1451
+
1284
1452
  def handle_order_ws(self, client: Client, message):
1285
1453
  #
1286
1454
  # {
@@ -1827,7 +1995,24 @@ class bybit(ccxt.async_support.bybit):
1827
1995
  'args': topics,
1828
1996
  }
1829
1997
  message = self.extend(request, params)
1830
- return await self.watch_multiple(url, messageHashes, message, topics)
1998
+ return await self.watch_multiple(url, messageHashes, message, messageHashes)
1999
+
2000
+ async def un_watch_topics(self, url: str, topic: str, symbols: List[str], messageHashes: List[str], subMessageHashes: List[str], topics, params={}):
2001
+ reqId = self.request_id()
2002
+ request: dict = {
2003
+ 'op': 'unsubscribe',
2004
+ 'req_id': reqId,
2005
+ 'args': topics,
2006
+ }
2007
+ subscription = {
2008
+ 'id': reqId,
2009
+ 'topic': topic,
2010
+ 'messageHashes': messageHashes,
2011
+ 'subMessageHashes': subMessageHashes,
2012
+ 'symbols': symbols,
2013
+ }
2014
+ message = self.extend(request, params)
2015
+ return await self.watch_multiple(url, messageHashes, message, messageHashes, subscription)
1831
2016
 
1832
2017
  async def authenticate(self, url, params={}):
1833
2018
  self.check_required_credentials()
@@ -1964,6 +2149,7 @@ class bybit(ccxt.async_support.bybit):
1964
2149
  'order.amend': self.handle_order_ws,
1965
2150
  'order.cancel': self.handle_order_ws,
1966
2151
  'auth': self.handle_authenticate,
2152
+ 'unsubscribe': self.handle_un_subscribe,
1967
2153
  }
1968
2154
  exacMethod = self.safe_value(methods, topic)
1969
2155
  if exacMethod is not None:
@@ -2046,3 +2232,68 @@ class bybit(ccxt.async_support.bybit):
2046
2232
  # }
2047
2233
  #
2048
2234
  return message
2235
+
2236
+ def handle_un_subscribe(self, client: Client, message):
2237
+ #
2238
+ # {"success":true,"ret_msg":"","conn_id":"7188110e-6908-41e9-b863-6365127e92ad","req_id":"3","op":"unsubscribe"}
2239
+ #
2240
+ # client.subscription will be something like:
2241
+ # {
2242
+ # "publicTrade.LTCUSDT":true,
2243
+ # "publicTrade.ADAUSDT":true,
2244
+ # "unsubscribe:trade:LTC/USDT:USDT": {
2245
+ # "id":4,
2246
+ # "subHash": "trade:LTC/USDT"
2247
+ # },
2248
+ # }
2249
+ reqId = self.safe_string(message, 'req_id')
2250
+ keys = list(client.subscriptions.keys())
2251
+ for i in range(0, len(keys)):
2252
+ messageHash = keys[i]
2253
+ if not (messageHash in client.subscriptions):
2254
+ continue
2255
+ # the previous iteration can have deleted the messageHash from the subscriptions
2256
+ if messageHash.startswith('unsubscribe'):
2257
+ subscription = client.subscriptions[messageHash]
2258
+ subId = self.safe_string(subscription, 'id')
2259
+ if reqId != subId:
2260
+ continue
2261
+ messageHashes = self.safe_list(subscription, 'messageHashes', [])
2262
+ subMessageHashes = self.safe_list(subscription, 'subMessageHashes', [])
2263
+ for j in range(0, len(messageHashes)):
2264
+ unsubHash = messageHashes[j]
2265
+ subHash = subMessageHashes[j]
2266
+ if unsubHash in client.subscriptions:
2267
+ del client.subscriptions[unsubHash]
2268
+ if subHash in client.subscriptions:
2269
+ del client.subscriptions[subHash]
2270
+ error = UnsubscribeError(self.id + ' ' + messageHash)
2271
+ client.reject(error, subHash)
2272
+ client.resolve(True, unsubHash)
2273
+ self.clean_cache(subscription)
2274
+ return message
2275
+
2276
+ def clean_cache(self, subscription: dict):
2277
+ topic = self.safe_string(subscription, 'topic')
2278
+ symbols = self.safe_list(subscription, 'symbols', [])
2279
+ symbolsLength = len(symbols)
2280
+ if symbolsLength > 0:
2281
+ for i in range(0, len(symbols)):
2282
+ symbol = symbols[i]
2283
+ if topic == 'trade':
2284
+ del self.trades[symbol]
2285
+ elif topic == 'orderbook':
2286
+ del self.orderbooks[symbol]
2287
+ elif topic == 'ticker':
2288
+ del self.tickers[symbol]
2289
+ else:
2290
+ if topic == 'myTrades':
2291
+ # don't reset self.myTrades directly here
2292
+ # because in c# we need to use a different object
2293
+ keys = list(self.myTrades.keys())
2294
+ for i in range(0, len(keys)):
2295
+ del self.myTrades[keys[i]]
2296
+ elif topic == 'orders':
2297
+ orderSymbols = list(self.orders.keys())
2298
+ for i in range(0, len(orderSymbols)):
2299
+ del self.orders[orderSymbols[i]]
ccxt/pro/cex.py CHANGED
@@ -1130,6 +1130,7 @@ class cex(ccxt.async_support.cex):
1130
1130
  """
1131
1131
  fetches information on an order made by the user
1132
1132
  :see: https://docs.cex.io/#ws-api-get-order
1133
+ :param str id: the order id
1133
1134
  :param str symbol: not used by cex fetchOrder
1134
1135
  :param dict [params]: extra parameters specific to the cex api endpoint
1135
1136
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`