ccxt 4.4.7__py2.py3-none-any.whl → 4.4.9__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 (47) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/bigone.py +1 -1
  3. ccxt/abstract/binance.py +1 -0
  4. ccxt/abstract/binancecoinm.py +1 -0
  5. ccxt/abstract/binanceus.py +1 -0
  6. ccxt/abstract/binanceusdm.py +1 -0
  7. ccxt/abstract/bybit.py +5 -0
  8. ccxt/abstract/kucoinfutures.py +5 -0
  9. ccxt/abstract/okx.py +2 -0
  10. ccxt/async_support/__init__.py +1 -1
  11. ccxt/async_support/base/exchange.py +1 -1
  12. ccxt/async_support/bigone.py +35 -86
  13. ccxt/async_support/binance.py +49 -12
  14. ccxt/async_support/bingx.py +7 -2
  15. ccxt/async_support/bitget.py +3 -0
  16. ccxt/async_support/bybit.py +354 -2
  17. ccxt/async_support/gate.py +30 -1
  18. ccxt/async_support/htx.py +22 -0
  19. ccxt/async_support/kucoin.py +1 -0
  20. ccxt/async_support/kucoinfutures.py +152 -3
  21. ccxt/async_support/okx.py +4 -0
  22. ccxt/base/exchange.py +1 -1
  23. ccxt/bigone.py +35 -86
  24. ccxt/binance.py +49 -12
  25. ccxt/bingx.py +7 -2
  26. ccxt/bitget.py +3 -0
  27. ccxt/bybit.py +354 -2
  28. ccxt/gate.py +30 -1
  29. ccxt/htx.py +22 -0
  30. ccxt/kucoin.py +1 -0
  31. ccxt/kucoinfutures.py +152 -3
  32. ccxt/okx.py +4 -0
  33. ccxt/pro/__init__.py +1 -1
  34. ccxt/pro/binance.py +3 -3
  35. ccxt/pro/bitmart.py +72 -0
  36. ccxt/pro/bitvavo.py +87 -2
  37. ccxt/pro/blofin.py +59 -0
  38. ccxt/pro/hitbtc.py +112 -44
  39. ccxt/pro/hollaex.py +5 -0
  40. ccxt/pro/okx.py +12 -1
  41. ccxt/pro/p2b.py +33 -2
  42. ccxt/pro/whitebit.py +29 -1
  43. {ccxt-4.4.7.dist-info → ccxt-4.4.9.dist-info}/METADATA +4 -4
  44. {ccxt-4.4.7.dist-info → ccxt-4.4.9.dist-info}/RECORD +47 -47
  45. {ccxt-4.4.7.dist-info → ccxt-4.4.9.dist-info}/LICENSE.txt +0 -0
  46. {ccxt-4.4.7.dist-info → ccxt-4.4.9.dist-info}/WHEEL +0 -0
  47. {ccxt-4.4.7.dist-info → ccxt-4.4.9.dist-info}/top_level.txt +0 -0
ccxt/pro/hitbtc.py CHANGED
@@ -22,6 +22,7 @@ class hitbtc(ccxt.async_support.hitbtc):
22
22
  'ws': True,
23
23
  'watchTicker': True,
24
24
  'watchTickers': True,
25
+ 'watchBidsAsks': True,
25
26
  'watchTrades': True,
26
27
  'watchTradesForSymbols': False,
27
28
  'watchOrderBook': True,
@@ -56,8 +57,11 @@ class hitbtc(ccxt.async_support.hitbtc):
56
57
  'watchTickers': {
57
58
  'method': 'ticker/{speed}', # 'ticker/{speed}','ticker/price/{speed}', 'ticker/{speed}/batch', or 'ticker/{speed}/price/batch''
58
59
  },
60
+ 'watchBidsAsks': {
61
+ 'method': 'orderbook/top/{speed}', # 'orderbook/top/{speed}', 'orderbook/top/{speed}/batch'
62
+ },
59
63
  'watchOrderBook': {
60
- 'method': 'orderbook/full', # 'orderbook/full', 'orderbook/{depth}/{speed}', 'orderbook/{depth}/{speed}/batch', 'orderbook/top/{speed}', or 'orderbook/top/{speed}/batch'
64
+ 'method': 'orderbook/full', # 'orderbook/full', 'orderbook/{depth}/{speed}', 'orderbook/{depth}/{speed}/batch'
61
65
  },
62
66
  },
