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/lbank.py CHANGED
@@ -483,7 +483,7 @@ class lbank(ccxt.async_support.lbank):
483
483
 
484
484
  async def watch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
485
485
  """
486
- :see: https://github.com/LBank-exchange/lbank-official-api-docs/blob/master/API-For-Spot-EN/WebSocket%20API(Asset%20%26%20Order).md#websocketsubscribeunsubscribe
486
+ :see: https://www.lbank.com/en-US/docs/index.html#update-subscribed-orders
487
487
  get the list of trades associated with the user
488
488
  :param str [symbol]: unified symbol of the market to fetch trades for
489
489
  :param int [since]: timestamp in ms of the earliest trade to fetch
@@ -666,7 +666,6 @@ class lbank(ccxt.async_support.lbank):
666
666
  async def watch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
667
667
  """
668
668
  :see: https://www.lbank.com/en-US/docs/index.html#market-depth
669
- :see: https://www.lbank.com/en-US/docs/index.html#market-increment-depth
670
669
  watches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
671
670
  :param str symbol: unified symbol of the market to fetch the order book for
672
671
  :param int|None limit: the maximum amount of order book entries to return
ccxt/pro/okx.py CHANGED
@@ -9,12 +9,14 @@ import hashlib
9
9
  from ccxt.base.types import Balances, Int, Liquidation, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade
10
10
  from ccxt.async_support.base.ws.client import Client
11
11
  from typing import List
12
+ from typing import Any
12
13
  from ccxt.base.errors import ExchangeError
13
14
  from ccxt.base.errors import AuthenticationError
14
15
  from ccxt.base.errors import ArgumentsRequired
15
16
  from ccxt.base.errors import BadRequest
16
17
  from ccxt.base.errors import InvalidNonce
17
18
  from ccxt.base.errors import ChecksumError
19
+ from ccxt.base.errors import UnsubscribeError
18
20
 
19
21
 
20
22
  class okx(ccxt.async_support.okx):
@@ -216,6 +218,43 @@ class okx(ccxt.async_support.okx):
216
218
  limit = trades.getLimit(tradeSymbol, limit)
217
219
  return self.filter_by_since_limit(trades, since, limit, 'timestamp', True)
218
220
 
221
+ async def un_watch_trades_for_symbols(self, symbols: List[str], params={}) -> Any:
222
+ """
223
+ unWatches from the stream channel
224
+ :param str symbol: unified symbol of the market to fetch trades for
225
+ :param dict [params]: extra parameters specific to the exchange API endpoint
226
+ :returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
227
+ """
228
+ await self.load_markets()
229
+ symbols = self.market_symbols(symbols, None, False)
230
+ channel = 'trades'
231
+ topics = []
232
+ messageHashes = []
233
+ for i in range(0, len(symbols)):
234
+ symbol = symbols[i]
235
+ messageHashes.append('unsubscribe:trades:' + symbol)
236
+ marketId = self.market_id(symbol)
237
+ topic: dict = {
238
+ 'channel': channel,
239
+ 'instId': marketId,
240
+ }
241
+ topics.append(topic)
242
+ request: dict = {
243
+ 'op': 'unsubscribe',
244
+ 'args': topics,
245
+ }
246
+ url = self.get_url(channel, 'public')
247
+ return await self.watch_multiple(url, messageHashes, request, messageHashes)
248
+
249
+ async def un_watch_trades(self, symbol: str, params={}) -> Any:
250
+ """
251
+ unWatches from the stream channel
252
+ :param str symbol: unified symbol of the market to fetch trades for
253
+ :param dict [params]: extra parameters specific to the exchange API endpoint
254
+ :returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
255
+ """
256
+ return await self.un_watch_trades_for_symbols([symbol], params)
257
+
219
258
  def handle_trades(self, client: Client, message):
220
259
  #
221
260
  # {
@@ -349,8 +388,8 @@ class okx(ccxt.async_support.okx):
349
388
  :param str [params.channel]: the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers
350
389
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
351
390
  """
352
- if self.is_empty(symbols):
353
- raise ArgumentsRequired(self.id + ' watchTickers requires a list of symbols')
391
+ await self.load_markets()
392
+ symbols = self.market_symbols(symbols, None, False)
354
393
  channel = None
355
394
  channel, params = self.handle_option_and_params(params, 'watchTickers', 'channel', 'tickers')
356
395
  newTickers = await self.subscribe_multiple('public', channel, symbols, params)
@@ -834,6 +873,62 @@ class okx(ccxt.async_support.okx):
834
873
  orderbook = await self.watch_multiple(url, messageHashes, request, messageHashes)
835
874
  return orderbook.limit()
836
875
 
876
+ async def un_watch_order_book_for_symbols(self, symbols: List[str], params={}) -> Any:
877
+ """
878
+ :see: https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-order-book-channel
879
+ unWatches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
880
+ :param str[] symbols: unified array of symbols
881
+ :param dict [params]: extra parameters specific to the exchange API endpoint
882
+ :param int [params.limit]: the maximum amount of order book entries to return
883
+ :param str [params.depth]: okx order book depth, can be books, books5, books-l2-tbt, books50-l2-tbt, bbo-tbt
884
+ :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
885
+ """
886
+ await self.load_markets()
887
+ symbols = self.market_symbols(symbols, None, False)
888
+ depth = None
889
+ depth, params = self.handle_option_and_params(params, 'watchOrderBook', 'depth', 'books')
890
+ limit = self.safe_integer(params, 'limit')
891
+ if limit is not None:
892
+ if limit == 1:
893
+ depth = 'bbo-tbt'
894
+ elif limit > 1 and limit <= 5:
895
+ depth = 'books5'
896
+ elif limit == 50:
897
+ depth = 'books50-l2-tbt' # Make sure you have VIP4 and above
898
+ elif limit == 400:
899
+ depth = 'books'
900
+ topics = []
901
+ subMessageHashes = []
902
+ messageHashes = []
903
+ for i in range(0, len(symbols)):
904
+ symbol = symbols[i]
905
+ subMessageHashes.append(depth + ':' + symbol)
906
+ messageHashes.append('unsubscribe:orderbook:' + symbol)
907
+ marketId = self.market_id(symbol)
908
+ topic: dict = {
909
+ 'channel': depth,
910
+ 'instId': marketId,
911
+ }
912
+ topics.append(topic)
913
+ request: dict = {
914
+ 'op': 'unsubscribe',
915
+ 'args': topics,
916
+ }
917
+ url = self.get_url(depth, 'public')
918
+ return await self.watch_multiple(url, messageHashes, request, messageHashes)
919
+
920
+ async def un_watch_order_book(self, symbol: str, params={}) -> Any:
921
+ """
922
+ :see: https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-order-book-channel
923
+ unWatches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
924
+ :param str symbol: unified array of symbols
925
+ :param dict [params]: extra parameters specific to the exchange API endpoint
926
+ :param int [params.limit]: the maximum amount of order book entries to return
927
+ :param str [params.depth]: okx order book depth, can be books, books5, books-l2-tbt, books50-l2-tbt, bbo-tbt
928
+ :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
929
+ """
930
+ return await self.un_watch_order_book_for_symbols([symbol], params)
931
+
837
932
  def handle_delta(self, bookside, delta):
838
933
  #
839
934
  # [
@@ -1848,6 +1943,7 @@ class okx(ccxt.async_support.okx):
1848
1943
  # 'book': 'handleOrderBook',
1849
1944
  'login': self.handle_authenticate,
1850
1945
  'subscribe': self.handle_subscription_status,
1946
+ 'unsubscribe': self.handle_unsubscription,
1851
1947
  'order': self.handle_place_orders,
1852
1948
  'batch-orders': self.handle_place_orders,
1853
1949
  'amend-order': self.handle_place_orders,
@@ -1887,3 +1983,47 @@ class okx(ccxt.async_support.okx):
1887
1983
  self.handle_ohlcv(client, message)
1888
1984
  else:
1889
1985
  method(client, message)
1986
+
1987
+ def handle_un_subscription_trades(self, client: Client, symbol: str):
1988
+ subMessageHash = 'trades:' + symbol
1989
+ messageHash = 'unsubscribe:trades:' + symbol
1990
+ if subMessageHash in client.subscriptions:
1991
+ del client.subscriptions[subMessageHash]
1992
+ if messageHash in client.subscriptions:
1993
+ del client.subscriptions[messageHash]
1994
+ del self.trades[symbol]
1995
+ error = UnsubscribeError(self.id + ' ' + subMessageHash)
1996
+ client.reject(error, subMessageHash)
1997
+ client.resolve(True, messageHash)
1998
+
1999
+ def handle_unsubscription_order_book(self, client: Client, symbol: str, channel: str):
2000
+ subMessageHash = channel + ':' + symbol
2001
+ messageHash = 'unsubscribe:orderbook:' + symbol
2002
+ if subMessageHash in client.subscriptions:
2003
+ del client.subscriptions[subMessageHash]
2004
+ if messageHash in client.subscriptions:
2005
+ del client.subscriptions[messageHash]
2006
+ del self.orderbooks[symbol]
2007
+ error = UnsubscribeError(self.id + ' ' + subMessageHash)
2008
+ client.reject(error, subMessageHash)
2009
+ client.resolve(True, messageHash)
2010
+
2011
+ def handle_unsubscription(self, client: Client, message):
2012
+ #
2013
+ # {
2014
+ # "event": "unsubscribe",
2015
+ # "arg": {
2016
+ # "channel": "tickers",
2017
+ # "instId": "LTC-USD-200327"
2018
+ # },
2019
+ # "connId": "a4d3ae55"
2020
+ # }
2021
+ # arg might be an array or list
2022
+ arg = self.safe_dict(message, 'arg', {})
2023
+ channel = self.safe_string(arg, 'channel')
2024
+ marketId = self.safe_string(arg, 'instId')
2025
+ symbol = self.safe_symbol(marketId)
2026
+ if channel == 'trades':
2027
+ self.handle_un_subscription_trades(client, symbol)
2028
+ elif channel.startswith('bbo') or channel.startswith('book'):
2029
+ self.handle_unsubscription_order_book(client, symbol, channel)
ccxt/probit.py CHANGED
@@ -1028,6 +1028,7 @@ class probit(Exchange, ImplicitAPI):
1028
1028
  """
1029
1029
  :see: https://docs-en.probit.com/reference/order-3
1030
1030
  fetches information on an order made by the user
1031
+ :param str id: the order id
1031
1032
  :param str symbol: unified symbol of the market the order was made in
1032
1033
  :param dict [params]: extra parameters specific to the exchange API endpoint
1033
1034
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
ccxt/vertex.py CHANGED
@@ -1886,6 +1886,7 @@ class vertex(Exchange, ImplicitAPI):
1886
1886
  """
1887
1887
  fetches information on an order made by the user
1888
1888
  :see: https://docs.vertexprotocol.com/developer-resources/api/gateway/queries/order
1889
+ :param str id: the order id
1889
1890
  :param str symbol: unified symbol of the market the order was made in
1890
1891
  :param dict [params]: extra parameters specific to the exchange API endpoint
1891
1892
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
ccxt/whitebit.py CHANGED
@@ -2472,9 +2472,11 @@ class whitebit(Exchange, ImplicitAPI):
2472
2472
  if hasErrorStatus:
2473
2473
  errorInfo = status
2474
2474
  else:
2475
- errorObject = self.safe_value(response, 'errors')
2476
- if errorObject is not None:
2477
- errorKey = list(errorObject.keys())[0]
2475
+ errorObject = self.safe_dict(response, 'errors', {})
2476
+ errorKeys = list(errorObject.keys())
2477
+ errorsLength = len(errorKeys)
2478
+ if errorsLength > 0:
2479
+ errorKey = errorKeys[0]
2478
2480
  errorMessageArray = self.safe_value(errorObject, errorKey, [])
2479
2481
  errorMessageLength = len(errorMessageArray)
2480
2482
  errorInfo = errorMessageArray[0] if (errorMessageLength > 0) else body
ccxt/woo.py CHANGED
@@ -1276,6 +1276,7 @@ class woo(Exchange, ImplicitAPI):
1276
1276
  :see: https://docs.woo.org/#get-algo-order
1277
1277
  :see: https://docs.woo.org/#get-order
1278
1278
  fetches information on an order made by the user
1279
+ :param str id: the order id
1279
1280
  :param str symbol: unified symbol of the market the order was made in
1280
1281
  :param dict [params]: extra parameters specific to the exchange API endpoint
1281
1282
  :param boolean [params.stop]: whether the order is a stop/algo order
ccxt/woofipro.py CHANGED
@@ -1619,6 +1619,7 @@ class woofipro(Exchange, ImplicitAPI):
1619
1619
  :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-order-by-order_id
1620
1620
  :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-order-by-client_order_id
1621
1621
  fetches information on an order made by the user
1622
+ :param str id: the order id
1622
1623
  :param str symbol: unified symbol of the market the order was made in
1623
1624
  :param dict [params]: extra parameters specific to the exchange API endpoint
1624
1625
  :param boolean [params.trigger]: whether the order is a stop/algo order
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ccxt
3
- Version: 4.3.88
3
+ Version: 4.3.90
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.3.88/dist/ccxt.browser.min.js
276
- * unpkg: https://unpkg.com/ccxt@4.3.88/dist/ccxt.browser.min.js
275
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.90/dist/ccxt.browser.min.js
276
+ * unpkg: https://unpkg.com/ccxt@4.3.90/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.3.88/dist/ccxt.browser.min.js"></script>
281
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.90/dist/ccxt.browser.min.js"></script>
282
282
  ```
283
283
 
284
284
  Creates a global `ccxt` object: