ccxt 4.2.93__py2.py3-none-any.whl → 4.2.95__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 (190) hide show
  1. ccxt/__init__.py +2 -2
  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/bitstamp.py +6 -0
  7. ccxt/ace.py +1 -1
  8. ccxt/ascendex.py +1 -1
  9. ccxt/async_support/__init__.py +2 -2
  10. ccxt/async_support/ace.py +1 -1
  11. ccxt/async_support/ascendex.py +1 -1
  12. ccxt/async_support/base/exchange.py +7 -1
  13. ccxt/async_support/bigone.py +1 -1
  14. ccxt/async_support/binance.py +63 -5
  15. ccxt/async_support/bingx.py +1 -1
  16. ccxt/async_support/bit2c.py +1 -1
  17. ccxt/async_support/bitbank.py +1 -1
  18. ccxt/async_support/bitfinex.py +1 -1
  19. ccxt/async_support/bitfinex2.py +1 -1
  20. ccxt/async_support/bitget.py +136 -2
  21. ccxt/async_support/bithumb.py +1 -1
  22. ccxt/async_support/bitmart.py +1 -1
  23. ccxt/async_support/bitmex.py +1 -1
  24. ccxt/async_support/bitopro.py +1 -1
  25. ccxt/async_support/bitrue.py +1 -1
  26. ccxt/async_support/bitso.py +1 -1
  27. ccxt/async_support/bitstamp.py +7 -1
  28. ccxt/async_support/bitteam.py +1 -1
  29. ccxt/async_support/bitvavo.py +1 -1
  30. ccxt/async_support/blockchaincom.py +1 -1
  31. ccxt/async_support/blofin.py +1 -1
  32. ccxt/async_support/btcalpha.py +1 -1
  33. ccxt/async_support/btcbox.py +1 -1
  34. ccxt/async_support/bybit.py +2 -2
  35. ccxt/async_support/cex.py +1 -1
  36. ccxt/async_support/coinbase.py +1 -1
  37. ccxt/async_support/coinbaseinternational.py +1 -1
  38. ccxt/async_support/coinbasepro.py +1 -1
  39. ccxt/async_support/coincheck.py +1 -1
  40. ccxt/async_support/coinex.py +62 -56
  41. ccxt/async_support/coinlist.py +1 -1
  42. ccxt/async_support/coinmate.py +1 -1
  43. ccxt/async_support/coinsph.py +1 -1
  44. ccxt/async_support/cryptocom.py +1 -1
  45. ccxt/async_support/currencycom.py +1 -1
  46. ccxt/async_support/delta.py +1 -1
  47. ccxt/async_support/deribit.py +1 -1
  48. ccxt/async_support/digifinex.py +1 -1
  49. ccxt/async_support/exmo.py +1 -1
  50. ccxt/async_support/gate.py +1 -1
  51. ccxt/async_support/gemini.py +3 -2
  52. ccxt/async_support/hitbtc.py +1 -1
  53. ccxt/async_support/hollaex.py +1 -1
  54. ccxt/async_support/htx.py +117 -116
  55. ccxt/async_support/huobijp.py +1 -1
  56. ccxt/async_support/idex.py +1 -1
  57. ccxt/async_support/indodax.py +1 -1
  58. ccxt/async_support/kraken.py +1 -1
  59. ccxt/async_support/krakenfutures.py +2 -2
  60. ccxt/async_support/kucoin.py +1 -1
  61. ccxt/async_support/kucoinfutures.py +1 -1
  62. ccxt/async_support/latoken.py +1 -1
  63. ccxt/async_support/lbank.py +1 -1
  64. ccxt/async_support/mexc.py +1 -1
  65. ccxt/async_support/ndax.py +1 -1
  66. ccxt/async_support/novadax.py +1 -1
  67. ccxt/async_support/oceanex.py +1 -1
  68. ccxt/async_support/okcoin.py +1 -1
  69. ccxt/async_support/okx.py +191 -43
  70. ccxt/async_support/onetrading.py +1 -1
  71. ccxt/async_support/p2b.py +1 -1
  72. ccxt/async_support/phemex.py +1 -1
  73. ccxt/async_support/poloniex.py +1 -1
  74. ccxt/async_support/poloniexfutures.py +1 -1
  75. ccxt/async_support/probit.py +1 -1
  76. ccxt/async_support/timex.py +1 -1
  77. ccxt/async_support/tokocrypto.py +1 -1
  78. ccxt/async_support/tradeogre.py +1 -1
  79. ccxt/async_support/upbit.py +2 -2
  80. ccxt/async_support/wavesexchange.py +1 -1
  81. ccxt/async_support/whitebit.py +1 -1
  82. ccxt/async_support/woo.py +136 -2
  83. ccxt/async_support/yobit.py +1 -1
  84. ccxt/async_support/zonda.py +1 -1
  85. ccxt/base/errors.py +7 -7
  86. ccxt/base/exchange.py +18 -1
  87. ccxt/base/types.py +13 -0
  88. ccxt/bigone.py +1 -1
  89. ccxt/binance.py +63 -5
  90. ccxt/bingx.py +1 -1
  91. ccxt/bit2c.py +1 -1
  92. ccxt/bitbank.py +1 -1
  93. ccxt/bitfinex.py +1 -1
  94. ccxt/bitfinex2.py +1 -1
  95. ccxt/bitget.py +136 -2
  96. ccxt/bithumb.py +1 -1
  97. ccxt/bitmart.py +1 -1
  98. ccxt/bitmex.py +1 -1
  99. ccxt/bitopro.py +1 -1
  100. ccxt/bitrue.py +1 -1
  101. ccxt/bitso.py +1 -1
  102. ccxt/bitstamp.py +7 -1
  103. ccxt/bitteam.py +1 -1
  104. ccxt/bitvavo.py +1 -1
  105. ccxt/blockchaincom.py +1 -1
  106. ccxt/blofin.py +1 -1
  107. ccxt/btcalpha.py +1 -1
  108. ccxt/btcbox.py +1 -1
  109. ccxt/bybit.py +2 -2
  110. ccxt/cex.py +1 -1
  111. ccxt/coinbase.py +1 -1
  112. ccxt/coinbaseinternational.py +1 -1
  113. ccxt/coinbasepro.py +1 -1
  114. ccxt/coincheck.py +1 -1
  115. ccxt/coinex.py +62 -56
  116. ccxt/coinlist.py +1 -1
  117. ccxt/coinmate.py +1 -1
  118. ccxt/coinsph.py +1 -1
  119. ccxt/cryptocom.py +1 -1
  120. ccxt/currencycom.py +1 -1
  121. ccxt/delta.py +1 -1
  122. ccxt/deribit.py +1 -1
  123. ccxt/digifinex.py +1 -1
  124. ccxt/exmo.py +1 -1
  125. ccxt/gate.py +1 -1
  126. ccxt/gemini.py +3 -2
  127. ccxt/hitbtc.py +1 -1
  128. ccxt/hollaex.py +1 -1
  129. ccxt/htx.py +117 -116
  130. ccxt/huobijp.py +1 -1
  131. ccxt/idex.py +1 -1
  132. ccxt/indodax.py +1 -1
  133. ccxt/kraken.py +1 -1
  134. ccxt/krakenfutures.py +2 -2
  135. ccxt/kucoin.py +1 -1
  136. ccxt/kucoinfutures.py +1 -1
  137. ccxt/latoken.py +1 -1
  138. ccxt/lbank.py +1 -1
  139. ccxt/mexc.py +1 -1
  140. ccxt/ndax.py +1 -1
  141. ccxt/novadax.py +1 -1
  142. ccxt/oceanex.py +1 -1
  143. ccxt/okcoin.py +1 -1
  144. ccxt/okx.py +191 -43
  145. ccxt/onetrading.py +1 -1
  146. ccxt/p2b.py +1 -1
  147. ccxt/phemex.py +1 -1
  148. ccxt/poloniex.py +1 -1
  149. ccxt/poloniexfutures.py +1 -1
  150. ccxt/pro/__init__.py +1 -1
  151. ccxt/pro/ascendex.py +1 -1
  152. ccxt/pro/bitfinex2.py +1 -1
  153. ccxt/pro/bitget.py +1 -1
  154. ccxt/pro/bitmart.py +1 -1
  155. ccxt/pro/bitmex.py +1 -1
  156. ccxt/pro/bitstamp.py +1 -1
  157. ccxt/pro/bitvavo.py +1 -1
  158. ccxt/pro/blockchaincom.py +1 -1
  159. ccxt/pro/bybit.py +1 -1
  160. ccxt/pro/coinbase.py +12 -0
  161. ccxt/pro/coinbaseinternational.py +1 -1
  162. ccxt/pro/coinbasepro.py +1 -1
  163. ccxt/pro/coinex.py +1 -1
  164. ccxt/pro/cryptocom.py +1 -1
  165. ccxt/pro/gate.py +1 -1
  166. ccxt/pro/hitbtc.py +1 -1
  167. ccxt/pro/hollaex.py +1 -1
  168. ccxt/pro/htx.py +1 -1
  169. ccxt/pro/kraken.py +97 -19
  170. ccxt/pro/krakenfutures.py +105 -40
  171. ccxt/pro/kucoin.py +25 -16
  172. ccxt/pro/okcoin.py +1 -1
  173. ccxt/pro/okx.py +1 -1
  174. ccxt/pro/poloniex.py +1 -1
  175. ccxt/pro/poloniexfutures.py +1 -1
  176. ccxt/pro/whitebit.py +1 -1
  177. ccxt/probit.py +1 -1
  178. ccxt/timex.py +1 -1
  179. ccxt/tokocrypto.py +1 -1
  180. ccxt/tradeogre.py +1 -1
  181. ccxt/upbit.py +2 -2
  182. ccxt/wavesexchange.py +1 -1
  183. ccxt/whitebit.py +1 -1
  184. ccxt/woo.py +136 -2
  185. ccxt/yobit.py +1 -1
  186. ccxt/zonda.py +1 -1
  187. {ccxt-4.2.93.dist-info → ccxt-4.2.95.dist-info}/METADATA +4 -4
  188. {ccxt-4.2.93.dist-info → ccxt-4.2.95.dist-info}/RECORD +190 -190
  189. {ccxt-4.2.93.dist-info → ccxt-4.2.95.dist-info}/WHEEL +0 -0
  190. {ccxt-4.2.93.dist-info → ccxt-4.2.95.dist-info}/top_level.txt +0 -0