63
67
  'timeframes': {
@@ -130,17 +134,22 @@ class hitbtc(ccxt.async_support.hitbtc):
130
134
  :param dict [params]: extra parameters specific to the hitbtc api
131
135
  """
132
136
  await self.load_markets()
137
+ symbols = self.market_symbols(symbols)
138
+ isBatch = name.find('batch') >= 0
133
139
  url = self.urls['api']['ws']['public']
134
- messageHash = messageHashPrefix
135
- if symbols is not None:
136
- messageHash = messageHash + '::' + ','.join(symbols)
140
+ messageHashes = []
141
+ if symbols is not None and not isBatch:
142
+ for i in range(0, len(symbols)):
143
+ messageHashes.append(messageHashPrefix + '::' + symbols[i])
144
+ else:
145
+ messageHashes.append(messageHashPrefix)
137
146
  subscribe: dict = {
138
147
  'method': 'subscribe',
139
148
  'id': self.nonce(),
140
149
  'ch': name,
141
150
  }
142
151
  request = self.extend(subscribe, params)
143
- return await self.watch(url, messageHash, request, messageHash)
152
+ return await self.watch_multiple(url, messageHashes, request, messageHashes)
144
153
 
145
154
  async def subscribe_private(self, name: str, symbol: Str = None, params={}):
146
155
  """
@@ -192,7 +201,7 @@ class hitbtc(ccxt.async_support.hitbtc):
192
201
  :param str symbol: unified symbol of the market to fetch the order book for
193
202
  :param int [limit]: the maximum amount of order book entries to return
194
203
  :param dict [params]: extra parameters specific to the exchange API endpoint
195
- :param str [params.method]: 'orderbook/full', 'orderbook/{depth}/{speed}', 'orderbook/{depth}/{speed}/batch', 'orderbook/top/{speed}', or 'orderbook/top/{speed}/batch'
204
+ :param str [params.method]: 'orderbook/full', 'orderbook/{depth}/{speed}', 'orderbook/{depth}/{speed}/batch'
196
205
  :param int [params.depth]: 5 , 10, or 20(default)
197
206
  :param int [params.speed]: 100(default), 500, or 1000
198
207
  :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
@@ -206,10 +215,6 @@ class hitbtc(ccxt.async_support.hitbtc):
206
215
  name = 'orderbook/D' + depth + '/' + speed + 'ms'
207
216
  elif name == 'orderbook/{depth}/{speed}/batch':
208
217
  name = 'orderbook/D' + depth + '/' + speed + 'ms/batch'
209
- elif name == 'orderbook/top/{speed}':
210
- name = 'orderbook/top/' + speed + 'ms'
211
- elif name == 'orderbook/top/{speed}/batch':
212
- name = 'orderbook/top/' + speed + 'ms/batch'
213
218
  market = self.market(symbol)
214
219
  request: dict = {
215
220
  'params': {
@@ -298,33 +303,22 @@ class hitbtc(ccxt.async_support.hitbtc):
298
303
  :param str [params.speed]: '1s'(default), or '3s'
299
304
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
300
305
  """
301
- options = self.safe_value(self.options, 'watchTicker')
302
- defaultMethod = self.safe_string(options, 'method', 'ticker/{speed}')
303
- method = self.safe_string_2(params, 'method', 'defaultMethod', defaultMethod)
304
- speed = self.safe_string(params, 'speed', '1s')
305
- name = self.implode_params(method, {'speed': speed})
306
- params = self.omit(params, ['method', 'speed'])
307
- market = self.market(symbol)
308
- request: dict = {
309
- 'params': {
310
- 'symbols': [market['id']],
311
- },
312
- }
313
- result = await self.subscribe_public(name, 'tickers', [symbol], self.deep_extend(request, params))
314
- return self.safe_value(result, symbol)
306
+ ticker = await self.watch_tickers([symbol], params)
307
+ return self.safe_value(ticker, symbol)
315
308
 
316
309
  async def watch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
317
310
  """
318
311
  watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
319
312
  :param str symbol: unified symbol of the market to fetch the ticker for
320
313
  :param dict params: extra parameters specific to the exchange API endpoint
321
- :param str params['method']: 'ticker/{speed}'(default),'ticker/price/{speed}', 'ticker/{speed}/batch', or 'ticker/{speed}/price/batch''
314
+ :param str params['method']: 'ticker/{speed}' ,'ticker/price/{speed}', 'ticker/{speed}/batch'(default), or 'ticker/{speed}/price/batch''
322
315
  :param str params['speed']: '1s'(default), or '3s'
323
316
  :returns dict: a `ticker structure <https://docs.ccxt.com/en/latest/manual.html#ticker-structure>`
324
317
  """
325
318
  await self.load_markets()
319
+ symbols = self.market_symbols(symbols)
326
320
  options = self.safe_value(self.options, 'watchTicker')
327
- defaultMethod = self.safe_string(options, 'method', 'ticker/{speed}')
321
+ defaultMethod = self.safe_string(options, 'method', 'ticker/{speed}/batch')
328
322
  method = self.safe_string_2(params, 'method', 'defaultMethod', defaultMethod)
329
323
  speed = self.safe_string(params, 'speed', '1s')
330
324
  name = self.implode_params(method, {'speed': speed})
@@ -341,10 +335,13 @@ class hitbtc(ccxt.async_support.hitbtc):
341
335
  'symbols': marketIds,
342
336
  },
343
337
  }
344
- tickers = await self.subscribe_public(name, 'tickers', symbols, self.deep_extend(request, params))
338
+ newTickers = await self.subscribe_public(name, 'tickers', symbols, self.deep_extend(request, params))
345
339
  if self.newUpdates:
346
- return tickers
347
- return self.filter_by_array(self.tickers, 'symbol', symbols)
340
+ if not isinstance(newTickers, list):
341
+ tickers: dict = {}
342
+ tickers[newTickers['symbol']] = newTickers
343
+ return tickers
344
+ return self.filter_by_array(newTickers, 'symbol', symbols)
348
345
 
349
346
  def handle_ticker(self, client: Client, message):
350
347
  #
@@ -387,27 +384,18 @@ class hitbtc(ccxt.async_support.hitbtc):
387
384
  #
388
385
  data = self.safe_value(message, 'data', {})
389
386
  marketIds = list(data.keys())
390
- newTickers: dict = {}
387
+ result = []
388
+ topic = 'tickers'
391
389
  for i in range(0, len(marketIds)):
392
390
  marketId = marketIds[i]
393
391
  market = self.safe_market(marketId)
394
392
  symbol = market['symbol']
395
393
  ticker = self.parse_ws_ticker(data[marketId], market)
396
394
  self.tickers[symbol] = ticker
397
- newTickers[symbol] = ticker
398
- client.resolve(newTickers, 'tickers')
399
- messageHashes = self.find_message_hashes(client, 'tickers::')
400
- for i in range(0, len(messageHashes)):
401
- messageHash = messageHashes[i]
402
- parts = messageHash.split('::')
403
- symbolsString = parts[1]
404
- symbols = symbolsString.split(',')
405
- tickers = self.filter_by_array(newTickers, 'symbol', symbols)
406
- tickersSymbols = list(tickers.keys())
407
- numTickers = len(tickersSymbols)
408
- if numTickers > 0:
409
- client.resolve(tickers, messageHash)
410
- return message
395
+ result.append(ticker)
396
+ messageHash = topic + '::' + symbol
397
+ client.resolve(ticker, messageHash)
398
+ client.resolve(result, topic)
411
399
 
412
400
  def parse_ws_ticker(self, ticker, market=None):
413
401
  #
@@ -464,6 +452,81 @@ class hitbtc(ccxt.async_support.hitbtc):
464
452
  'info': ticker,
465
453
  }, market)
466
454
 
455
+ async def watch_bids_asks(self, symbols: Strings = None, params={}) -> Tickers:
456
+ """
457
+ watches best bid & ask for symbols
458
+ :see: https://api.hitbtc.com/#subscribe-to-top-of-book
459
+ :param str[] symbols: unified symbol of the market to fetch the ticker for
460
+ :param dict [params]: extra parameters specific to the exchange API endpoint
461
+ :param str [params.method]: 'orderbook/top/{speed}' or 'orderbook/top/{speed}/batch(default)'
462
+ :param str [params.speed]: '100ms'(default) or '500ms' or '1000ms'
463
+ :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
464
+ """
465
+ await self.load_markets()
466
+ symbols = self.market_symbols(symbols, None, False)
467
+ options = self.safe_value(self.options, 'watchBidsAsks')
468
+ defaultMethod = self.safe_string(options, 'method', 'orderbook/top/{speed}/batch')
469
+ method = self.safe_string_2(params, 'method', 'defaultMethod', defaultMethod)
470
+ speed = self.safe_string(params, 'speed', '100ms')
471
+ name = self.implode_params(method, {'speed': speed})
472
+ params = self.omit(params, ['method', 'speed'])
473
+ marketIds = self.market_ids(symbols)
474
+ request: dict = {
475
+ 'params': {
476
+ 'symbols': marketIds,
477
+ },
478
+ }
479
+ newTickers = await self.subscribe_public(name, 'bidask', symbols, self.deep_extend(request, params))
480
+ if self.newUpdates:
481
+ if not isinstance(newTickers, list):
482
+ tickers: dict = {}
483
+ tickers[newTickers['symbol']] = newTickers
484
+ return tickers
485
+ return self.filter_by_array(newTickers, 'symbol', symbols)
486
+
487
+ def handle_bid_ask(self, client: Client, message):
488
+ #
489
+ # {
490
+ # "ch": "orderbook/top/100ms", # or 'orderbook/top/100ms/batch'
491
+ # "data": {
492
+ # "BTCUSDT": {
493
+ # "t": 1727276919771,
494
+ # "a": "63931.45",
495
+ # "A": "0.02879",
496
+ # "b": "63926.97",
497
+ # "B": "0.00100"
498
+ # }
499
+ # }
500
+ # }
501
+ #
502
+ data = self.safe_dict(message, 'data', {})
503
+ marketIds = list(data.keys())
504
+ result = []
505
+ topic = 'bidask'
506
+ for i in range(0, len(marketIds)):
507
+ marketId = marketIds[i]
508
+ market = self.safe_market(marketId)
509
+ symbol = market['symbol']
510
+ ticker = self.parse_ws_bid_ask(data[marketId], market)
511
+ self.bidsasks[symbol] = ticker
512
+ result.append(ticker)
513
+ messageHash = topic + '::' + symbol
514
+ client.resolve(ticker, messageHash)
515
+ client.resolve(result, topic)
516
+
517
+ def parse_ws_bid_ask(self, ticker, market=None):
518
+ timestamp = self.safe_integer(ticker, 't')
519
+ return self.safe_ticker({
520
+ 'symbol': market['symbol'],
521
+ 'timestamp': timestamp,
522
+ 'datetime': self.iso8601(timestamp),
523
+ 'ask': self.safe_string(ticker, 'a'),
524
+ 'askVolume': self.safe_string(ticker, 'A'),
525
+ 'bid': self.safe_string(ticker, 'b'),
526
+ 'bidVolume': self.safe_string(ticker, 'B'),
527
+ 'info': ticker,
528
+ }, market)
529
+
467
530
  async def watch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
468
531
  """
469
532
  get the list of most recent trades for a particular symbol
@@ -1144,11 +1207,16 @@ class hitbtc(ccxt.async_support.hitbtc):
1144
1207
  if channel is not None:
1145
1208
  splitChannel = channel.split('/')
1146
1209
  channel = self.safe_string(splitChannel, 0)
1210
+ if channel == 'orderbook':
1211
+ channel2 = self.safe_string(splitChannel, 1)
1212
+ if channel2 is not None and channel2 == 'top':
1213
+ channel = 'orderbook/top'
1147
1214
  methods: dict = {
1148
1215
  'candles': self.handle_ohlcv,
1149
1216
  'ticker': self.handle_ticker,
1150
1217
  'trades': self.handle_trades,
1151
1218
  'orderbook': self.handle_order_book,
1219
+ 'orderbook/top': self.handle_bid_ask,
1152
1220
  'spot_order': self.handle_order,
1153
1221
  'spot_orders': self.handle_order,
1154
1222
  'margin_order': self.handle_order,
ccxt/pro/hollaex.py CHANGED
@@ -62,6 +62,7 @@ class hollaex(ccxt.async_support.hollaex):
62
62
  async def watch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
63
63
  """
64
64
  watches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
65
+ :see: https://apidocs.hollaex.com/#sending-receiving-messages
65
66
  :param str symbol: unified symbol of the market to fetch the order book for
66
67
  :param int [limit]: the maximum amount of order book entries to return
67
68
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -116,6 +117,7 @@ class hollaex(ccxt.async_support.hollaex):
116
117
  async def watch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
117
118
  """
118
119
  get the list of most recent trades for a particular symbol
120
+ :see: https://apidocs.hollaex.com/#sending-receiving-messages
119
121
  :param str symbol: unified symbol of the market to fetch trades for
120
122
  :param int [since]: timestamp in ms of the earliest trade to fetch
121
123
  :param int [limit]: the maximum amount of trades to fetch
@@ -167,6 +169,7 @@ class hollaex(ccxt.async_support.hollaex):
167
169
  async def watch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
168
170
  """
169
171
  watches information on multiple trades made by the user
172
+ :see: https://apidocs.hollaex.com/#sending-receiving-messages
170
173
  :param str symbol: unified market symbol of the market trades were made in
171
174
  :param int [since]: the earliest time in ms to fetch trades for
172
175
  :param int [limit]: the maximum number of trade structures to retrieve
@@ -239,6 +242,7 @@ class hollaex(ccxt.async_support.hollaex):
239
242
  async def watch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
240
243
  """
241
244
  watches information on multiple orders made by the user
245
+ :see: https://apidocs.hollaex.com/#sending-receiving-messages
242
246
  :param str symbol: unified market symbol of the market orders were made in
243
247
  :param int [since]: the earliest time in ms to fetch orders for
244
248
  :param int [limit]: the maximum number of order structures to retrieve
@@ -350,6 +354,7 @@ class hollaex(ccxt.async_support.hollaex):
350
354
  async def watch_balance(self, params={}) -> Balances:
351
355
  """
352
356
  watch balance and get the amount of funds available for trading or funds locked in orders
357
+ :see: https://apidocs.hollaex.com/#sending-receiving-messages
353
358
  :param dict [params]: extra parameters specific to the exchange API endpoint
354
359
  :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
355
360
  """
ccxt/pro/okx.py CHANGED
@@ -2055,10 +2055,21 @@ class okx(ccxt.async_support.okx):
2055
2055
  try:
2056
2056
  if errorCode and errorCode != '0':
2057
2057
  feedback = self.id + ' ' + self.json(message)
2058
- self.throw_exactly_matched_exception(self.exceptions['exact'], errorCode, feedback)
2058
+ if errorCode != '1':
2059
+ self.throw_exactly_matched_exception(self.exceptions['exact'], errorCode, feedback)
2059
2060
  messageString = self.safe_value(message, 'msg')
2060
2061
  if messageString is not None:
2061
2062
  self.throw_broadly_matched_exception(self.exceptions['broad'], messageString, feedback)
2063
+ else:
2064
+ data = self.safe_list(message, 'data', [])
2065
+ for i in range(0, len(data)):
2066
+ d = data[i]
2067
+ errorCode = self.safe_string(d, 'sCode')
2068
+ if errorCode is not None:
2069
+ self.throw_exactly_matched_exception(self.exceptions['exact'], errorCode, feedback)
2070
+ messageString = self.safe_value(message, 'sMsg')
2071
+ if messageString is not None:
2072
+ self.throw_broadly_matched_exception(self.exceptions['broad'], messageString, feedback)
2062
2073
  raise ExchangeError(feedback)
2063
2074
  except Exception as e:
2064
2075
  # if the message contains an id, it means it is a response to a request
ccxt/pro/p2b.py CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  import ccxt.async_support
7
7
  from ccxt.async_support.base.ws.cache import ArrayCache, ArrayCacheByTimestamp
8
- from ccxt.base.types import Int, OrderBook, Ticker, Trade
8
+ from ccxt.base.types import Int, OrderBook, Strings, Ticker, Tickers, 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
@@ -34,7 +34,7 @@ class p2b(ccxt.async_support.p2b):
34
34
  'watchOrders': False,
35
35
  # 'watchStatus': True,
36
36
  'watchTicker': True,
37
- 'watchTickers': False, # in the docs but does not return anything when subscribed to
37
+ 'watchTickers': True,
38
38
  'watchTrades': True,
39
39
  'watchTradesForSymbols': True,
40
40
  },
@@ -133,6 +133,36 @@ class p2b(ccxt.async_support.p2b):
133
133
  messageHash = name + '::' + market['symbol']
134
134
  return await self.subscribe(name + '.subscribe', messageHash, request, params)
135
135
 
136
+ async def watch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
137
+ """
138
+ :see: https://github.com/P2B-team/P2B-WSS-Public/blob/main/wss_documentation.md#last-price
139
+ :see: https://github.com/P2B-team/P2B-WSS-Public/blob/main/wss_documentation.md#market-status
140
+ watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
141
+ :param str[] [symbols]: unified symbol of the market to fetch the ticker for
142
+ :param dict [params]: extra parameters specific to the exchange API endpoint
143
+ :param dict [params.method]: 'state'(default) or 'price'
144
+ :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
145
+ """
146
+ await self.load_markets()
147
+ symbols = self.market_symbols(symbols, None, False)
148
+ watchTickerOptions = self.safe_dict(self.options, 'watchTicker')
149
+ name = self.safe_string(watchTickerOptions, 'name', 'state') # or price
150
+ name, params = self.handle_option_and_params(params, 'method', 'name', name)
151
+ messageHashes = []
152
+ args = []
153
+ for i in range(0, len(symbols)):
154
+ market = self.market(symbols[i])
155
+ messageHashes.append(name + '::' + market['symbol'])
156
+ args.append(market['id'])
157
+ url = self.urls['api']['ws']
158
+ request: dict = {
159
+ 'method': name + '.subscribe',
160
+ 'params': args,
161
+ 'id': self.milliseconds(),
162
+ }
163
+ await self.watch_multiple(url, messageHashes, self.extend(request, params), messageHashes)
164
+ return self.filter_by_array(self.tickers, 'symbol', symbols)
165
+
136
166
  async def watch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
137
167
  """
138
168
  get the list of most recent trades for a particular symbol
@@ -332,6 +362,7 @@ class p2b(ccxt.async_support.p2b):
332
362
  else:
333
363
  ticker = self.parse_ticker(tickerData, market)
334
364
  symbol = ticker['symbol']
365
+ self.tickers[symbol] = ticker
335
366
  messageHash = messageHashStart + '::' + symbol
336
367
  client.resolve(ticker, messageHash)
337
368
  return message
ccxt/pro/whitebit.py CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  import ccxt.async_support
7
7
  from ccxt.async_support.base.ws.cache import ArrayCache, ArrayCacheBySymbolById, ArrayCacheByTimestamp
8
- from ccxt.base.types import Balances, Int, Order, OrderBook, Str, Ticker, Trade
8
+ from ccxt.base.types import Balances, Int, Order, OrderBook, Str, Strings, Ticker, Tickers, 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 AuthenticationError
@@ -26,6 +26,7 @@ class whitebit(ccxt.async_support.whitebit):
26
26
  'watchOrderBook': True,
27
27
  'watchOrders': True,
28
28
  'watchTicker': True,
29
+ 'watchTickers': True,
29
30
  'watchTrades': True,
30
31
  'watchTradesForSymbols': False,
31
32
  },
@@ -249,6 +250,33 @@ class whitebit(ccxt.async_support.whitebit):
249
250
  # every time we want to subscribe to another market we have to "re-subscribe" sending it all again
250
251
  return await self.watch_multiple_subscription(messageHash, method, symbol, False, params)
251
252
 
253
+ async def watch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
254
+ """
255
+ watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
256
+ :see: https://docs.whitebit.com/public/websocket/#market-statistics
257
+ :param str[] [symbols]: unified symbol of the market to fetch the ticker for
258
+ :param dict [params]: extra parameters specific to the exchange API endpoint
259
+ :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
260
+ """
261
+ await self.load_markets()
262
+ symbols = self.market_symbols(symbols, None, False)
263
+ method = 'market_subscribe'
264
+ url = self.urls['api']['ws']
265
+ id = self.nonce()
266
+ messageHashes = []
267
+ args = []
268
+ for i in range(0, len(symbols)):
269
+ market = self.market(symbols[i])
270
+ messageHashes.append('ticker:' + market['symbol'])
271
+ args.append(market['id'])
272
+ request: dict = {
273
+ 'id': id,
274
+ 'method': method,
275
+ 'params': args,
276
+ }
277
+ await self.watch_multiple(url, messageHashes, self.extend(request, params), messageHashes)
278
+ return self.filter_by_array(self.tickers, 'symbol', symbols)
279
+
252
280
  def handle_ticker(self, client: Client, message):
253
281
  #
254
282
  # {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ccxt
3
- Version: 4.4.7
3
+ Version: 4.4.9
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
@@ -272,13 +272,13 @@ console.log(version, Object.keys(exchanges));
272
272
 
273
273
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
274
274
 
275
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.4.7/dist/ccxt.browser.min.js
276
- * unpkg: https://unpkg.com/ccxt@4.4.7/dist/ccxt.browser.min.js
275
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.4.9/dist/ccxt.browser.min.js
276
+ * unpkg: https://unpkg.com/ccxt@4.4.9/dist/ccxt.browser.min.js
277
277
 
278
278
  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.
279
279
 
280
280
  ```HTML
281
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.4.7/dist/ccxt.browser.min.js"></script>
281
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.4.9/dist/ccxt.browser.min.js"></script>
282
282
  ```
283
283
 
284
284
  Creates a global `ccxt` object: