ccxt 4.4.27__py2.py3-none-any.whl → 4.4.29__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 (156) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/binance.py +7 -0
  3. ccxt/abstract/binancecoinm.py +7 -0
  4. ccxt/abstract/binanceus.py +7 -0
  5. ccxt/abstract/binanceusdm.py +7 -0
  6. ccxt/abstract/bybit.py +0 -13
  7. ccxt/alpaca.py +45 -41
  8. ccxt/async_support/__init__.py +1 -1
  9. ccxt/async_support/alpaca.py +45 -41
  10. ccxt/async_support/base/exchange.py +4 -1
  11. ccxt/async_support/bigone.py +1 -1
  12. ccxt/async_support/binance.py +8 -1
  13. ccxt/async_support/bingx.py +1 -1
  14. ccxt/async_support/bitbank.py +1 -1
  15. ccxt/async_support/bitfinex.py +1 -1
  16. ccxt/async_support/bitfinex2.py +1 -1
  17. ccxt/async_support/bitflyer.py +1 -1
  18. ccxt/async_support/bitget.py +96 -8
  19. ccxt/async_support/bithumb.py +1 -1
  20. ccxt/async_support/bitmart.py +1 -1
  21. ccxt/async_support/bitmex.py +1 -1
  22. ccxt/async_support/bitopro.py +22 -22
  23. ccxt/async_support/bitrue.py +29 -29
  24. ccxt/async_support/bitso.py +1 -1
  25. ccxt/async_support/bitstamp.py +1 -1
  26. ccxt/async_support/bitvavo.py +4 -1
  27. ccxt/async_support/blockchaincom.py +1 -1
  28. ccxt/async_support/btcmarkets.py +1 -1
  29. ccxt/async_support/bybit.py +50 -585
  30. ccxt/async_support/coinbase.py +1 -1
  31. ccxt/async_support/coinbaseexchange.py +1 -1
  32. ccxt/async_support/coinbaseinternational.py +1 -1
  33. ccxt/async_support/coincatch.py +25 -5
  34. ccxt/async_support/coinex.py +1 -1
  35. ccxt/async_support/coinlist.py +1 -1
  36. ccxt/async_support/coinmate.py +1 -1
  37. ccxt/async_support/coinsph.py +1 -1
  38. ccxt/async_support/cryptocom.py +1 -1
  39. ccxt/async_support/deribit.py +1 -1
  40. ccxt/async_support/digifinex.py +1 -1
  41. ccxt/async_support/exmo.py +1 -1
  42. ccxt/async_support/gate.py +1 -1
  43. ccxt/async_support/gemini.py +1 -1
  44. ccxt/async_support/hashkey.py +1 -1
  45. ccxt/async_support/hitbtc.py +1 -1
  46. ccxt/async_support/hollaex.py +1 -1
  47. ccxt/async_support/htx.py +1 -1
  48. ccxt/async_support/huobijp.py +1 -1
  49. ccxt/async_support/idex.py +1 -1
  50. ccxt/async_support/independentreserve.py +1 -1
  51. ccxt/async_support/indodax.py +1 -1
  52. ccxt/async_support/kraken.py +44 -36
  53. ccxt/async_support/kucoin.py +1 -1
  54. ccxt/async_support/kuna.py +1 -1
  55. ccxt/async_support/lbank.py +6 -1
  56. ccxt/async_support/lykke.py +1 -1
  57. ccxt/async_support/mercado.py +1 -1
  58. ccxt/async_support/mexc.py +1 -1
  59. ccxt/async_support/ndax.py +1 -1
  60. ccxt/async_support/novadax.py +1 -1
  61. ccxt/async_support/okcoin.py +1 -1
  62. ccxt/async_support/okx.py +1 -1
  63. ccxt/async_support/onetrading.py +1 -1
  64. ccxt/async_support/oxfun.py +1 -1
  65. ccxt/async_support/phemex.py +1 -1
  66. ccxt/async_support/poloniex.py +1 -1
  67. ccxt/async_support/probit.py +1 -1
  68. ccxt/async_support/tokocrypto.py +1 -1
  69. ccxt/async_support/upbit.py +1 -1
  70. ccxt/async_support/vertex.py +52 -8
  71. ccxt/async_support/wavesexchange.py +2 -1
  72. ccxt/async_support/whitebit.py +1 -1
  73. ccxt/async_support/woo.py +1 -1
  74. ccxt/async_support/woofipro.py +1 -1
  75. ccxt/async_support/xt.py +1 -1
  76. ccxt/async_support/yobit.py +2 -2
  77. ccxt/async_support/zaif.py +1 -1
  78. ccxt/async_support/zonda.py +1 -1
  79. ccxt/base/exchange.py +4 -1
  80. ccxt/bigone.py +1 -1
  81. ccxt/binance.py +8 -1
  82. ccxt/bingx.py +1 -1
  83. ccxt/bitbank.py +1 -1
  84. ccxt/bitfinex.py +1 -1
  85. ccxt/bitfinex2.py +1 -1
  86. ccxt/bitflyer.py +1 -1
  87. ccxt/bitget.py +96 -8
  88. ccxt/bithumb.py +1 -1
  89. ccxt/bitmart.py +1 -1
  90. ccxt/bitmex.py +1 -1
  91. ccxt/bitopro.py +22 -22
  92. ccxt/bitrue.py +29 -29
  93. ccxt/bitso.py +1 -1
  94. ccxt/bitstamp.py +1 -1
  95. ccxt/bitvavo.py +4 -1
  96. ccxt/blockchaincom.py +1 -1
  97. ccxt/btcmarkets.py +1 -1
  98. ccxt/bybit.py +50 -585
  99. ccxt/coinbase.py +1 -1
  100. ccxt/coinbaseexchange.py +1 -1
  101. ccxt/coinbaseinternational.py +1 -1
  102. ccxt/coincatch.py +25 -5
  103. ccxt/coinex.py +1 -1
  104. ccxt/coinlist.py +1 -1
  105. ccxt/coinmate.py +1 -1
  106. ccxt/coinsph.py +1 -1
  107. ccxt/cryptocom.py +1 -1
  108. ccxt/deribit.py +1 -1
  109. ccxt/digifinex.py +1 -1
  110. ccxt/exmo.py +1 -1
  111. ccxt/gate.py +1 -1
  112. ccxt/gemini.py +1 -1
  113. ccxt/hashkey.py +1 -1
  114. ccxt/hitbtc.py +1 -1
  115. ccxt/hollaex.py +1 -1
  116. ccxt/htx.py +1 -1
  117. ccxt/huobijp.py +1 -1
  118. ccxt/idex.py +1 -1
  119. ccxt/independentreserve.py +1 -1
  120. ccxt/indodax.py +1 -1
  121. ccxt/kraken.py +44 -36
  122. ccxt/kucoin.py +1 -1
  123. ccxt/kuna.py +1 -1
  124. ccxt/lbank.py +6 -1
  125. ccxt/lykke.py +1 -1
  126. ccxt/mercado.py +1 -1
  127. ccxt/mexc.py +1 -1
  128. ccxt/ndax.py +1 -1
  129. ccxt/novadax.py +1 -1
  130. ccxt/okcoin.py +1 -1
  131. ccxt/okx.py +1 -1
  132. ccxt/onetrading.py +1 -1
  133. ccxt/oxfun.py +1 -1
  134. ccxt/phemex.py +1 -1
  135. ccxt/poloniex.py +1 -1
  136. ccxt/pro/__init__.py +1 -1
  137. ccxt/pro/binance.py +4 -5
  138. ccxt/pro/bitvavo.py +2 -1
  139. ccxt/pro/mexc.py +187 -30
  140. ccxt/probit.py +1 -1
  141. ccxt/tokocrypto.py +1 -1
  142. ccxt/upbit.py +1 -1
  143. ccxt/vertex.py +52 -8
  144. ccxt/wavesexchange.py +2 -1
  145. ccxt/whitebit.py +1 -1
  146. ccxt/woo.py +1 -1
  147. ccxt/woofipro.py +1 -1
  148. ccxt/xt.py +1 -1
  149. ccxt/yobit.py +2 -2
  150. ccxt/zaif.py +1 -1
  151. ccxt/zonda.py +1 -1
  152. {ccxt-4.4.27.dist-info → ccxt-4.4.29.dist-info}/METADATA +4 -4
  153. {ccxt-4.4.27.dist-info → ccxt-4.4.29.dist-info}/RECORD +156 -156
  154. {ccxt-4.4.27.dist-info → ccxt-4.4.29.dist-info}/LICENSE.txt +0 -0
  155. {ccxt-4.4.27.dist-info → ccxt-4.4.29.dist-info}/WHEEL +0 -0
  156. {ccxt-4.4.27.dist-info → ccxt-4.4.29.dist-info}/top_level.txt +0 -0
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.vertex import ImplicitAPI
8
- from ccxt.base.types import Balances, Currencies, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFees
8
+ from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFees, Transaction
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import AuthenticationError
@@ -2735,7 +2735,7 @@ class vertex(Exchange, ImplicitAPI):
2735
2735
  #
2736
2736
  return self.safe_dict(response, 'data', {})
2737
2737
 
2738
- async def withdraw(self, code: str, amount, address, tag=None, params={}):
2738
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2739
2739
  """
2740
2740
  make a withdrawal
2741
2741
  :see: https://docs.vertexprotocol.com/developer-resources/api/withdrawing-on-chain
@@ -2773,13 +2773,57 @@ class vertex(Exchange, ImplicitAPI):
2773
2773
  }
2774
2774
  response = await self.v1GatewayPostExecute(self.extend(request, params))
2775
2775
  #
2776
- # {
2777
- # "status": "success",
2778
- # "signature": {signature},
2779
- # "request_type": "execute_withdraw_collateral"
2780
- # }
2776
+ # {
2777
+ # "status": "success",
2778
+ # "signature": {signature},
2779
+ # "request_type": "execute_withdraw_collateral"
2780
+ # }
2781
2781
  #
2782
- return response
2782
+ transaction = self.parse_transaction(response, currency)
2783
+ return self.extend(transaction, {
2784
+ 'amount': amount,
2785
+ 'address': address,
2786
+ })
2787
+
2788
+ def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
2789
+ #
2790
+ # {
2791
+ # "status": "success",
2792
+ # "signature": {signature},
2793
+ # "request_type": "execute_withdraw_collateral"
2794
+ # }
2795
+ #
2796
+ code = None
2797
+ if currency is not None:
2798
+ code = currency['code']
2799
+ return {
2800
+ 'info': transaction,
2801
+ 'id': None,
2802
+ 'txid': None,
2803
+ 'timestamp': None,
2804
+ 'datetime': None,
2805
+ 'addressFrom': None,
2806
+ 'address': None,
2807
+ 'addressTo': None,
2808
+ 'tagFrom': None,
2809
+ 'tag': None,
2810
+ 'tagTo': None,
2811
+ 'type': 'withdrawal',
2812
+ 'amount': None,
2813
+ 'currency': code,
2814
+ 'status': self.parse_transaction_status(self.safe_string(transaction, 'status')),
2815
+ 'updated': None,
2816
+ 'network': None,
2817
+ 'comment': None,
2818
+ 'internal': None,
2819
+ 'fee': None,
2820
+ }
2821
+
2822
+ def parse_transaction_status(self, status: Str):
2823
+ statuses: dict = {
2824
+ 'success': 'ok',
2825
+ }
2826
+ return self.safe_string(statuses, status, status)
2783
2827
 
2784
2828
  def handle_public_address(self, methodName: str, params: dict):
2785
2829
  userAux = None
@@ -1443,6 +1443,7 @@ class wavesexchange(Exchange, ImplicitAPI):
1443
1443
  async def fetch_order(self, id: str, symbol: Str = None, params={}):
1444
1444
  """
1445
1445
  fetches information on an order made by the user
1446
+ :see: https://matcher.waves.exchange/api-docs/index.html#/status/getOrderStatusByPKAndIdWithSig
1446
1447
  :param str symbol: unified symbol of the market the order was made in
1447
1448
  :param dict [params]: extra parameters specific to the exchange API endpoint
1448
1449
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
@@ -2290,7 +2291,7 @@ class wavesexchange(Exchange, ImplicitAPI):
2290
2291
  raise ExchangeError(self.id + ' ' + body)
2291
2292
  return None
2292
2293
 
2293
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2294
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2294
2295
  """
2295
2296
  make a withdrawal
2296
2297
  :param str code: unified currency code
@@ -1896,7 +1896,7 @@ class whitebit(Exchange, ImplicitAPI):
1896
1896
  'status': None,
1897
1897
  }
1898
1898
 
1899
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1899
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1900
1900
  """
1901
1901
  make a withdrawal
1902
1902
  :see: https://docs.whitebit.com/private/http-main-v4/#create-withdraw-request
ccxt/async_support/woo.py CHANGED
@@ -2293,7 +2293,7 @@ class woo(Exchange, ImplicitAPI):
2293
2293
  }
2294
2294
  return self.safe_string(statuses, status, status)
2295
2295
 
2296
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2296
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2297
2297
  """
2298
2298
  make a withdrawal
2299
2299
  :see: https://docs.woo.org/#token-withdraw
@@ -2184,7 +2184,7 @@ class woofipro(Exchange, ImplicitAPI):
2184
2184
  def sign_message(self, message, privateKey):
2185
2185
  return self.sign_hash(self.hash_message(message), privateKey[-64:])
2186
2186
 
2187
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2187
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2188
2188
  """
2189
2189
  make a withdrawal
2190
2190
  :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-withdraw-request
ccxt/async_support/xt.py CHANGED
@@ -3588,7 +3588,7 @@ class xt(Exchange, ImplicitAPI):
3588
3588
  withdrawals = self.safe_value(data, 'items', [])
3589
3589
  return self.parse_transactions(withdrawals, currency, since, limit, params)
3590
3590
 
3591
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
3591
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
3592
3592
  """
3593
3593
  make a withdrawal
3594
3594
  :see: https://doc.xt.com/#deposit_withdrawalwithdraw
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.yobit import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- from ccxt.base.types import Balances, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees
10
+ from ccxt.base.types import Balances, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -1186,7 +1186,7 @@ class yobit(Exchange, ImplicitAPI):
1186
1186
  'tag': None,
1187
1187
  }
1188
1188
 
1189
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1189
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1190
1190
  """
1191
1191
  :see: https://yobit.net/en/api
1192
1192
  make a withdrawal
@@ -585,7 +585,7 @@ class zaif(Exchange, ImplicitAPI):
585
585
  response = await self.privatePostTradeHistory(self.extend(request, params))
586
586
  return self.parse_orders(response['return'], market, since, limit)
587
587
 
588
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
588
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
589
589
  """
590
590
  :see: https://zaif-api-document.readthedocs.io/ja/latest/TradingAPI.html#id41
591
591
  make a withdrawal
@@ -1689,7 +1689,7 @@ class zonda(Exchange, ImplicitAPI):
1689
1689
  }
1690
1690
  return self.safe_string(statuses, status, status)
1691
1691
 
1692
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1692
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1693
1693
  """
1694
1694
  :see: https://docs.zondacrypto.exchange/reference/crypto-withdrawal-1
1695
1695
  make a withdrawal
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.27'
7
+ __version__ = '4.4.29'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2480,6 +2480,9 @@ class Exchange(object):
2480
2480
  def fetch_order_book(self, symbol: str, limit: Int = None, params={}):
2481
2481
  raise NotSupported(self.id + ' fetchOrderBook() is not supported yet')
2482
2482
 
2483
+ def fetch_order_book_ws(self, symbol: str, limit: Int = None, params={}):
2484
+ raise NotSupported(self.id + ' fetchOrderBookWs() is not supported yet')
2485
+
2483
2486
  def fetch_margin_mode(self, symbol: str, params={}):
2484
2487
  if self.has['fetchMarginModes']:
2485
2488
  marginModes = self.fetch_margin_modes([symbol], params)
ccxt/bigone.py CHANGED
@@ -2018,7 +2018,7 @@ class bigone(Exchange, ImplicitAPI):
2018
2018
  }
2019
2019
  return self.safe_string(statuses, status, 'failed')
2020
2020
 
2021
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2021
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2022
2022
  """
2023
2023
  make a withdrawal
2024
2024
  :see: https://open.big.one/docs/spot_withdrawal.html#create-withdrawal-of-user
ccxt/binance.py CHANGED
@@ -973,6 +973,9 @@ class binance(Exchange, ImplicitAPI):
973
973
  'mmp': 1,
974
974
  'countdownCancelAll': 1,
975
975
  'order': 1,
976
+ 'block/order/orders': 5,
977
+ 'block/order/execute': 5,
978
+ 'block/user-trades': 5,
976
979
  },
977
980
  'post': {
978
981
  'order': 1,
@@ -982,9 +985,12 @@ class binance(Exchange, ImplicitAPI):
982
985
  'mmpReset': 1,
983
986
  'countdownCancelAll': 1,
984
987
  'countdownCancelAllHeartBeat': 10,
988
+ 'block/order/create': 5,
989
+ 'block/order/execute': 5,
985
990
  },
986
991
  'put': {
987
992
  'listenKey': 1,
993
+ 'block/order/create': 5,
988
994
  },
989
995
  'delete': {
990
996
  'order': 1,
@@ -992,6 +998,7 @@ class binance(Exchange, ImplicitAPI):
992
998
  'allOpenOrders': 1,
993
999
  'allOpenOrdersByUnderlying': 1,
994
1000
  'listenKey': 1,
1001
+ 'block/order/create': 5,
995
1002
  },
996
1003
  },
997
1004
  'public': {
@@ -8473,7 +8480,7 @@ class binance(Exchange, ImplicitAPI):
8473
8480
  }
8474
8481
  return result
8475
8482
 
8476
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
8483
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
8477
8484
  """
8478
8485
  make a withdrawal
8479
8486
  :see: https://developers.binance.com/docs/wallet/capital/withdraw
ccxt/bingx.py CHANGED
@@ -4977,7 +4977,7 @@ class bingx(Exchange, ImplicitAPI):
4977
4977
  coins = self.safe_list(response, 'data')
4978
4978
  return self.parse_deposit_withdraw_fees(coins, codes, 'coin')
4979
4979
 
4980
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
4980
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
4981
4981
  """
4982
4982
  make a withdrawal
4983
4983
  :see: https://bingx-api.github.io/docs/#/en-us/spot/wallet-api.html#Withdraw
ccxt/bitbank.py CHANGED
@@ -814,7 +814,7 @@ class bitbank(Exchange, ImplicitAPI):
814
814
  'tag': None,
815
815
  }
816
816
 
817
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
817
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
818
818
  """
819
819
  make a withdrawal
820
820
  :see: https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#new-withdrawal-request
ccxt/bitfinex.py CHANGED
@@ -1528,7 +1528,7 @@ class bitfinex(Exchange, ImplicitAPI):
1528
1528
  }
1529
1529
  return self.safe_string(statuses, status, status)
1530
1530
 
1531
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1531
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1532
1532
  """
1533
1533
  make a withdrawal
1534
1534
  :see: https://docs.bitfinex.com/v1/reference/rest-auth-withdrawal
ccxt/bitfinex2.py CHANGED
@@ -2458,7 +2458,7 @@ class bitfinex2(Exchange, ImplicitAPI):
2458
2458
  #
2459
2459
  return self.parse_transactions(response, currency, since, limit)
2460
2460
 
2461
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2461
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2462
2462
  """
2463
2463
  make a withdrawal
2464
2464
  :see: https://docs.bitfinex.com/reference/rest-auth-withdraw
ccxt/bitflyer.py CHANGED
@@ -775,7 +775,7 @@ class bitflyer(Exchange, ImplicitAPI):
775
775
  # todo unify parsePosition/parsePositions
776
776
  return response
777
777
 
778
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
778
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
779
779
  """
780
780
  make a withdrawal
781
781
  :see: https://lightning.bitflyer.com/docs?lang=en#withdrawing-funds
ccxt/bitget.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitget import ImplicitAPI
8
8
  import hashlib
9
9
  import json
10
- from ccxt.base.types import Balances, BorrowInterest, Conversion, CrossBorrowRate, Currencies, Currency, DepositAddress, FundingHistory, Int, IsolatedBorrowRate, LedgerEntry, Leverage, LeverageTier, Liquidation, LongShortRatio, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
10
+ from ccxt.base.types import Balances, BorrowInterest, Conversion, CrossBorrowRate, Currencies, Currency, DepositAddress, FundingHistory, Int, IsolatedBorrowRate, LedgerEntry, Leverage, LeverageTier, Liquidation, LongShortRatio, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -105,7 +105,7 @@ class bitget(Exchange, ImplicitAPI):
105
105
  'fetchFundingIntervals': False,
106
106
  'fetchFundingRate': True,
107
107
  'fetchFundingRateHistory': True,
108
- 'fetchFundingRates': False,
108
+ 'fetchFundingRates': True,
109
109
  'fetchIndexOHLCV': True,
110
110
  'fetchIsolatedBorrowRate': True,
111
111
  'fetchIsolatedBorrowRates': False,
@@ -2142,7 +2142,7 @@ class bitget(Exchange, ImplicitAPI):
2142
2142
  rawTransactions = self.safe_list(response, 'data', [])
2143
2143
  return self.parse_transactions(rawTransactions, currency, since, limit)
2144
2144
 
2145
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2145
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2146
2146
  """
2147
2147
  make a withdrawal
2148
2148
  :see: https://www.bitget.com/api-doc/spot/account/Wallet-Withdrawal
@@ -6350,6 +6350,66 @@ class bitget(Exchange, ImplicitAPI):
6350
6350
  data = self.safe_value(response, 'data', [])
6351
6351
  return self.parse_funding_rate(data[0], market)
6352
6352
 
6353
+ def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
6354
+ """
6355
+ fetch the current funding rates for all markets
6356
+ :see: https://www.bitget.com/api-doc/contract/market/Get-All-Symbol-Ticker
6357
+ :param str[] [symbols]: list of unified market symbols
6358
+ :param dict [params]: extra parameters specific to the exchange API endpoint
6359
+ :param str [params.subType]: *contract only* 'linear', 'inverse'
6360
+ :param str [params.productType]: *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
6361
+ :returns dict: a dictionary of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexed by market symbols
6362
+ """
6363
+ self.load_markets()
6364
+ market = None
6365
+ if symbols is not None:
6366
+ symbol = self.safe_value(symbols, 0)
6367
+ sandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
6368
+ if sandboxMode:
6369
+ sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
6370
+ market = self.market(sandboxSymbol)
6371
+ else:
6372
+ market = self.market(symbol)
6373
+ request: dict = {}
6374
+ productType = None
6375
+ productType, params = self.handle_product_type_and_params(market, params)
6376
+ request['productType'] = productType
6377
+ response = self.publicMixGetV2MixMarketTickers(self.extend(request, params))
6378
+ # {
6379
+ # "code": "00000",
6380
+ # "msg": "success",
6381
+ # "requestTime": 1700533773477,
6382
+ # "data": [
6383
+ # {
6384
+ # "symbol": "BTCUSD",
6385
+ # "lastPr": "29904.5",
6386
+ # "askPr": "29904.5",
6387
+ # "bidPr": "29903.5",
6388
+ # "bidSz": "0.5091",
6389
+ # "askSz": "2.2694",
6390
+ # "high24h": "0",
6391
+ # "low24h": "0",
6392
+ # "ts": "1695794271400",
6393
+ # "change24h": "0",
6394
+ # "baseVolume": "0",
6395
+ # "quoteVolume": "0",
6396
+ # "usdtVolume": "0",
6397
+ # "openUtc": "0",
6398
+ # "changeUtc24h": "0",
6399
+ # "indexPrice": "29132.353333",
6400
+ # "fundingRate": "-0.0007",
6401
+ # "holdingAmount": "125.6844",
6402
+ # "deliveryStartTime": null,
6403
+ # "deliveryTime": null,
6404
+ # "deliveryStatus": "delivery_normal",
6405
+ # "open24h": "0",
6406
+ # "markPrice": "12345"
6407
+ # },
6408
+ # ]
6409
+ # }
6410
+ data = self.safe_list(response, 'data', [])
6411
+ return self.parse_funding_rates(data, market)
6412
+
6353
6413
  def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
6354
6414
  #
6355
6415
  # fetchFundingRate