ccxt/pro/krakenfutures.py CHANGED
@@ -10,8 +10,8 @@ from ccxt.base.types import Balances, Int, Order, OrderBook, Position, Str, Stri
10
10
  from ccxt.async_support.base.ws.client import Client
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
- from ccxt.base.errors import ArgumentsRequired
14
13
  from ccxt.base.errors import AuthenticationError
14
+ from ccxt.base.errors import ArgumentsRequired
15
15
  from ccxt.base.precise import Precise
16
16
 
17
17
 
@@ -32,9 +32,12 @@ class krakenfutures(ccxt.async_support.krakenfutures):
32
32
  'fetchTradesWs': False,
33
33
  'watchOHLCV': False,
34
34
  'watchOrderBook': True,
35
+ 'watchOrderBookForSymbols': True,
35
36
  'watchTicker': True,
36
37
  'watchTickers': True,
38
+ 'watchBidsAsks': True,
37
39
  'watchTrades': True,
40
+ 'watchTradesForSymbols': True,
38
41
  'watchBalance': True,
39
42
  # 'watchStatus': True, # https://docs.futures.kraken.com/#websocket-api-public-feeds-heartbeat
40
43
  'watchOrders': True,
@@ -55,12 +58,6 @@ class krakenfutures(ccxt.async_support.krakenfutures):
55
58
  'OHLCVLimit': 1000,
