ccxt 4.3.18__py2.py3-none-any.whl → 4.3.20__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 (195) hide show
  1. ccxt/__init__.py +3 -1
  2. ccxt/abstract/bitget.py +3 -0
  3. ccxt/abstract/bybit.py +1 -0
  4. ccxt/abstract/okx.py +1 -0
  5. ccxt/abstract/woofipro.py +119 -0
  6. ccxt/ace.py +1 -1
  7. ccxt/ascendex.py +7 -8
  8. ccxt/async_support/__init__.py +3 -1
  9. ccxt/async_support/ace.py +1 -1
  10. ccxt/async_support/ascendex.py +7 -8
  11. ccxt/async_support/base/exchange.py +25 -2
  12. ccxt/async_support/bigone.py +4 -4
  13. ccxt/async_support/binance.py +9 -9
  14. ccxt/async_support/bingx.py +4 -4
  15. ccxt/async_support/bit2c.py +1 -1
  16. ccxt/async_support/bitbank.py +1 -1
  17. ccxt/async_support/bitbns.py +1 -1
  18. ccxt/async_support/bitfinex.py +28 -4
  19. ccxt/async_support/bitfinex2.py +62 -54
  20. ccxt/async_support/bitflyer.py +1 -1
  21. ccxt/async_support/bitget.py +11 -11
  22. ccxt/async_support/bithumb.py +1 -1
  23. ccxt/async_support/bitmart.py +8 -8
  24. ccxt/async_support/bitmex.py +2 -2
  25. ccxt/async_support/bitopro.py +1 -1
  26. ccxt/async_support/bitrue.py +3 -3
  27. ccxt/async_support/bitso.py +1 -1
  28. ccxt/async_support/bitstamp.py +3 -5
  29. ccxt/async_support/bitteam.py +1 -1
  30. ccxt/async_support/bitvavo.py +1 -1
  31. ccxt/async_support/bl3p.py +1 -1
  32. ccxt/async_support/blockchaincom.py +1 -1
  33. ccxt/async_support/blofin.py +3 -3
  34. ccxt/async_support/btcalpha.py +1 -1
  35. ccxt/async_support/btcbox.py +1 -1
  36. ccxt/async_support/btcmarkets.py +1 -1
  37. ccxt/async_support/btcturk.py +1 -1
  38. ccxt/async_support/bybit.py +44 -17
  39. ccxt/async_support/cex.py +1 -1
  40. ccxt/async_support/coinbase.py +2 -2
  41. ccxt/async_support/coinbasepro.py +1 -1
  42. ccxt/async_support/coincheck.py +1 -1
  43. ccxt/async_support/coinex.py +358 -543
  44. ccxt/async_support/coinlist.py +6 -7
  45. ccxt/async_support/coinmate.py +1 -1
  46. ccxt/async_support/coinmetro.py +1 -1
  47. ccxt/async_support/coinone.py +1 -1
  48. ccxt/async_support/coinsph.py +1 -1
  49. ccxt/async_support/coinspot.py +1 -1
  50. ccxt/async_support/cryptocom.py +1 -1
  51. ccxt/async_support/currencycom.py +2 -2
  52. ccxt/async_support/delta.py +4 -4
  53. ccxt/async_support/deribit.py +8 -8
  54. ccxt/async_support/digifinex.py +5 -5
  55. ccxt/async_support/exmo.py +1 -1
  56. ccxt/async_support/gate.py +5 -5
  57. ccxt/async_support/gemini.py +1 -1
  58. ccxt/async_support/hitbtc.py +3 -3
  59. ccxt/async_support/hollaex.py +4 -4
  60. ccxt/async_support/htx.py +2 -2
  61. ccxt/async_support/huobijp.py +1 -1
  62. ccxt/async_support/idex.py +1 -1
  63. ccxt/async_support/independentreserve.py +1 -1
  64. ccxt/async_support/indodax.py +2 -2
  65. ccxt/async_support/kraken.py +2 -2
  66. ccxt/async_support/krakenfutures.py +3 -3
  67. ccxt/async_support/kucoin.py +3 -3
  68. ccxt/async_support/kucoinfutures.py +3 -3
  69. ccxt/async_support/kuna.py +1 -1
  70. ccxt/async_support/latoken.py +6 -6
  71. ccxt/async_support/lbank.py +1 -1
  72. ccxt/async_support/luno.py +1 -1
  73. ccxt/async_support/lykke.py +1 -1
  74. ccxt/async_support/mercado.py +1 -1
  75. ccxt/async_support/mexc.py +7 -7
  76. ccxt/async_support/ndax.py +1 -1
  77. ccxt/async_support/novadax.py +3 -4
  78. ccxt/async_support/okcoin.py +3 -3
  79. ccxt/async_support/okx.py +27 -10
  80. ccxt/async_support/onetrading.py +1 -1
  81. ccxt/async_support/paymium.py +3 -3
  82. ccxt/async_support/phemex.py +19 -11
  83. ccxt/async_support/poloniex.py +3 -4
  84. ccxt/async_support/poloniexfutures.py +1 -1
  85. ccxt/async_support/probit.py +1 -1
  86. ccxt/async_support/timex.py +1 -1
  87. ccxt/async_support/tokocrypto.py +1 -1
  88. ccxt/async_support/upbit.py +1 -1
  89. ccxt/async_support/wavesexchange.py +3 -3
  90. ccxt/async_support/wazirx.py +1 -1
  91. ccxt/async_support/whitebit.py +2 -2
  92. ccxt/async_support/woo.py +25 -10
  93. ccxt/async_support/woofipro.py +2524 -0
  94. ccxt/async_support/yobit.py +1 -1
  95. ccxt/async_support/zaif.py +1 -1
  96. ccxt/async_support/zonda.py +3 -3
  97. ccxt/base/exchange.py +64 -16
  98. ccxt/base/types.py +20 -0
  99. ccxt/bigone.py +4 -4
  100. ccxt/binance.py +9 -9
  101. ccxt/bingx.py +4 -4
  102. ccxt/bit2c.py +1 -1
  103. ccxt/bitbank.py +1 -1
  104. ccxt/bitbns.py +1 -1
  105. ccxt/bitfinex.py +28 -4
  106. ccxt/bitfinex2.py +62 -54
  107. ccxt/bitflyer.py +1 -1
  108. ccxt/bitget.py +11 -11
  109. ccxt/bithumb.py +1 -1
  110. ccxt/bitmart.py +8 -8
  111. ccxt/bitmex.py +2 -2
  112. ccxt/bitopro.py +1 -1
  113. ccxt/bitrue.py +3 -3
  114. ccxt/bitso.py +1 -1
  115. ccxt/bitstamp.py +3 -5
  116. ccxt/bitteam.py +1 -1
  117. ccxt/bitvavo.py +1 -1
  118. ccxt/bl3p.py +1 -1
  119. ccxt/blockchaincom.py +1 -1
  120. ccxt/blofin.py +3 -3
  121. ccxt/btcalpha.py +1 -1
  122. ccxt/btcbox.py +1 -1
  123. ccxt/btcmarkets.py +1 -1
  124. ccxt/btcturk.py +1 -1
  125. ccxt/bybit.py +44 -17
  126. ccxt/cex.py +1 -1
  127. ccxt/coinbase.py +2 -2
  128. ccxt/coinbasepro.py +1 -1
  129. ccxt/coincheck.py +1 -1
  130. ccxt/coinex.py +358 -543
  131. ccxt/coinlist.py +6 -7
  132. ccxt/coinmate.py +1 -1
  133. ccxt/coinmetro.py +1 -1
  134. ccxt/coinone.py +1 -1
  135. ccxt/coinsph.py +1 -1
  136. ccxt/coinspot.py +1 -1
  137. ccxt/cryptocom.py +1 -1
  138. ccxt/currencycom.py +2 -2
  139. ccxt/delta.py +4 -4
  140. ccxt/deribit.py +8 -8
  141. ccxt/digifinex.py +5 -5
  142. ccxt/exmo.py +1 -1
  143. ccxt/gate.py +5 -5
  144. ccxt/gemini.py +1 -1
  145. ccxt/hitbtc.py +3 -3
  146. ccxt/hollaex.py +4 -4
  147. ccxt/htx.py +2 -2
  148. ccxt/huobijp.py +1 -1
  149. ccxt/idex.py +1 -1
  150. ccxt/independentreserve.py +1 -1
  151. ccxt/indodax.py +2 -2
  152. ccxt/kraken.py +2 -2
  153. ccxt/krakenfutures.py +3 -3
  154. ccxt/kucoin.py +3 -3
  155. ccxt/kucoinfutures.py +3 -3
  156. ccxt/kuna.py +1 -1
  157. ccxt/latoken.py +6 -6
  158. ccxt/lbank.py +1 -1
  159. ccxt/luno.py +1 -1
  160. ccxt/lykke.py +1 -1
  161. ccxt/mercado.py +1 -1
  162. ccxt/mexc.py +7 -7
  163. ccxt/ndax.py +1 -1
  164. ccxt/novadax.py +3 -4
  165. ccxt/okcoin.py +3 -3
  166. ccxt/okx.py +27 -10
  167. ccxt/onetrading.py +1 -1
  168. ccxt/paymium.py +3 -3
  169. ccxt/phemex.py +19 -11
  170. ccxt/poloniex.py +3 -4
  171. ccxt/poloniexfutures.py +1 -1
  172. ccxt/pro/__init__.py +3 -1
  173. ccxt/pro/bitget.py +127 -190
  174. ccxt/pro/coinbaseinternational.py +11 -4
  175. ccxt/pro/htx.py +12 -6
  176. ccxt/pro/okx.py +79 -1
  177. ccxt/pro/woofipro.py +1183 -0
  178. ccxt/probit.py +1 -1
  179. ccxt/test/test_async.py +31 -1
  180. ccxt/test/test_sync.py +31 -1
  181. ccxt/timex.py +1 -1
  182. ccxt/tokocrypto.py +1 -1
  183. ccxt/upbit.py +1 -1
  184. ccxt/wavesexchange.py +3 -3
  185. ccxt/wazirx.py +1 -1
  186. ccxt/whitebit.py +2 -2
  187. ccxt/woo.py +25 -10
  188. ccxt/woofipro.py +2524 -0
  189. ccxt/yobit.py +1 -1
  190. ccxt/zaif.py +1 -1
  191. ccxt/zonda.py +3 -3
  192. {ccxt-4.3.18.dist-info → ccxt-4.3.20.dist-info}/METADATA +8 -6
  193. {ccxt-4.3.18.dist-info → ccxt-4.3.20.dist-info}/RECORD +195 -191
  194. {ccxt-4.3.18.dist-info → ccxt-4.3.20.dist-info}/WHEEL +0 -0
  195. {ccxt-4.3.18.dist-info → ccxt-4.3.20.dist-info}/top_level.txt +0 -0
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.bybit import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- from ccxt.base.types import Balances, CrossBorrowRate, Currencies, Currency, Greeks, Int, Leverage, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
10
+ from ccxt.base.types import Balances, CrossBorrowRate, Currencies, Currency, Greeks, Int, Leverage, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry, TransferEntries
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -361,6 +361,7 @@ class bybit(Exchange, ImplicitAPI):
361
361
  'v5/asset/coin/query-info': 28, # should be 25 but exceeds ratelimit unless the weight is 28 or higher
362
362
  'v5/asset/withdraw/query-record': 10, # 5/s => cost = 50 / 5 = 10
363
363
  'v5/asset/withdraw/withdrawable-amount': 5,
364
+ 'v5/asset/withdraw/vasp/list': 5,
364
365
  # user
365
366
  'v5/user/query-sub-members': 5, # 10/s => cost = 50 / 10 = 5
366
367
  'v5/user/query-api': 5, # 10/s => cost = 50 / 10 = 5
@@ -1853,7 +1854,7 @@ class bybit(Exchange, ImplicitAPI):
1853
1854
  }))
1854
1855
  return result
1855
1856
 
1856
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
1857
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
1857
1858
  #
1858
1859
  # spot
1859
1860
  #
@@ -6157,7 +6158,7 @@ class bybit(Exchange, ImplicitAPI):
6157
6158
  position = await self.fetch_position(symbol, params)
6158
6159
  return self.parse_leverage(position, market)
6159
6160
 
6160
- def parse_leverage(self, leverage, market=None) -> Leverage:
6161
+ def parse_leverage(self, leverage: dict, market: Market = None) -> Leverage:
6161
6162
  marketId = self.safe_string(leverage, 'symbol')
6162
6163
  leverageValue = self.safe_integer(leverage, 'leverage')
6163
6164
  return {
@@ -6665,7 +6666,7 @@ class bybit(Exchange, ImplicitAPI):
6665
6666
  'status': status,
6666
6667
  })
6667
6668
 
6668
- async def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
6669
+ async def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> TransferEntries:
6669
6670
  """
6670
6671
  fetch a history of internal transfers made on an account
6671
6672
  :see: https://bybit-exchange.github.io/docs/v5/asset/inter-transfer-list
@@ -6810,7 +6811,7 @@ class bybit(Exchange, ImplicitAPI):
6810
6811
  'info': info,
6811
6812
  }
6812
6813
 
6813
- def parse_transfer_status(self, status):
6814
+ def parse_transfer_status(self, status: Str) -> Str:
6814
6815
  statuses = {
6815
6816
  '0': 'ok',
6816
6817
  'OK': 'ok',
@@ -6818,7 +6819,7 @@ class bybit(Exchange, ImplicitAPI):
6818
6819
  }
6819
6820
  return self.safe_string(statuses, status, status)
6820
6821
 
6821
- def parse_transfer(self, transfer, currency: Currency = None):
6822
+ def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
6822
6823
  #
6823
6824
  # transfer
6824
6825
  #
@@ -7402,7 +7403,7 @@ class bybit(Exchange, ImplicitAPI):
7402
7403
  'datetime': self.iso8601(timestamp),
7403
7404
  })
7404
7405
 
7405
- def parse_greeks(self, greeks, market: Market = None):
7406
+ def parse_greeks(self, greeks: dict, market: Market = None) -> Greeks:
7406
7407
  #
7407
7408
  # {
7408
7409
  # "symbol": "BTC-26JAN24-39000-C",
@@ -7581,6 +7582,33 @@ class bybit(Exchange, ImplicitAPI):
7581
7582
  'datetime': self.iso8601(timestamp),
7582
7583
  })
7583
7584
 
7585
+ async def get_leverage_tiers_paginated(self, symbol: Str = None, params={}):
7586
+ await self.load_markets()
7587
+ market = None
7588
+ if symbol is not None:
7589
+ market = self.market(symbol)
7590
+ paginate = False
7591
+ paginate, params = self.handle_option_and_params(params, 'getLeverageTiersPaginated', 'paginate')
7592
+ if paginate:
7593
+ return await self.fetch_paginated_call_cursor('getLeverageTiersPaginated', symbol, None, None, params, 'nextPageCursor', 'cursor', None, 100)
7594
+ subType = None
7595
+ subType, params = self.handle_sub_type_and_params('getLeverageTiersPaginated', market, params, 'linear')
7596
+ request = {
7597
+ 'category': subType,
7598
+ }
7599
+ response = await self.publicGetV5MarketRiskLimit(self.extend(request, params))
7600
+ result = self.add_pagination_cursor_to_result(response)
7601
+ first = self.safe_dict(result, 0)
7602
+ total = len(result)
7603
+ lastIndex = total - 1
7604
+ last = self.safe_dict(result, lastIndex)
7605
+ cursorValue = self.safe_string(first, 'nextPageCursor')
7606
+ last['info'] = {
7607
+ 'nextPageCursor': cursorValue,
7608
+ }
7609
+ result[lastIndex] = last
7610
+ return result
7611
+
7584
7612
  async def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
7585
7613
  """