@@ -6366,23 +6426,51 @@ class bitget(Exchange, ImplicitAPI):
6366
6426
  # "nextFundingTime": "1727942400000",
6367
6427
  # "ratePeriod": "8"
6368
6428
  # }
6369
- #
6429
+ # fetchFundingRates
6430
+ # {
6431
+ # "symbol": "BTCUSD",
6432
+ # "lastPr": "29904.5",
6433
+ # "askPr": "29904.5",
6434
+ # "bidPr": "29903.5",
6435
+ # "bidSz": "0.5091",
6436
+ # "askSz": "2.2694",
6437
+ # "high24h": "0",
6438
+ # "low24h": "0",
6439
+ # "ts": "1695794271400",
6440
+ # "change24h": "0",
6441
+ # "baseVolume": "0",
6442
+ # "quoteVolume": "0",
6443
+ # "usdtVolume": "0",
6444
+ # "openUtc": "0",
6445
+ # "changeUtc24h": "0",
6446
+ # "indexPrice": "29132.353333",
6447
+ # "fundingRate": "-0.0007",
6448
+ # "holdingAmount": "125.6844",
6449
+ # "deliveryStartTime": null,
6450
+ # "deliveryTime": null,
6451
+ # "deliveryStatus": "delivery_normal",
6452
+ # "open24h": "0",
6453
+ # "markPrice": "12345"
6454
+ # }
6370
6455
  marketId = self.safe_string(contract, 'symbol')
6371
6456
  symbol = self.safe_symbol(marketId, market, None, 'swap')
6372
6457
  fundingTimestamp = self.safe_integer(contract, 'nextFundingTime')
6373
6458
  interval = self.safe_string(contract, 'ratePeriod')
6459
+ timestamp = self.safe_integer(contract, 'ts')
6460
+ markPrice = self.safe_number(contract, 'markPrice')
6461
+ indexPrice = self.safe_number(contract, 'indexPrice')
6374
6462
  intervalString = None
6375
6463
  if interval is not None:
6376
6464
  intervalString = interval + 'h'
6377
6465
  return {
6378
6466
  'info': contract,
6379
6467
  'symbol': symbol,
6380
- 'markPrice': None,
6381
- 'indexPrice': None,
6468
+ 'markPrice': markPrice,
6469
+ 'indexPrice': indexPrice,
6382
6470
  'interestRate': None,
6383
6471
  'estimatedSettlePrice': None,
6384
- 'timestamp': None,
6385
- 'datetime': None,
6472
+ 'timestamp': timestamp,
6473
+ 'datetime': self.iso8601(timestamp),
6386
6474
  'fundingRate': self.safe_number(contract, 'fundingRate'),
6387
6475
  'fundingTimestamp': fundingTimestamp,
6388
6476
  'fundingDatetime': self.iso8601(fundingTimestamp),
ccxt/bithumb.py CHANGED
@@ -982,7 +982,7 @@ class bithumb(Exchange, ImplicitAPI):
982
982
  }
983
983
  return self.cancel_order(order['id'], order['symbol'], self.extend(request, params))
984
984
 
985
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
985
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
986
986
  """
987
987
  make a withdrawal
988
988
  :see: https://apidocs.bithumb.com/v1.2.0/reference/%EC%BD%94%EC%9D%B8-%EC%B6%9C%EA%B8%88%ED%95%98%EA%B8%B0-%EA%B0%9C%EC%9D%B8
ccxt/bitmart.py CHANGED
@@ -3277,7 +3277,7 @@ class bitmart(Exchange, ImplicitAPI):
3277
3277
  'tag': self.safe_string(depositAddress, 'address_memo'),
3278
3278
  }
3279
3279
 
3280
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
3280
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
3281
3281
  """
3282
3282
  make a withdrawal
3283
3283
  :param str code: unified currency code
ccxt/bitmex.py CHANGED
@@ -2285,7 +2285,7 @@ class bitmex(Exchange, ImplicitAPI):
2285
2285
  'takeProfitPrice': None,
2286
2286
  })
2287
2287
 
2288
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2288
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2289
2289
  """
2290
2290
  make a withdrawal
2291
2291
  :see: https://www.bitmex.com/api/explorer/#not /User/User_requestWithdrawal