56
59
  'connectionLimit': 100, # https://docs.futures.kraken.com/#websocket-api-websocket-api-introduction-subscriptions-limits
57
60
  'requestLimit': 100, # per second
58
- 'watchTicker': {
59
- 'method': 'ticker', # or ticker_lite
60
- },
61
- 'watchTickers': {
62
- 'method': 'ticker', # or ticker_lite
63
- },
64
61
  'fetchBalance': {
65
62
  'type': None,
66
63
  },
@@ -96,6 +93,18 @@ class krakenfutures(ccxt.async_support.krakenfutures):
96
93
  client.subscriptions[messageHash] = future
97
94
  return future
98
95
 
96
+ async def watch_order_book_for_symbols(self, symbols: List[str], limit: Int = None, params={}) -> OrderBook:
97
+ """
98
+ watches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
99
+ :see: https://docs.futures.kraken.com/#websocket-api-public-feeds-challenge
100
+ :param str[] symbols: unified array of symbols
101
+ :param int [limit]: the maximum amount of order book entries to return
102
+ :param dict [params]: extra parameters specific to the exchange API endpoint
103
+ :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
104
+ """
105
+ orderbook = await self.watch_multi_helper('orderbook', 'book', symbols, {'limit': limit}, params)
106
+ return orderbook.limit()
107
+
99
108
  async def subscribe_public(self, name: str, symbols: List[str], params={}):
100
109
  """
101
110
  * @ignore
@@ -156,31 +165,43 @@ class krakenfutures(ccxt.async_support.krakenfutures):
156
165
  :param dict [params]: extra parameters specific to the exchange API endpoint
157
166
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
158
167
  """
159
- options = self.safe_value(self.options, 'watchTicker')
160
- method = self.safe_string(options, 'method', 'ticker') # or ticker_lite
161
- name = self.safe_string(params, 'method', method)
162
- params = self.omit(params, ['method'])
163
- return await self.subscribe_public(name, [symbol], params)
168
+ await self.load_markets()
169
+ symbol = self.symbol(symbol)
170
+ tickers = await self.watch_tickers([symbol], params)
171
+ return tickers[symbol]
164
172
 
165
173
  async def watch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
166
174
  """
167
175
  watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
168
- :see: https://docs.futures.kraken.com/#websocket-api-public-feeds-ticker-lite
176
+ :see: https://docs.futures.kraken.com/#websocket-api-public-feeds-ticker
169
177
  :param str symbol: unified symbol of the market to fetch the ticker for
170
178
  :param dict [params]: extra parameters specific to the exchange API endpoint
171
179
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
172
180
  """
173
- method = self.safe_string(self.options, 'watchTickerMethod', 'ticker') # or ticker_lite
174
- name = self.safe_string_2(params, 'method', 'watchTickerMethod', method)
175
- params = self.omit(params, ['watchTickerMethod', 'method'])
181
+ await self.load_markets()
176
182
  symbols = self.market_symbols(symbols, None, False)
177
- ticker = await self.subscribe_public(name, symbols, params)
183
+ ticker = await self.watch_multi_helper('ticker', 'ticker', symbols, None, params)
178
184
  if self.newUpdates:
179
- tickers = {}
180
- tickers[ticker['symbol']] = ticker
181
- return tickers
185
+ result = {}
186
+ result[ticker['symbol']] = ticker
187
+ return result
182
188
  return self.filter_by_array(self.tickers, 'symbol', symbols)
183
189
 
190
+ async def watch_bids_asks(self, symbols: Strings = None, params={}) -> Tickers:
191
+ """
192
+ :see: https://docs.futures.kraken.com/#websocket-api-public-feeds-ticker-lite
193
+ watches best bid & ask for symbols
194
+ :param str[] symbols: unified symbol of the market to fetch the ticker for
195
+ :param dict [params]: extra parameters specific to the exchange API endpoint
196
+ :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
197
+ """
198
+ ticker = await self.watch_multi_helper('bidask', 'ticker_lite', symbols, None, params)
199
+ if self.newUpdates:
200
+ result = {}
201
+ result[ticker['symbol']] = ticker
202
+ return result
203
+ return self.filter_by_array(self.bidsasks, 'symbol', symbols)
204
+
184
205
  async def watch_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
185
206
  """
186
207
  get the list of most recent trades for a particular symbol
@@ -191,11 +212,23 @@ class krakenfutures(ccxt.async_support.krakenfutures):
191
212
  :param dict [params]: extra parameters specific to the exchange API endpoint
192
213
  :returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
193
214
  """
194
- await self.load_markets()
195
- name = 'trade'
196
- trades = await self.subscribe_public(name, [symbol], params)
215
+ return await self.watch_trades_for_symbols([symbol], since, limit, params)
216
+
217
+ async def watch_trades_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}) -> List[Trade]:
218
+ """
219
+ :see: https://docs.futures.kraken.com/#websocket-api-public-feeds-trade
220
+ get the list of most recent trades for a list of symbols
221
+ :param str[] symbols: unified symbol of the market to fetch trades for
222
+ :param int [since]: timestamp in ms of the earliest trade to fetch
223
+ :param int [limit]: the maximum amount of trades to fetch
224
+ :param dict [params]: extra parameters specific to the exchange API endpoint
225
+ :returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
226
+ """
227
+ trades = await self.watch_multi_helper('trade', 'trade', symbols, None, params)
197
228
  if self.newUpdates:
198
- limit = trades.getLimit(symbol, limit)
229
+ first = self.safe_list(trades, 0)
230
+ tradeSymbol = self.safe_string(first, 'symbol')
231
+ limit = trades.getLimit(tradeSymbol, limit)
199
232
  return self.filter_by_since_limit(trades, since, limit, 'timestamp', True)
200
233
 
201
234
  async def watch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
@@ -207,8 +240,7 @@ class krakenfutures(ccxt.async_support.krakenfutures):
207
240
  :param dict [params]: extra parameters specific to the exchange API endpoint
208
241
  :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
209
242
  """
210
- orderbook = await self.subscribe_public('book', [symbol], params)
211
- return orderbook.limit()
243
+ return await self.watch_order_book_for_symbols([symbol], limit, params)
212
244
 
213
245
  async def watch_positions(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}) -> List[Position]:
214
246
  """
@@ -436,7 +468,7 @@ class krakenfutures(ccxt.async_support.krakenfutures):
436
468
  if marketId is not None:
437
469
  market = self.market(marketId)
438
470
  symbol = market['symbol']
439
- messageHash = 'trade:' + symbol
471
+ messageHash = self.get_message_hash('trade', None, symbol)
440
472
  if self.safe_list(self.trades, symbol) is None:
441
473
  tradesLimit = self.safe_integer(self.options, 'tradesLimit', 1000)
442
474
  self.trades[symbol] = ArrayCache(tradesLimit)
@@ -453,7 +485,6 @@ class krakenfutures(ccxt.async_support.krakenfutures):
453
485
  trade = self.parse_ws_trade(message)
454
486
  tradesArray.append(trade)
455
487
  client.resolve(tradesArray, messageHash)
456
- return message
457
488
 
458
489
  def parse_ws_trade(self, trade, market=None):
459
490
  #
@@ -859,7 +890,15 @@ class krakenfutures(ccxt.async_support.krakenfutures):
859
890
  # "volumeQuote": 19628180
860
891
  # }
861
892
  #
862
- # ticker_lite
893
+ marketId = self.safe_string(message, 'product_id')
894
+ if marketId is not None:
895
+ ticker = self.parse_ws_ticker(message)
896
+ symbol = ticker['symbol']
897
+ self.tickers[symbol] = ticker
898
+ messageHash = self.get_message_hash('ticker', None, symbol)
899
+ client.resolve(ticker, messageHash)
900
+
901
+ def handle_bid_ask(self, client: Client, message):
863
902
  #
864
903
  # {
865
904
  # "feed": "ticker_lite",
@@ -877,15 +916,12 @@ class krakenfutures(ccxt.async_support.krakenfutures):
877
916
  # }
878
917
  #
879
918
  marketId = self.safe_string(message, 'product_id')
880
- feed = self.safe_string(message, 'feed')
881
919
  if marketId is not None:
882
920
  ticker = self.parse_ws_ticker(message)
883
921
  symbol = ticker['symbol']
884
- self.tickers[symbol] = ticker
885
- messageHash = feed + ':' + symbol
922
+ self.bidsasks[symbol] = ticker
923
+ messageHash = self.get_message_hash('bidask', None, symbol)
886
924
  client.resolve(ticker, messageHash)
887
- client.resolve(self.tickers, feed)
888
- return message
889
925
 
890
926
  def parse_ws_ticker(self, ticker, market=None):
891
927
  #
@@ -997,14 +1033,14 @@ class krakenfutures(ccxt.async_support.krakenfutures):
997
1033
  marketId = self.safe_string(message, 'product_id')
998
1034
  market = self.safe_market(marketId)
999
1035
  symbol = market['symbol']
1000
- messageHash = 'book:' + symbol
1001
- subscription = self.safe_value(client.subscriptions, messageHash, {})
1036
+ messageHash = self.get_message_hash('orderbook', None, symbol)
1037
+ subscription = self.safe_dict(client.subscriptions, messageHash, {})
1002
1038
  limit = self.safe_integer(subscription, 'limit')
1003
1039
  timestamp = self.safe_integer(message, 'timestamp')
1004
1040
  self.orderbooks[symbol] = self.order_book({}, limit)
1005
1041
  orderbook = self.orderbooks[symbol]
1006
- bids = self.safe_value(message, 'bids')
1007
- asks = self.safe_value(message, 'asks')
1042
+ bids = self.safe_list(message, 'bids')
1043
+ asks = self.safe_list(message, 'asks')
1008
1044
  for i in range(0, len(bids)):
1009
1045
  bid = bids[i]
1010
1046
  price = self.safe_number(bid, 'price')
@@ -1037,7 +1073,7 @@ class krakenfutures(ccxt.async_support.krakenfutures):
1037
1073
  marketId = self.safe_string(message, 'product_id')
1038
1074
  market = self.safe_market(marketId)
1039
1075
  symbol = market['symbol']
1040
- messageHash = 'book:' + symbol
1076
+ messageHash = self.get_message_hash('orderbook', None, symbol)
1041
1077
  orderbook = self.orderbooks[symbol]
1042
1078
  side = self.safe_string(message, 'side')
1043
1079
  price = self.safe_number(message, 'price')
@@ -1353,6 +1389,35 @@ class krakenfutures(ccxt.async_support.krakenfutures):
1353
1389
  },
1354
1390
  })
1355
1391
 
1392
+ async def watch_multi_helper(self, unifiedName: str, channelName: str, symbols: Strings = None, subscriptionArgs=None, params={}):
1393
+ await self.load_markets()
1394
+ # symbols are required
1395
+ symbols = self.market_symbols(symbols, None, False, True, False)
1396
+ messageHashes = []
1397
+ for i in range(0, len(symbols)):
1398
+ messageHashes.append(self.get_message_hash(unifiedName, None, self.symbol(symbols[i])))
1399
+ marketIds = self.market_ids(symbols)
1400
+ request = {
1401
+ 'event': 'subscribe',
1402
+ 'feed': channelName,
1403
+ 'product_ids': marketIds,
1404
+ }
1405
+ url = self.urls['api']['ws']
1406
+ return await self.watch_multiple(url, messageHashes, self.extend(request, params), messageHashes, subscriptionArgs)
1407
+
1408
+ def get_message_hash(self, unifiedElementName: str, subChannelName: Str = None, symbol: Str = None):
1409
+ # unifiedElementName can be : orderbook, trade, ticker, bidask ...
1410
+ # subChannelName only applies to channel that needs specific variation(i.e. depth_50, depth_100..) to be selected
1411
+ withSymbol = symbol is not None
1412
+ messageHash = unifiedElementName
1413
+ if not withSymbol:
1414
+ messageHash += 's'
1415
+ else:
1416
+ messageHash += ':' + symbol
1417
+ if subChannelName is not None:
1418
+ messageHash += '#' + subChannelName
1419
+ return messageHash
1420
+
1356
1421
  def handle_error_message(self, client: Client, message):
1357
1422
  #
1358
1423
  # {
@@ -1378,10 +1443,10 @@ class krakenfutures(ccxt.async_support.krakenfutures):
1378
1443
  feed = self.safe_string(message, 'feed')