7586
7614
  :see: https://bybit-exchange.github.io/docs/v5/market/risk-limit
@@ -7588,22 +7616,18 @@ class bybit(Exchange, ImplicitAPI):
7588
7616
  :param str[] [symbols]: a list of unified market symbols
7589
7617
  :param dict [params]: extra parameters specific to the exchange API endpoint
7590
7618
  :param str [params.subType]: market subType, ['linear', 'inverse'], default is 'linear'
7619
+ :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
7591
7620
  :returns dict: a dictionary of `leverage tiers structures <https://docs.ccxt.com/#/?id=leverage-tiers-structure>`, indexed by market symbols
7592
7621
  """
7593
7622
  await self.load_markets()
7594
7623
  market = None
7624
+ symbol = None
7595
7625
  if symbols is not None:
7596
7626
  market = self.market(symbols[0])
7597
7627
  if market['spot']:
7598
7628
  raise NotSupported(self.id + ' fetchLeverageTiers() is not supported for spot market')
7599
- subType = None
7600
- subType, params = self.handle_sub_type_and_params('fetchTickers', market, params, 'linear')
7601
- request = {
7602
- 'category': subType,
7603
- }
7604
- response = await self.publicGetV5MarketRiskLimit(self.extend(request, params))
7605
- result = self.safe_dict(response, 'result', {})
7606
- data = self.safe_list(result, 'list', [])
7629
+ symbol = market['symbol']
7630
+ data = await self.get_leverage_tiers_paginated(symbol, self.extend({'paginate': True, 'paginationCalls': 20}, params))
7607
7631
  symbols = self.market_symbols(symbols)
7608
7632
  return self.parse_leverage_tiers(data, symbols, 'symbol')
7609
7633
 
@@ -7629,9 +7653,12 @@ class bybit(Exchange, ImplicitAPI):
7629
7653
  for i in range(0, len(keys)):
7630
7654
  marketId = keys[i]
7631
7655
  entry = grouped[marketId]
7656
+ for j in range(0, len(entry)):
7657
+ id = self.safe_integer(entry[j], 'id')
7658
+ entry[j]['id'] = id
7632
7659
  market = self.safe_market(marketId, None, None, 'contract')
7633
7660
  symbol = market['symbol']
7634
- tiers[symbol] = self.parse_market_leverage_tiers(entry, market)
7661
+ tiers[symbol] = self.parse_market_leverage_tiers(self.sort_by(entry, 'id'), market)
7635
7662
  return tiers
7636
7663
 
7637
7664
  def parse_market_leverage_tiers(self, info, market: Market = None):
@@ -7877,7 +7904,7 @@ class bybit(Exchange, ImplicitAPI):
7877
7904
  resultList = self.safe_list(result, 'list', [])
7878
7905
  return self.parse_option_chain(resultList, None, 'symbol')
7879
7906
 
7880
- def parse_option(self, chain, currency: Currency = None, market: Market = None):
7907
+ def parse_option(self, chain: dict, currency: Currency = None, market: Market = None) -> Option:
7881
7908
  #
7882
7909
  # {
7883
7910
  # "symbol": "BTC-27DEC24-55000-P",
ccxt/async_support/cex.py CHANGED
@@ -562,7 +562,7 @@ class cex(Exchange, ImplicitAPI):
562
562
  return []
563
563
  return None
564
564
 
565
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
565
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
566
566
  timestamp = self.safe_timestamp(ticker, 'timestamp')
567
567
  volume = self.safe_string(ticker, 'volume')
568
568
  high = self.safe_string(ticker, 'high')
@@ -1878,7 +1878,7 @@ class coinbase(Exchange, ImplicitAPI):
1878
1878
  ticker['ask'] = self.safe_number(response, 'best_ask')
1879
1879
  return ticker
1880
1880
 
1881
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
1881
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
1882
1882
  #
1883
1883
  # fetchTickerV2
1884
1884
  #
@@ -3978,7 +3978,7 @@ class coinbase(Exchange, ImplicitAPI):
3978
3978
  data = self.safe_dict(response, 'trade', {})
3979
3979
  return self.parse_conversion(data)
3980
3980
 
3981
- def parse_conversion(self, conversion, fromCurrency: Currency = None, toCurrency: Currency = None) -> Conversion:
3981
+ def parse_conversion(self, conversion: dict, fromCurrency: Currency = None, toCurrency: Currency = None) -> Conversion:
3982
3982
  fromCoin = self.safe_string(conversion, 'source_currency')
3983
3983
  fromCode = self.safe_currency_code(fromCoin, fromCurrency)
3984
3984
  to = self.safe_string(conversion, 'target_currency')
@@ -542,7 +542,7 @@ class coinbasepro(Exchange, ImplicitAPI):
542
542
  orderbook['nonce'] = self.safe_integer(response, 'sequence')
543
543
  return orderbook
544
544
 
545
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
545
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
546
546
  #
547
547
  # fetchTickers
548
548
  #
@@ -289,7 +289,7 @@ class coincheck(Exchange, ImplicitAPI):
289
289
  response = await self.publicGetOrderBooks(self.extend(request, params))
290
290
  return self.parse_order_book(response, market['symbol'])
291
291
 
292
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
292
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
293
293
  #
294
294
  # {
295
295
  # "last":4192632.0,