ccxt 4.4.28__py2.py3-none-any.whl → 4.4.30__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 (162) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/alpaca.py +1 -0
  3. ccxt/abstract/binance.py +9 -0
  4. ccxt/abstract/binancecoinm.py +9 -0
  5. ccxt/abstract/binanceus.py +9 -0
  6. ccxt/abstract/binanceusdm.py +9 -0
  7. ccxt/abstract/bybit.py +0 -13
  8. ccxt/alpaca.py +53 -8
  9. ccxt/async_support/__init__.py +1 -1
  10. ccxt/async_support/alpaca.py +53 -8
  11. ccxt/async_support/base/exchange.py +4 -1
  12. ccxt/async_support/bigone.py +1 -1
  13. ccxt/async_support/binance.py +10 -1
  14. ccxt/async_support/bingx.py +1 -1
  15. ccxt/async_support/bitbank.py +1 -1
  16. ccxt/async_support/bitbns.py +12 -12
  17. ccxt/async_support/bitfinex.py +10 -10
  18. ccxt/async_support/bitfinex2.py +1 -1
  19. ccxt/async_support/bitflyer.py +1 -1
  20. ccxt/async_support/bitget.py +96 -8
  21. ccxt/async_support/bithumb.py +1 -1
  22. ccxt/async_support/bitmart.py +54 -54
  23. ccxt/async_support/bitmex.py +1 -1
  24. ccxt/async_support/bitopro.py +22 -22
  25. ccxt/async_support/bitrue.py +29 -29
  26. ccxt/async_support/bitso.py +1 -1
  27. ccxt/async_support/bitstamp.py +1 -1
  28. ccxt/async_support/bitvavo.py +4 -1
  29. ccxt/async_support/blockchaincom.py +1 -1
  30. ccxt/async_support/btcmarkets.py +1 -1
  31. ccxt/async_support/bybit.py +50 -585
  32. ccxt/async_support/coinbase.py +1 -1
  33. ccxt/async_support/coinbaseexchange.py +1 -1
  34. ccxt/async_support/coinbaseinternational.py +1 -1
  35. ccxt/async_support/coincatch.py +25 -5
  36. ccxt/async_support/coinex.py +1 -1
  37. ccxt/async_support/coinlist.py +1 -1
  38. ccxt/async_support/coinmate.py +1 -1
  39. ccxt/async_support/coinsph.py +1 -1
  40. ccxt/async_support/cryptocom.py +1 -1
  41. ccxt/async_support/deribit.py +8 -4
  42. ccxt/async_support/digifinex.py +1 -1
  43. ccxt/async_support/exmo.py +1 -1
  44. ccxt/async_support/gate.py +1 -1
  45. ccxt/async_support/gemini.py +1 -1
  46. ccxt/async_support/hashkey.py +1 -1
  47. ccxt/async_support/hitbtc.py +1 -1
  48. ccxt/async_support/hollaex.py +1 -1
  49. ccxt/async_support/htx.py +1 -1
  50. ccxt/async_support/huobijp.py +1 -1
  51. ccxt/async_support/hyperliquid.py +110 -5
  52. ccxt/async_support/idex.py +1 -1
  53. ccxt/async_support/independentreserve.py +1 -1
  54. ccxt/async_support/indodax.py +1 -1
  55. ccxt/async_support/kraken.py +1 -1
  56. ccxt/async_support/kucoin.py +1 -1
  57. ccxt/async_support/kuna.py +1 -1
  58. ccxt/async_support/lbank.py +6 -1
  59. ccxt/async_support/lykke.py +1 -1
  60. ccxt/async_support/mercado.py +1 -1
  61. ccxt/async_support/mexc.py +1 -1
  62. ccxt/async_support/ndax.py +1 -1
  63. ccxt/async_support/novadax.py +1 -1
  64. ccxt/async_support/okcoin.py +1 -1
  65. ccxt/async_support/okx.py +1 -1
  66. ccxt/async_support/onetrading.py +1 -1
  67. ccxt/async_support/oxfun.py +1 -1
  68. ccxt/async_support/phemex.py +1 -1
  69. ccxt/async_support/poloniex.py +1 -1
  70. ccxt/async_support/probit.py +1 -1
  71. ccxt/async_support/tokocrypto.py +1 -1
  72. ccxt/async_support/upbit.py +1 -1
  73. ccxt/async_support/vertex.py +52 -8
  74. ccxt/async_support/wavesexchange.py +1 -1
  75. ccxt/async_support/whitebit.py +1 -1
  76. ccxt/async_support/woo.py +1 -1
  77. ccxt/async_support/woofipro.py +1 -1
  78. ccxt/async_support/xt.py +1 -1
  79. ccxt/async_support/yobit.py +2 -2
  80. ccxt/async_support/zaif.py +1 -1
  81. ccxt/async_support/zonda.py +1 -1
  82. ccxt/base/exchange.py +4 -1
  83. ccxt/bigone.py +1 -1
  84. ccxt/binance.py +10 -1
  85. ccxt/bingx.py +1 -1
  86. ccxt/bitbank.py +1 -1
  87. ccxt/bitbns.py +12 -12
  88. ccxt/bitfinex.py +10 -10
  89. ccxt/bitfinex2.py +1 -1
  90. ccxt/bitflyer.py +1 -1
  91. ccxt/bitget.py +96 -8
  92. ccxt/bithumb.py +1 -1
  93. ccxt/bitmart.py +54 -54
  94. ccxt/bitmex.py +1 -1
  95. ccxt/bitopro.py +22 -22
  96. ccxt/bitrue.py +29 -29
  97. ccxt/bitso.py +1 -1
  98. ccxt/bitstamp.py +1 -1
  99. ccxt/bitvavo.py +4 -1
  100. ccxt/blockchaincom.py +1 -1
  101. ccxt/btcmarkets.py +1 -1
  102. ccxt/bybit.py +50 -585
  103. ccxt/coinbase.py +1 -1
  104. ccxt/coinbaseexchange.py +1 -1
  105. ccxt/coinbaseinternational.py +1 -1
  106. ccxt/coincatch.py +25 -5
  107. ccxt/coinex.py +1 -1
  108. ccxt/coinlist.py +1 -1
  109. ccxt/coinmate.py +1 -1
  110. ccxt/coinsph.py +1 -1
  111. ccxt/cryptocom.py +1 -1
  112. ccxt/deribit.py +8 -4
  113. ccxt/digifinex.py +1 -1
  114. ccxt/exmo.py +1 -1
  115. ccxt/gate.py +1 -1
  116. ccxt/gemini.py +1 -1
  117. ccxt/hashkey.py +1 -1
  118. ccxt/hitbtc.py +1 -1
  119. ccxt/hollaex.py +1 -1
  120. ccxt/htx.py +1 -1
  121. ccxt/huobijp.py +1 -1
  122. ccxt/hyperliquid.py +110 -5
  123. ccxt/idex.py +1 -1
  124. ccxt/independentreserve.py +1 -1
  125. ccxt/indodax.py +1 -1
  126. ccxt/kraken.py +1 -1
  127. ccxt/kucoin.py +1 -1
  128. ccxt/kuna.py +1 -1
  129. ccxt/lbank.py +6 -1
  130. ccxt/lykke.py +1 -1
  131. ccxt/mercado.py +1 -1
  132. ccxt/mexc.py +1 -1
  133. ccxt/ndax.py +1 -1
  134. ccxt/novadax.py +1 -1
  135. ccxt/okcoin.py +1 -1
  136. ccxt/okx.py +1 -1
  137. ccxt/onetrading.py +1 -1
  138. ccxt/oxfun.py +1 -1
  139. ccxt/phemex.py +1 -1
  140. ccxt/poloniex.py +1 -1
  141. ccxt/pro/__init__.py +1 -1
  142. ccxt/pro/bitvavo.py +2 -1
  143. ccxt/pro/blofin.py +2 -1
  144. ccxt/pro/mexc.py +187 -30
  145. ccxt/probit.py +1 -1
  146. ccxt/test/tests_helpers.py +2 -2
  147. ccxt/tokocrypto.py +1 -1
  148. ccxt/upbit.py +1 -1
  149. ccxt/vertex.py +52 -8
  150. ccxt/wavesexchange.py +1 -1
  151. ccxt/whitebit.py +1 -1
  152. ccxt/woo.py +1 -1
  153. ccxt/woofipro.py +1 -1
  154. ccxt/xt.py +1 -1
  155. ccxt/yobit.py +2 -2
  156. ccxt/zaif.py +1 -1
  157. ccxt/zonda.py +1 -1
  158. {ccxt-4.4.28.dist-info → ccxt-4.4.30.dist-info}/METADATA +4 -4
  159. {ccxt-4.4.28.dist-info → ccxt-4.4.30.dist-info}/RECORD +162 -162
  160. {ccxt-4.4.28.dist-info → ccxt-4.4.30.dist-info}/LICENSE.txt +0 -0
  161. {ccxt-4.4.28.dist-info → ccxt-4.4.30.dist-info}/WHEEL +0 -0
  162. {ccxt-4.4.28.dist-info → ccxt-4.4.30.dist-info}/top_level.txt +0 -0
@@ -3705,7 +3705,7 @@ class coinbase(Exchange, ImplicitAPI):
3705
3705
  tickers = self.safe_list(response, 'pricebooks', [])
3706
3706
  return self.parse_tickers(tickers, symbols)
3707
3707
 
3708
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
3708
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
3709
3709
  """
3710
3710
  make a withdrawal
3711
3711
  :see: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-transactions#send-money
@@ -1284,7 +1284,7 @@ class coinbaseexchange(Exchange, ImplicitAPI):
1284
1284
  async def fetch_payment_methods(self, params={}):
1285
1285
  return await self.privateGetPaymentMethods(params)
1286
1286
 
1287
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1287
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1288
1288
  """
1289
1289
  make a withdrawal
1290
1290
  :see: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postwithdrawpaymentmethod
@@ -1997,7 +1997,7 @@ class coinbaseinternational(Exchange, ImplicitAPI):
1997
1997
  trades = self.safe_list(response, 'results', [])
1998
1998
  return self.parse_trades(trades, market, since, limit)
1999
1999
 
2000
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2000
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2001
2001
  """
2002
2002
  make a withdrawal
2003
2003
  :see: https://docs.cloud.coinbase.com/intx/reference/withdraw
@@ -1954,7 +1954,7 @@ class coincatch(Exchange, ImplicitAPI):
1954
1954
  data = self.safe_list(response, 'data', [])
1955
1955
  return self.parse_transactions(data, currency, since, limit)
1956
1956
 
1957
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1957
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1958
1958
  """
1959
1959
  make a withdrawal
1960
1960
  :see: https://coincatch.github.io/github.io/en/spot/#withdraw
@@ -1983,13 +1983,23 @@ class coincatch(Exchange, ImplicitAPI):
1983
1983
  if networkCode is not None:
1984
1984
  request['chain'] = self.network_code_to_id(networkCode)
1985
1985
  response = await self.privatePostApiSpotV1WalletWithdrawalV2(self.extend(request, params))
1986
- # todo add after withdrawal
1987
1986
  #
1988
- return response
1987
+ # {
1988
+ # "code": "00000",
1989
+ # "msg": "success",
1990
+ # "data": {
1991
+ # "orderId":888291686266343424",
1992
+ # "clientOrderId":"123"
1993
+ # }
1994
+ # }
1995
+ #
1996
+ data = self.safe_dict(response, 'data', {})
1997
+ return self.parse_transaction(data, currency)
1989
1998
 
1990
1999
  def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
1991
2000
  #
1992
2001
  # fetchDeposits
2002
+ #
1993
2003
  # {
1994
2004
  # "id": "1213046466852196352",
1995
2005
  # "txId": "824246b030cd84d56400661303547f43a1d9fef66cf968628dd5112f362053ff",
@@ -2009,7 +2019,17 @@ class coincatch(Exchange, ImplicitAPI):
2009
2019
  # "uTime": "1724938746015"
2010
2020
  # }
2011
2021
  #
2012
- id = self.safe_string(transaction, 'id')
2022
+ # withdraw
2023
+ #
2024
+ # {
2025
+ # "code": "00000",
2026
+ # "msg": "success",
2027
+ # "data": {
2028
+ # "orderId":888291686266343424",
2029
+ # "clientOrderId":"123"
2030
+ # }
2031
+ # }
2032
+ #
2013
2033
  status = self.safe_string(transaction, 'status')
2014
2034
  if status == 'success':
2015
2035
  status = 'ok'
@@ -2033,7 +2053,7 @@ class coincatch(Exchange, ImplicitAPI):
2033
2053
  }
2034
2054
  return {
2035
2055
  'info': transaction,
2036
- 'id': id,
2056
+ 'id': self.safe_string_2(transaction, 'id', 'orderId'),
2037
2057
  'txid': txid,
2038
2058
  'timestamp': timestamp,
2039
2059
  'datetime': self.iso8601(timestamp),
@@ -4425,7 +4425,7 @@ class coinex(Exchange, ImplicitAPI):
4425
4425
  result = self.parse_funding_rates(data, market)
4426
4426
  return self.filter_by_array(result, 'symbol', symbols)
4427
4427
 
4428
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
4428
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
4429
4429
  """
4430
4430
  make a withdrawal
4431
4431
  :see: https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/withdrawal
@@ -1886,7 +1886,7 @@ class coinlist(Exchange, ImplicitAPI):
1886
1886
  # coinlist returns both internal transfers and blockchain transactions
1887
1887
  return self.parse_transactions(response, currency, since, limit)
1888
1888
 
1889
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1889
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1890
1890
  """
1891
1891
  request a withdrawal from CoinList wallet.(Disabled by default. Contact CoinList to apply for an exception.)
1892
1892
  :see: https://trade-docs.coinlist.co/?javascript--nodejs#request-withdrawal-from-wallet
@@ -587,7 +587,7 @@ class coinmate(Exchange, ImplicitAPI):
587
587
  },
588
588
  }
589
589
 
590
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
590
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
591
591
  """
592
592
  make a withdrawal
593
593
  :see: https://coinmate.docs.apiary.io/#reference/bitcoin-withdrawal-and-deposit/withdraw-bitcoins/post
@@ -1501,7 +1501,7 @@ class coinsph(Exchange, ImplicitAPI):
1501
1501
  'tierBased': None,
1502
1502
  }
1503
1503
 
1504
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1504
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1505
1505
  """
1506
1506
  make a withdrawal to coins_ph account
1507
1507
  :see: https://coins-docs.github.io/rest-api/#withdrawuser_data
@@ -1556,7 +1556,7 @@ class cryptocom(Exchange, ImplicitAPI):
1556
1556
  address = addressString
1557
1557
  return [address, tag]
1558
1558
 
1559
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1559
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1560
1560
  """
1561
1561
  make a withdrawal
1562
1562
  :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-withdrawal
@@ -843,6 +843,8 @@ class deribit(Exchange, ImplicitAPI):
843
843
  type = 'option'
844
844
  elif isSpot:
845
845
  type = 'spot'
846
+ inverse = None
847
+ linear = None
846
848
  if isSpot:
847
849
  symbol = base + '/' + quote
848
850
  elif not isComboMarket:
@@ -854,6 +856,8 @@ class deribit(Exchange, ImplicitAPI):
854
856
  optionType = self.safe_string(market, 'option_type')
855
857
  letter = 'C' if (optionType == 'call') else 'P'
856
858
  symbol = symbol + '-' + self.number_to_string(strike) + '-' + letter
859
+ inverse = (quote != settle)
860
+ linear = (settle == quote)
857
861
  parsedMarketValue = self.safe_value(parsedMarkets, symbol)
858
862
  if parsedMarketValue:
859
863
  continue
@@ -877,8 +881,8 @@ class deribit(Exchange, ImplicitAPI):
877
881
  'option': option,
878
882
  'active': self.safe_value(market, 'is_active'),
879
883
  'contract': not isSpot,
880
- 'linear': (settle == quote),
881
- 'inverse': (settle != quote),
884
+ 'linear': linear,
885
+ 'inverse': inverse,
882
886
  'taker': self.safe_number(market, 'taker_commission'),
883
887
  'maker': self.safe_number(market, 'maker_commission'),
884
888
  'contractSize': self.safe_number(market, 'contract_size'),
@@ -1697,7 +1701,7 @@ class deribit(Exchange, ImplicitAPI):
1697
1701
  filledString = self.safe_string(order, 'filled_amount')
1698
1702
  amount = self.safe_string(order, 'amount')
1699
1703
  cost = Precise.string_mul(filledString, averageString)
1700
- if market['inverse']:
1704
+ if self.safe_bool(market, 'inverse'):
1701
1705
  if averageString != '0':
1702
1706
  cost = Precise.string_div(amount, averageString)
1703
1707
  lastTradeTimestamp = None
@@ -2768,7 +2772,7 @@ class deribit(Exchange, ImplicitAPI):
2768
2772
  }
2769
2773
  return self.safe_string(statuses, status, status)
2770
2774
 
2771
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2775
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2772
2776
  """
2773
2777
  make a withdrawal
2774
2778
  :see: https://docs.deribit.com/#private-withdraw
@@ -2786,7 +2786,7 @@ class digifinex(Exchange, ImplicitAPI):
2786
2786
  #
2787
2787
  return self.parse_transfer(response, currency)
2788
2788
 
2789
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2789
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2790
2790
  """
2791
2791
  make a withdrawal
2792
2792
  :param str code: unified currency code
@@ -1988,7 +1988,7 @@ class exmo(Exchange, ImplicitAPI):
1988
1988
  return self.markets[symbols[0]]
1989
1989
  return None
1990
1990
 
1991
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1991
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1992
1992
  """
1993
1993
  make a withdrawal
1994
1994
  :see: https://documenter.getpostman.com/view/10287440/SzYXWKPi#3ab9c34d-ad58-4f87-9c57-2e2ea88a8325
@@ -3528,7 +3528,7 @@ class gate(Exchange, ImplicitAPI):
3528
3528
  response = await self.privateWalletGetWithdrawals(self.extend(request, params))
3529
3529
  return self.parse_transactions(response, currency)
3530
3530
 
3531
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
3531
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
3532
3532
  """
3533
3533
  make a withdrawal
3534
3534
  :see: https://www.gate.io/docs/developers/apiv4/en/#withdraw
@@ -1527,7 +1527,7 @@ class gemini(Exchange, ImplicitAPI):
1527
1527
  response = await self.privatePostV1Mytrades(self.extend(request, params))
1528
1528
  return self.parse_trades(response, market, since, limit)
1529
1529
 
1530
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1530
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1531
1531
  """
1532
1532
  make a withdrawal
1533
1533
  :see: https://docs.gemini.com/rest-api/#withdraw-crypto-funds
@@ -1874,7 +1874,7 @@ class hashkey(Exchange, ImplicitAPI):
1874
1874
  #
1875
1875
  return self.parse_transactions(response, currency, since, limit, {'type': 'withdrawal'})
1876
1876
 
1877
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1877
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1878
1878
  """
1879
1879
  make a withdrawal
1880
1880
  :see: https://hashkeyglobal-apidoc.readme.io/reference/withdraw
@@ -2491,7 +2491,7 @@ class hitbtc(Exchange, ImplicitAPI):
2491
2491
  'info': response,
2492
2492
  }
2493
2493
 
2494
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2494
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2495
2495
  """
2496
2496
  make a withdrawal
2497
2497
  :see: https://api.hitbtc.com/#withdraw-crypto
@@ -1611,7 +1611,7 @@ class hollaex(Exchange, ImplicitAPI):
1611
1611
  'fee': fee,
1612
1612
  }
1613
1613
 
1614
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1614
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1615
1615
  """
1616
1616
  make a withdrawal
1617
1617
  :see: https://apidocs.hollaex.com/#withdrawal
ccxt/async_support/htx.py CHANGED
@@ -6118,7 +6118,7 @@ class htx(Exchange, ImplicitAPI):
6118
6118
  }
6119
6119
  return self.safe_string(statuses, status, status)
6120
6120
 
6121
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
6121
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
6122
6122
  """
6123
6123
  :see: https://www.htx.com/en-us/opend/newApiPages/?id=7ec4cc41-7773-11ed-9966-0242ac110003
6124
6124
  make a withdrawal
@@ -1745,7 +1745,7 @@ class huobijp(Exchange, ImplicitAPI):
1745
1745
  }
1746
1746
  return self.safe_string(statuses, status, status)
1747
1747
 
1748
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1748
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1749
1749
  """
1750
1750
  make a withdrawal
1751
1751
  :param str code: unified currency code
@@ -6,7 +6,8 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.hyperliquid import ImplicitAPI
8
8
  import asyncio
9
- from ccxt.base.types import Balances, Currencies, Currency, Int, LedgerEntry, MarginModification, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
9
+ import math
10
+ from ccxt.base.types import Balances, Currencies, Currency, Int, LedgerEntry, MarginModification, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, Transaction, TransferEntry
10
11
  from typing import List
11
12
  from ccxt.base.errors import ExchangeError
12
13
  from ccxt.base.errors import ArgumentsRequired
@@ -75,7 +76,7 @@ class hyperliquid(Exchange, ImplicitAPI):
75
76
  'fetchFundingHistory': False,
76
77
  'fetchFundingRate': False,
77
78
  'fetchFundingRateHistory': True,
78
- 'fetchFundingRates': False,
79
+ 'fetchFundingRates': True,
79
80
  'fetchIndexOHLCV': False,
80
81
  'fetchIsolatedBorrowRate': False,
81
82
  'fetchIsolatedBorrowRates': False,
@@ -131,12 +132,12 @@ class hyperliquid(Exchange, ImplicitAPI):
131
132
  '1h': '1h',
132
133
  '2h': '2h',
133
134
  '4h': '4h',
134
- '6h': '6h',
135
+ '8h': '8h',
135
136
  '12h': '12h',
136
137
  '1d': '1d',
137
138
  '3d': '3d',
138
139
  '1w': '1w',
139
- '1M': '1m',
140
+ '1M': '1M',
140
141
  },
141
142
  'hostname': 'hyperliquid.xyz',
142
143
  'urls': {
@@ -736,6 +737,110 @@ class hyperliquid(Exchange, ImplicitAPI):
736
737
  result[symbol] = ticker
737
738
  return self.filter_by_array_tickers(result, 'symbol', symbols)
738
739
 
740
+ async def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
741
+ """
742
+ retrieves data on all swap markets for hyperliquid
743
+ :see: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc
744
+ :param dict [params]: extra parameters specific to the exchange API endpoint
745
+ :returns dict[]: an array of objects representing market data
746
+ """
747
+ request: dict = {
748
+ 'type': 'metaAndAssetCtxs',
749
+ }
750
+ response = await self.publicPostInfo(self.extend(request, params))
751
+ #
752
+ # [
753
+ # {
754
+ # "universe": [
755
+ # {
756
+ # "maxLeverage": 50,
757
+ # "name": "SOL",
758
+ # "onlyIsolated": False,
759
+ # "szDecimals": 2
760
+ # }
761
+ # ]
762
+ # },
763
+ # [
764
+ # {
765
+ # "dayNtlVlm": "9450588.2273",
766
+ # "funding": "0.0000198",
767
+ # "impactPxs": [
768
+ # "108.04",
769
+ # "108.06"
770
+ # ],
771
+ # "markPx": "108.04",
772
+ # "midPx": "108.05",
773
+ # "openInterest": "10764.48",
774
+ # "oraclePx": "107.99",
775
+ # "premium": "0.00055561",
776
+ # "prevDayPx": "111.81"
777
+ # }
778
+ # ]
779
+ # ]
780
+ #
781
+ #
782
+ meta = self.safe_dict(response, 0, {})
783
+ universe = self.safe_list(meta, 'universe', [])
784
+ assetCtxs = self.safe_list(response, 1, [])
785
+ result = []
786
+ for i in range(0, len(universe)):
787
+ data = self.extend(
788
+ self.safe_dict(universe, i, {}),
789
+ self.safe_dict(assetCtxs, i, {})
790
+ )
791
+ result.append(data)
792
+ funding_rates = self.parse_funding_rates(result)
793
+ return self.filter_by_array(funding_rates, 'symbol', symbols)
794
+
795
+ def parse_funding_rate(self, info, market: Market = None) -> FundingRate:
796
+ #
797
+ # {
798
+ # "maxLeverage": "50",
799
+ # "name": "ETH",
800
+ # "onlyIsolated": False,
801
+ # "szDecimals": "4",
802
+ # "dayNtlVlm": "1709813.11535",
803
+ # "funding": "0.00004807",
804
+ # "impactPxs": [
805
+ # "2369.3",
806
+ # "2369.6"
807
+ # ],
808
+ # "markPx": "2369.6",
809
+ # "midPx": "2369.45",
810
+ # "openInterest": "1815.4712",
811
+ # "oraclePx": "2367.3",
812
+ # "premium": "0.00090821",
813
+ # "prevDayPx": "2381.5"
814
+ # }
815
+ #
816
+ base = self.safe_string(info, 'name')
817
+ marketId = self.coin_to_market_id(base)
818
+ symbol = self.safe_symbol(marketId, market)
819
+ funding = self.safe_number(info, 'funding')
820
+ markPx = self.safe_number(info, 'markPx')
821
+ oraclePx = self.safe_number(info, 'oraclePx')
822
+ fundingTimestamp = (int(math.floor(self.milliseconds()) / 60 / 60 / 1000) + 1) * 60 * 60 * 1000
823
+ return {
824
+ 'info': info,
825
+ 'symbol': symbol,
826
+ 'markPrice': markPx,
827
+ 'indexPrice': oraclePx,
828
+ 'interestRate': None,
829
+ 'estimatedSettlePrice': None,
830
+ 'timestamp': None,
831
+ 'datetime': None,
832
+ 'fundingRate': funding,
833
+ 'fundingTimestamp': fundingTimestamp,
834
+ 'fundingDatetime': self.iso8601(fundingTimestamp),
835
+ 'nextFundingRate': None,
836
+ 'nextFundingTimestamp': None,
837
+ 'nextFundingDatetime': None,
838
+ 'previousFundingRate': None,
839
+ 'previousFundingTimestamp': None,
840
+ 'previousFundingDatetime': None,
841
+ 'interval': '1h',
842
+ }
843
+
739
844
  def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
740
845
  #
741
846
  # {
@@ -795,7 +900,7 @@ class hyperliquid(Exchange, ImplicitAPI):
795
900
  'type': 'candleSnapshot',
796
901
  'req': {
797
902
  'coin': market['base'] if market['swap'] else market['id'],
798
- 'interval': timeframe,
903
+ 'interval': self.safe_string(self.timeframes, timeframe, timeframe),
799
904
  'startTime': since,
800
905
  'endTime': until,
801
906
  },
@@ -1292,7 +1292,7 @@ class idex(Exchange, ImplicitAPI):
1292
1292
  response = await self.privatePostOrders(request)
1293
1293
  return self.parse_order(response, market)
1294
1294
 
1295
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1295
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1296
1296
  """
1297
1297
  make a withdrawal
1298
1298
  :see: https://api-docs-v3.idex.io/#withdraw-funds
@@ -756,7 +756,7 @@ class independentreserve(Exchange, ImplicitAPI):
756
756
  'tag': self.safe_string(depositAddress, 'Tag'),
757
757
  }
758
758
 
759
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
759
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
760
760
  """
761
761
  make a withdrawal
762
762
  :see: https://www.independentreserve.com/features/api#WithdrawDigitalCurrency
@@ -1018,7 +1018,7 @@ class indodax(Exchange, ImplicitAPI):
1018
1018
  transactions = self.array_concat(withdraws, deposits)
1019
1019
  return self.parse_transactions(transactions, currency, since, limit)
1020
1020
 
1021
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1021
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1022
1022
  """
1023
1023
  make a withdrawal
1024
1024
  :see: https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#withdraw-coin-endpoints
@@ -2706,7 +2706,7 @@ class kraken(Exchange, ImplicitAPI):
2706
2706
  'tag': tag,
2707
2707
  }
2708
2708
 
2709
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2709
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2710
2710
  """
2711
2711
  make a withdrawal
2712
2712
  :see: https://docs.kraken.com/rest/#tag/Funding/operation/withdrawFunds
@@ -3258,7 +3258,7 @@ class kucoin(Exchange, ImplicitAPI):
3258
3258
  'tierBased': True,
3259
3259
  }
3260
3260
 
3261
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
3261
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
3262
3262
  """
3263
3263
  make a withdrawal
3264
3264
  :see: https://www.kucoin.com/docs/rest/funding/withdrawals/apply-withdraw-v3-
@@ -1333,7 +1333,7 @@ class kuna(Exchange, ImplicitAPI):
1333
1333
  data = self.safe_list(response, 'data')
1334
1334
  return self.parse_trades(data, market, since, limit)
1335
1335
 
1336
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1336
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1337
1337
  """
1338
1338
  make a withdrawal
1339
1339
  :see: https://docs.kuna.io/docs/create-a-withdraw
@@ -1155,6 +1155,11 @@ class lbank(Exchange, ImplicitAPI):
1155
1155
  indexPrice = self.safe_number(ticker, 'underlyingPrice')
1156
1156
  fundingRate = self.safe_number(ticker, 'fundingRate')
1157
1157
  fundingTime = self.safe_integer(ticker, 'nextFeeTime')
1158
+ positionFeeTime = self.safe_integer(ticker, 'positionFeeTime')
1159
+ intervalString = None
1160
+ if positionFeeTime is not None:
1161
+ interval = self.parse_to_int(positionFeeTime / 60 / 60)
1162
+ intervalString = str(interval) + 'h'
1158
1163
  return {
1159
1164
  'info': ticker,
1160
1165
  'symbol': symbol,
@@ -1171,7 +1176,7 @@ class lbank(Exchange, ImplicitAPI):
1171
1176
  'previousFundingRate': None,
1172
1177
  'previousFundingTimestamp': None,
1173
1178
  'previousFundingDatetime': None,
1174
- 'interval': None,
1179
+ 'interval': intervalString,
1175
1180
  }
1176
1181
 
1177
1182
  async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
@@ -1207,7 +1207,7 @@ class lykke(Exchange, ImplicitAPI):
1207
1207
  currency = self.currency(code)
1208
1208
  return self.parse_transactions(payload, currency, since, limit)
1209
1209
 
1210
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1210
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1211
1211
  """
1212
1212
  make a withdrawal
1213
1213
  :see: https://lykkecity.github.io/Trading-API/#withdrawal
@@ -601,7 +601,7 @@ class mercado(Exchange, ImplicitAPI):
601
601
  order = self.safe_dict(responseData, 'order')
602
602
  return self.parse_order(order, market)
603
603
 
604
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
604
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
605
605
  """
606
606
  make a withdrawal
607
607
  :param str code: unified currency code
@@ -4976,7 +4976,7 @@ class mexc(Exchange, ImplicitAPI):
4976
4976
  }
4977
4977
  return self.safe_string(statuses, status, status)
4978
4978
 
4979
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
4979
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
4980
4980
  """
4981
4981
  make a withdrawal
4982
4982
  :see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#withdraw-new
@@ -2229,7 +2229,7 @@ class ndax(Exchange, ImplicitAPI):
2229
2229
  'network': None,
2230
2230
  }
2231
2231
 
2232
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2232
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2233
2233
  """
2234
2234
  make a withdrawal
2235
2235
  :param str code: unified currency code
@@ -1157,7 +1157,7 @@ class novadax(Exchange, ImplicitAPI):
1157
1157
  }
1158
1158
  return self.safe_string(statuses, status, 'failed')
1159
1159
 
1160
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1160
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1161
1161
  """
1162
1162
  make a withdrawal
1163
1163
  :see: https://doc.novadax.com/en-US/#send-cryptocurrencies
@@ -2307,7 +2307,7 @@ class okcoin(Exchange, ImplicitAPI):
2307
2307
  }
2308
2308
  return self.safe_string(statuses, status, status)
2309
2309
 
2310
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2310
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2311
2311
  """
2312
2312
  :see: https://www.okcoin.com/docs-v5/en/#rest-api-funding-withdrawal
2313
2313
  make a withdrawal
ccxt/async_support/okx.py CHANGED
@@ -4644,7 +4644,7 @@ class okx(Exchange, ImplicitAPI):
4644
4644
  first = self.safe_string(keys, 0)
4645
4645
  return self.safe_dict(response, first)
4646
4646
 
4647
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
4647
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
4648
4648
  """
4649
4649
  make a withdrawal
4650
4650
  :see: https://www.okx.com/docs-v5/en/#funding-account-rest-api-withdrawal
@@ -1183,7 +1183,7 @@ class onetrading(Exchange, ImplicitAPI):
1183
1183
  withdrawalHistory = self.safe_list(response, 'withdrawal_history', [])
1184
1184
  return self.parse_transactions(withdrawalHistory, currency, since, limit, {'type': 'withdrawal'})
1185
1185
 
1186
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1186
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1187
1187
  """
1188
1188
  make a withdrawal
1189
1189
  :param str code: unified currency code
@@ -1967,7 +1967,7 @@ class oxfun(Exchange, ImplicitAPI):
1967
1967
  }
1968
1968
  return self.safe_string(statuses, status, status)
1969
1969
 
1970
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1970
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1971
1971
  """
1972
1972
  make a withdrawal
1973
1973
  :see: https://docs.ox.fun/?json#post-v3-withdrawal
@@ -4431,7 +4431,7 @@ class phemex(Exchange, ImplicitAPI):
4431
4431
  sorted = self.sort_by(result, 'timestamp')
4432
4432
  return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
4433
4433
 
4434
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
4434
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
4435
4435
  """
4436
4436
  make a withdrawal
4437
4437
  :see: https://phemex-docs.github.io/#create-withdraw-request
@@ -1799,7 +1799,7 @@ class poloniex(Exchange, ImplicitAPI):
1799
1799
  'status': None,
1800
1800
  }
1801
1801
 
1802
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1802
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1803
1803
  """
1804
1804
  make a withdrawal
1805
1805
  :see: https://api-docs.poloniex.com/spot/api/private/wallet#withdraw-currency