1379
1444
  methods = {
1380
1445
  'ticker': self.handle_ticker,
1446
+ 'ticker_lite': self.handle_bid_ask,
1381
1447
  'trade': self.handle_trade,
1382
1448
  'trade_snapshot': self.handle_trade,
1383
1449
  # 'heartbeat': self.handleStatus,
1384
- 'ticker_lite': self.handle_ticker,
1385
1450
  'book': self.handle_order_book,
1386
1451
  'book_snapshot': self.handle_order_book_snapshot,
1387
1452
  'open_orders_verbose': self.handle_order,
ccxt/pro/kucoin.py CHANGED
@@ -168,21 +168,41 @@ class kucoin(ccxt.async_support.kucoin):
168
168
 
169
169
  async def watch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
170
170
  """
171
+ :see: https://www.kucoin.com/docs/websocket/spot-trading/public-channels/ticker
171
172
  watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
172
173
  :param str[] symbols: unified symbol of the market to fetch the ticker for
173
174
  :param dict [params]: extra parameters specific to the exchange API endpoint
175
+ :param str [params.method]: either '/market/snapshot' or '/market/ticker' default is '/market/ticker'
174
176
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
175
177
  """
176
178
  await self.load_markets()
177
179
  symbols = self.market_symbols(symbols)
178
180
  messageHash = 'tickers'
181
+ method = None
182
+ method, params = self.handle_option_and_params(params, 'watchTickers', 'method', '/market/ticker')
183
+ messageHashes = []
184
+ topics = []
179
185
  if symbols is not None:
180
- messageHash = 'tickers::' + ','.join(symbols)
186
+ for i in range(0, len(symbols)):
187
+ symbol = symbols[i]
188
+ messageHashes.append('ticker:' + symbol)
189
+ market = self.market(symbol)
190
+ topics.append(method + ':' + market['id'])
181
191
  url = await self.negotiate(False)
182
- topic = '/market/ticker:all'
183
- tickers = await self.subscribe(url, messageHash, topic, params)
184
- if self.newUpdates:
185
- return tickers
192
+ tickers = None
193
+ if symbols is None:
194
+ allTopic = method + ':all'
195
+ tickers = await self.subscribe(url, messageHash, allTopic, params)
196
+ if self.newUpdates:
197
+ return tickers
198
+ else:
199
+ marketIds = self.market_ids(symbols)
200
+ symbolsTopic = method + ':' + ','.join(marketIds)
201
+ tickers = await self.subscribe_multiple(url, messageHashes, symbolsTopic, topics, params)
202
+ if self.newUpdates:
203
+ newDict = {}
204
+ newDict[tickers['symbol']] = tickers
205
+ return newDict
186
206
  return self.filter_by_array(self.tickers, 'symbol', symbols)
187
207
 
188
208
  def handle_ticker(self, client: Client, message):
@@ -262,17 +282,6 @@ class kucoin(ccxt.async_support.kucoin):
262
282
  allTickers = {}
263
283
  allTickers[symbol] = ticker
264
284
  client.resolve(allTickers, 'tickers')
265
- messageHashes = self.find_message_hashes(client, 'tickers::')
266
- for i in range(0, len(messageHashes)):
267
- currentMessageHash = messageHashes[i]
268
- parts = currentMessageHash.split('::')
269
- symbolsString = parts[1]
270
- symbols = symbolsString.split(',')
271
- tickers = self.filter_by_array(self.tickers, 'symbol', symbols)
272
- tickersSymbols = list(tickers.keys())
273
- numTickers = len(tickersSymbols)
274
- if numTickers > 0:
275
- client.resolve(tickers, currentMessageHash)
276
285
 
277
286
  async def watch_bids_asks(self, symbols: Strings = None, params={}) -> Tickers:
278
287
  """
ccxt/pro/okcoin.py CHANGED
@@ -9,8 +9,8 @@ import hashlib
9
9
  from ccxt.base.types import Balances, Int, Order, OrderBook, Str, Ticker, Trade
10
10
  from ccxt.async_support.base.ws.client import Client
11
11
  from typing import List
12
- from ccxt.base.errors import ArgumentsRequired
13
12
  from ccxt.base.errors import AuthenticationError
13
+ from ccxt.base.errors import ArgumentsRequired
14
14
 
15
15
 
16
16
  class okcoin(ccxt.async_support.okcoin):
ccxt/pro/okx.py CHANGED
@@ -9,10 +9,10 @@ import hashlib
9
9
  from ccxt.base.types import Balances, Int, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade
10
10
  from ccxt.async_support.base.ws.client import Client
11
11
  from typing import List
12
+ from ccxt.base.errors import AuthenticationError
12
13
  from ccxt.base.errors import ArgumentsRequired
13
14
  from ccxt.base.errors import BadRequest
14
15
  from ccxt.base.errors import InvalidNonce
15
- from ccxt.base.errors import AuthenticationError
16
16
 
17
17
 
18
18
  class okx(ccxt.async_support.okx):
ccxt/pro/poloniex.py CHANGED
@@ -10,9 +10,9 @@ from ccxt.base.types import Balances, Int, Num, Order, OrderBook, OrderSide, Ord
10
10
  from ccxt.async_support.base.ws.client import Client
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
+ from ccxt.base.errors import AuthenticationError
13
14
  from ccxt.base.errors import BadRequest
14
15
  from ccxt.base.errors import InvalidOrder
15
- from ccxt.base.errors import AuthenticationError
16
16
  from ccxt.base.precise import Precise
17
17
 
18
18
 
@@ -9,8 +9,8 @@ from ccxt.base.types import Balances, Int, Order, OrderBook, Str, Ticker, Trade
9
9
  from ccxt.async_support.base.ws.client import Client
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
- from ccxt.base.errors import BadRequest
13
12
  from ccxt.base.errors import AuthenticationError
13
+ from ccxt.base.errors import BadRequest
14
14
 
15
15
 
16
16
  class poloniexfutures(ccxt.async_support.poloniexfutures):
ccxt/pro/whitebit.py CHANGED
@@ -8,9 +8,9 @@ from ccxt.async_support.base.ws.cache import ArrayCache, ArrayCacheBySymbolById,
8
8
  from ccxt.base.types import Balances, Int, Order, OrderBook, Str, Ticker, Trade
9
9
  from ccxt.async_support.base.ws.client import Client
10
10
  from typing import List
11
+ from ccxt.base.errors import AuthenticationError
11
12
  from ccxt.base.errors import ArgumentsRequired
12
13
  from ccxt.base.errors import BadRequest
13
- from ccxt.base.errors import AuthenticationError
14
14
  from ccxt.base.precise import Precise
15
15
 
16
16
 
ccxt/probit.py CHANGED
@@ -9,6 +9,7 @@ import math
9
9
  from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
+ from ccxt.base.errors import AuthenticationError
12
13
  from ccxt.base.errors import ArgumentsRequired
13
14
  from ccxt.base.errors import BadRequest
14
15
  from ccxt.base.errors import BadSymbol
@@ -19,7 +20,6 @@ from ccxt.base.errors import InvalidOrder
19
20
  from ccxt.base.errors import DDoSProtection
20
21
  from ccxt.base.errors import RateLimitExceeded
21
22
  from ccxt.base.errors import ExchangeNotAvailable
22
- from ccxt.base.errors import AuthenticationError
23
23
  from ccxt.base.decimal_to_precision import TRUNCATE
24
24
  from ccxt.base.decimal_to_precision import TICK_SIZE
25
25
  from ccxt.base.precise import Precise
ccxt/timex.py CHANGED
@@ -8,6 +8,7 @@ from ccxt.abstract.timex import ImplicitAPI
8
8
  from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
+ from ccxt.base.errors import AuthenticationError
11
12
  from ccxt.base.errors import PermissionDenied
12
13
  from ccxt.base.errors import ArgumentsRequired
13
14
  from ccxt.base.errors import BadRequest
@@ -17,7 +18,6 @@ from ccxt.base.errors import OrderNotFound
17
18
  from ccxt.base.errors import NotSupported
18
19
  from ccxt.base.errors import RateLimitExceeded
19
20
  from ccxt.base.errors import ExchangeNotAvailable
20
- from ccxt.base.errors import AuthenticationError
21
21
  from ccxt.base.decimal_to_precision import TICK_SIZE
22
22
  from ccxt.base.precise import Precise
23
23
 
ccxt/tokocrypto.py CHANGED
@@ -10,6 +10,7 @@ import json
10
10
  from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
+ from ccxt.base.errors import AuthenticationError
13
14
  from ccxt.base.errors import PermissionDenied
14
15
  from ccxt.base.errors import AccountSuspended
15
16
  from ccxt.base.errors import ArgumentsRequired
@@ -29,7 +30,6 @@ from ccxt.base.errors import ExchangeNotAvailable
29
30
  from ccxt.base.errors import OnMaintenance
30
31
  from ccxt.base.errors import InvalidNonce
31
32
  from ccxt.base.errors import RequestTimeout
32
- from ccxt.base.errors import AuthenticationError
33
33
  from ccxt.base.decimal_to_precision import TRUNCATE
34
34
  from ccxt.base.decimal_to_precision import DECIMAL_PLACES
35
35
  from ccxt.base.precise import Precise
ccxt/tradeogre.py CHANGED
@@ -8,9 +8,9 @@ from ccxt.abstract.tradeogre import ImplicitAPI
8
8
  from ccxt.base.types import IndexType, Int, Market, Num, Order, OrderSide, OrderType, Str, Ticker
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
+ from ccxt.base.errors import AuthenticationError
11
12
  from ccxt.base.errors import BadRequest
12
13
  from ccxt.base.errors import InsufficientFunds
13
- from ccxt.base.errors import AuthenticationError
14
14
  from ccxt.base.decimal_to_precision import TICK_SIZE
15
15
 
16
16
 
ccxt/upbit.py CHANGED
@@ -8,14 +8,14 @@ from ccxt.abstract.upbit import ImplicitAPI
8
8
  from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
+ from ccxt.base.errors import AuthenticationError
11
12
  from ccxt.base.errors import PermissionDenied
12
13
  from ccxt.base.errors import ArgumentsRequired
13
14
  from ccxt.base.errors import BadRequest
14
15
  from ccxt.base.errors import InsufficientFunds
16
+ from ccxt.base.errors import AddressPending
15
17
  from ccxt.base.errors import InvalidOrder
16
18
  from ccxt.base.errors import OrderNotFound
17
- from ccxt.base.errors import AuthenticationError
18
- from ccxt.base.errors import AddressPending
19
19
  from ccxt.base.decimal_to_precision import TICK_SIZE
20
20
  from ccxt.base.precise import Precise
21
21
 
ccxt/wavesexchange.py CHANGED
@@ -10,6 +10,7 @@ from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBo
10
10
  from typing import List
11
11
  from typing import Any
12
12
  from ccxt.base.errors import ExchangeError
13
+ from ccxt.base.errors import AuthenticationError
13
14
  from ccxt.base.errors import AccountSuspended
14
15
  from ccxt.base.errors import ArgumentsRequired
15
16
  from ccxt.base.errors import BadRequest
@@ -19,7 +20,6 @@ from ccxt.base.errors import InvalidOrder
19
20
  from ccxt.base.errors import OrderNotFound
20
21
  from ccxt.base.errors import DuplicateOrderId
21
22
  from ccxt.base.errors import ExchangeNotAvailable
22
- from ccxt.base.errors import AuthenticationError
23
23
  from ccxt.base.decimal_to_precision import DECIMAL_PLACES
24
24
  from ccxt.base.precise import Precise
25
25
 
ccxt/whitebit.py CHANGED
@@ -9,6 +9,7 @@ import hashlib
9
9
  from ccxt.base.types import Balances, Bool, Currencies, Currency, Int, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
+ from ccxt.base.errors import AuthenticationError
12
13
  from ccxt.base.errors import PermissionDenied
13
14
  from ccxt.base.errors import ArgumentsRequired
14
15
  from ccxt.base.errors import BadRequest
@@ -19,7 +20,6 @@ from ccxt.base.errors import OrderNotFound
19
20
  from ccxt.base.errors import NotSupported
20
21
  from ccxt.base.errors import DDoSProtection
21
22
  from ccxt.base.errors import ExchangeNotAvailable
22
- from ccxt.base.errors import AuthenticationError
23
23
  from ccxt.base.decimal_to_precision import TICK_SIZE
24
24
  from ccxt.base.precise import Precise
25
25