ccxt 4.4.98__py2.py3-none-any.whl → 4.4.100__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 (234) hide show
  1. ccxt/__init__.py +3 -1
  2. ccxt/abstract/bingx.py +1 -0
  3. ccxt/abstract/bitget.py +6 -0
  4. ccxt/abstract/hibachi.py +26 -0
  5. ccxt/alpaca.py +1 -1
  6. ccxt/apex.py +1 -1
  7. ccxt/ascendex.py +1 -1
  8. ccxt/async_support/__init__.py +3 -1
  9. ccxt/async_support/alpaca.py +1 -1
  10. ccxt/async_support/apex.py +1 -1
  11. ccxt/async_support/ascendex.py +1 -1
  12. ccxt/async_support/base/exchange.py +44 -9
  13. ccxt/async_support/base/ws/client.py +3 -1
  14. ccxt/async_support/bigone.py +1 -1
  15. ccxt/async_support/binance.py +10 -8
  16. ccxt/async_support/bingx.py +33 -4
  17. ccxt/async_support/bitbank.py +1 -1
  18. ccxt/async_support/bitfinex.py +4 -1
  19. ccxt/async_support/bitflyer.py +1 -1
  20. ccxt/async_support/bitget.py +2040 -561
  21. ccxt/async_support/bithumb.py +1 -1
  22. ccxt/async_support/bitmart.py +2 -2
  23. ccxt/async_support/bitmex.py +3 -2
  24. ccxt/async_support/bitopro.py +1 -1
  25. ccxt/async_support/bitrue.py +2 -2
  26. ccxt/async_support/bitso.py +1 -1
  27. ccxt/async_support/bitstamp.py +1 -1
  28. ccxt/async_support/bittrade.py +1 -1
  29. ccxt/async_support/bitvavo.py +1 -1
  30. ccxt/async_support/blockchaincom.py +1 -1
  31. ccxt/async_support/blofin.py +1 -1
  32. ccxt/async_support/btcmarkets.py +1 -1
  33. ccxt/async_support/bybit.py +7 -3
  34. ccxt/async_support/coinbase.py +1 -1
  35. ccxt/async_support/coinbaseexchange.py +1 -1
  36. ccxt/async_support/coinbaseinternational.py +1 -1
  37. ccxt/async_support/coincatch.py +2 -2
  38. ccxt/async_support/coinex.py +67 -6
  39. ccxt/async_support/coinmate.py +1 -1
  40. ccxt/async_support/coinsph.py +1 -1
  41. ccxt/async_support/cryptocom.py +2 -2
  42. ccxt/async_support/defx.py +2 -2
  43. ccxt/async_support/delta.py +1 -1
  44. ccxt/async_support/deribit.py +1 -1
  45. ccxt/async_support/digifinex.py +2 -2
  46. ccxt/async_support/ellipx.py +1 -1
  47. ccxt/async_support/exmo.py +1 -1
  48. ccxt/async_support/foxbit.py +3 -3
  49. ccxt/async_support/gate.py +18 -4
  50. ccxt/async_support/gemini.py +1 -1
  51. ccxt/async_support/hashkey.py +2 -2
  52. ccxt/async_support/hibachi.py +2080 -0
  53. ccxt/async_support/hitbtc.py +2 -2
  54. ccxt/async_support/hollaex.py +1 -1
  55. ccxt/async_support/htx.py +4 -3
  56. ccxt/async_support/hyperliquid.py +71 -29
  57. ccxt/async_support/independentreserve.py +1 -1
  58. ccxt/async_support/indodax.py +1 -1
  59. ccxt/async_support/kraken.py +1 -1
  60. ccxt/async_support/krakenfutures.py +2 -1
  61. ccxt/async_support/kucoin.py +2 -2
  62. ccxt/async_support/kucoinfutures.py +2 -1
  63. ccxt/async_support/lbank.py +2 -2
  64. ccxt/async_support/mercado.py +1 -1
  65. ccxt/async_support/mexc.py +9 -2
  66. ccxt/async_support/modetrade.py +93 -2
  67. ccxt/async_support/ndax.py +1 -1
  68. ccxt/async_support/novadax.py +35 -1
  69. ccxt/async_support/okcoin.py +1 -1
  70. ccxt/async_support/okx.py +2 -2
  71. ccxt/async_support/onetrading.py +33 -0
  72. ccxt/async_support/oxfun.py +1 -1
  73. ccxt/async_support/p2b.py +32 -0
  74. ccxt/async_support/paradex.py +2 -1
  75. ccxt/async_support/phemex.py +2 -2
  76. ccxt/async_support/poloniex.py +2 -2
  77. ccxt/async_support/probit.py +36 -1
  78. ccxt/async_support/tokocrypto.py +1 -1
  79. ccxt/async_support/upbit.py +1 -1
  80. ccxt/async_support/vertex.py +1 -1
  81. ccxt/async_support/wavesexchange.py +1 -1
  82. ccxt/async_support/whitebit.py +2 -2
  83. ccxt/async_support/woo.py +4 -4
  84. ccxt/async_support/woofipro.py +93 -2
  85. ccxt/async_support/xt.py +2 -2
  86. ccxt/async_support/yobit.py +1 -1
  87. ccxt/async_support/zaif.py +1 -1
  88. ccxt/async_support/zonda.py +1 -1
  89. ccxt/base/errors.py +0 -6
  90. ccxt/base/exchange.py +11 -9
  91. ccxt/base/types.py +1 -0
  92. ccxt/bigone.py +1 -1
  93. ccxt/binance.py +10 -8
  94. ccxt/bingx.py +33 -4
  95. ccxt/bitbank.py +1 -1
  96. ccxt/bitfinex.py +4 -1
  97. ccxt/bitflyer.py +1 -1
  98. ccxt/bitget.py +2040 -561
  99. ccxt/bithumb.py +1 -1
  100. ccxt/bitmart.py +2 -2
  101. ccxt/bitmex.py +3 -2
  102. ccxt/bitopro.py +1 -1
  103. ccxt/bitrue.py +2 -2
  104. ccxt/bitso.py +1 -1
  105. ccxt/bitstamp.py +1 -1
  106. ccxt/bittrade.py +1 -1
  107. ccxt/bitvavo.py +1 -1
  108. ccxt/blockchaincom.py +1 -1
  109. ccxt/blofin.py +1 -1
  110. ccxt/btcmarkets.py +1 -1
  111. ccxt/bybit.py +7 -3
  112. ccxt/coinbase.py +1 -1
  113. ccxt/coinbaseexchange.py +1 -1
  114. ccxt/coinbaseinternational.py +1 -1
  115. ccxt/coincatch.py +2 -2
  116. ccxt/coinex.py +67 -6
  117. ccxt/coinmate.py +1 -1
  118. ccxt/coinsph.py +1 -1
  119. ccxt/cryptocom.py +2 -2
  120. ccxt/defx.py +2 -2
  121. ccxt/delta.py +1 -1
  122. ccxt/deribit.py +1 -1
  123. ccxt/digifinex.py +2 -2
  124. ccxt/ellipx.py +1 -1
  125. ccxt/exmo.py +1 -1
  126. ccxt/foxbit.py +3 -3
  127. ccxt/gate.py +18 -4
  128. ccxt/gemini.py +1 -1
  129. ccxt/hashkey.py +2 -2
  130. ccxt/hibachi.py +2079 -0
  131. ccxt/hitbtc.py +2 -2
  132. ccxt/hollaex.py +1 -1
  133. ccxt/htx.py +4 -3
  134. ccxt/hyperliquid.py +71 -29
  135. ccxt/independentreserve.py +1 -1
  136. ccxt/indodax.py +1 -1
  137. ccxt/kraken.py +1 -1
  138. ccxt/krakenfutures.py +2 -1
  139. ccxt/kucoin.py +2 -2
  140. ccxt/kucoinfutures.py +2 -1
  141. ccxt/lbank.py +2 -2
  142. ccxt/mercado.py +1 -1
  143. ccxt/mexc.py +9 -2
  144. ccxt/modetrade.py +93 -2
  145. ccxt/ndax.py +1 -1
  146. ccxt/novadax.py +35 -1
  147. ccxt/okcoin.py +1 -1
  148. ccxt/okx.py +2 -2
  149. ccxt/onetrading.py +33 -0
  150. ccxt/oxfun.py +1 -1
  151. ccxt/p2b.py +32 -0
  152. ccxt/paradex.py +2 -1
  153. ccxt/phemex.py +2 -2
  154. ccxt/poloniex.py +2 -2
  155. ccxt/pro/__init__.py +1 -1
  156. ccxt/pro/alpaca.py +2 -2
  157. ccxt/pro/apex.py +2 -2
  158. ccxt/pro/ascendex.py +2 -2
  159. ccxt/pro/binance.py +4 -5
  160. ccxt/pro/bitget.py +3 -3
  161. ccxt/pro/bithumb.py +2 -2
  162. ccxt/pro/bitmart.py +2 -2
  163. ccxt/pro/bitmex.py +3 -3
  164. ccxt/pro/bitstamp.py +3 -3
  165. ccxt/pro/bittrade.py +2 -2
  166. ccxt/pro/bitvavo.py +5 -3
  167. ccxt/pro/bybit.py +5 -4
  168. ccxt/pro/cex.py +3 -2
  169. ccxt/pro/coinbaseexchange.py +4 -4
  170. ccxt/pro/coinbaseinternational.py +2 -2
  171. ccxt/pro/coincatch.py +1 -1
  172. ccxt/pro/coinex.py +1 -1
  173. ccxt/pro/coinone.py +2 -2
  174. ccxt/pro/cryptocom.py +2 -2
  175. ccxt/pro/derive.py +2 -2
  176. ccxt/pro/gate.py +3 -3
  177. ccxt/pro/hollaex.py +2 -2
  178. ccxt/pro/htx.py +3 -3
  179. ccxt/pro/hyperliquid.py +101 -14
  180. ccxt/pro/kraken.py +2 -2
  181. ccxt/pro/krakenfutures.py +4 -3
  182. ccxt/pro/kucoin.py +4 -3
  183. ccxt/pro/kucoinfutures.py +4 -3
  184. ccxt/pro/mexc.py +328 -139
  185. ccxt/pro/modetrade.py +2 -2
  186. ccxt/pro/okcoin.py +2 -2
  187. ccxt/pro/okx.py +7 -6
  188. ccxt/pro/onetrading.py +2 -2
  189. ccxt/pro/oxfun.py +1 -1
  190. ccxt/pro/p2b.py +2 -2
  191. ccxt/pro/paradex.py +2 -2
  192. ccxt/pro/poloniex.py +2 -2
  193. ccxt/pro/probit.py +2 -2
  194. ccxt/pro/vertex.py +2 -2
  195. ccxt/pro/whitebit.py +2 -2
  196. ccxt/pro/woo.py +2 -2
  197. ccxt/pro/woofipro.py +2 -2
  198. ccxt/probit.py +36 -1
  199. ccxt/protobuf/__init__.py +0 -0
  200. ccxt/protobuf/mexc/PrivateAccountV3Api_pb2.py +37 -0
  201. ccxt/protobuf/mexc/PrivateDealsV3Api_pb2.py +37 -0
  202. ccxt/protobuf/mexc/PrivateOrdersV3Api_pb2.py +37 -0
  203. ccxt/protobuf/mexc/PublicAggreBookTickerV3Api_pb2.py +37 -0
  204. ccxt/protobuf/mexc/PublicAggreDealsV3Api_pb2.py +39 -0
  205. ccxt/protobuf/mexc/PublicAggreDepthsV3Api_pb2.py +39 -0
  206. ccxt/protobuf/mexc/PublicBookTickerBatchV3Api_pb2.py +38 -0
  207. ccxt/protobuf/mexc/PublicBookTickerV3Api_pb2.py +37 -0
  208. ccxt/protobuf/mexc/PublicDealsV3Api_pb2.py +39 -0
  209. ccxt/protobuf/mexc/PublicIncreaseDepthsBatchV3Api_pb2.py +38 -0
  210. ccxt/protobuf/mexc/PublicIncreaseDepthsV3Api_pb2.py +39 -0
  211. ccxt/protobuf/mexc/PublicLimitDepthsV3Api_pb2.py +39 -0
  212. ccxt/protobuf/mexc/PublicMiniTickerV3Api_pb2.py +37 -0
  213. ccxt/protobuf/mexc/PublicMiniTickersV3Api_pb2.py +38 -0
  214. ccxt/protobuf/mexc/PublicSpotKlineV3Api_pb2.py +37 -0
  215. ccxt/protobuf/mexc/PushDataV3ApiWrapper_pb2.py +52 -0
  216. ccxt/protobuf/mexc/__init__.py +0 -0
  217. ccxt/test/tests_async.py +1 -1
  218. ccxt/test/tests_sync.py +1 -1
  219. ccxt/tokocrypto.py +1 -1
  220. ccxt/upbit.py +1 -1
  221. ccxt/vertex.py +1 -1
  222. ccxt/wavesexchange.py +1 -1
  223. ccxt/whitebit.py +2 -2
  224. ccxt/woo.py +4 -4
  225. ccxt/woofipro.py +93 -2
  226. ccxt/xt.py +2 -2
  227. ccxt/yobit.py +1 -1
  228. ccxt/zaif.py +1 -1
  229. ccxt/zonda.py +1 -1
  230. {ccxt-4.4.98.dist-info → ccxt-4.4.100.dist-info}/METADATA +8 -7
  231. {ccxt-4.4.98.dist-info → ccxt-4.4.100.dist-info}/RECORD +234 -213
  232. {ccxt-4.4.98.dist-info → ccxt-4.4.100.dist-info}/LICENSE.txt +0 -0
  233. {ccxt-4.4.98.dist-info → ccxt-4.4.100.dist-info}/WHEEL +0 -0
  234. {ccxt-4.4.98.dist-info → ccxt-4.4.100.dist-info}/top_level.txt +0 -0
ccxt/hitbtc.py CHANGED
@@ -2648,7 +2648,7 @@ class hitbtc(Exchange, ImplicitAPI):
2648
2648
  'info': response,
2649
2649
  }
2650
2650
 
2651
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2651
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
2652
2652
  """
2653
2653
  make a withdrawal
2654
2654
 
@@ -3417,7 +3417,7 @@ class hitbtc(Exchange, ImplicitAPI):
3417
3417
  'shortLeverage': leverageValue,
3418
3418
  }
3419
3419
 
3420
- def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
3420
+ def set_leverage(self, leverage: int, symbol: Str = None, params={}):
3421
3421
  """
3422
3422
  set the level of leverage for a market
3423
3423
 
ccxt/hollaex.py CHANGED
@@ -1798,7 +1798,7 @@ class hollaex(Exchange, ImplicitAPI):
1798
1798
  'fee': fee,
1799
1799
  }
1800
1800
 
1801
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1801
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
1802
1802
  """
1803
1803
  make a withdrawal
1804
1804
 
ccxt/htx.py CHANGED
@@ -5016,7 +5016,7 @@ class htx(Exchange, ImplicitAPI):
5016
5016
  params['createMarketBuyOrderRequiresPrice'] = False
5017
5017
  return self.create_order(symbol, 'market', 'buy', cost, None, params)
5018
5018
 
5019
- def create_trailing_percent_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingPercent=None, trailingTriggerPrice=None, params={}) -> Order:
5019
+ def create_trailing_percent_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingPercent: Num = None, trailingTriggerPrice: Num = None, params={}) -> Order:
5020
5020
  """
5021
5021
  create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
5022
5022
  :param str symbol: unified symbol of the market to create an order in
@@ -6308,7 +6308,7 @@ class htx(Exchange, ImplicitAPI):
6308
6308
  }
6309
6309
  return self.safe_string(statuses, status, status)
6310
6310
 
6311
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
6311
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
6312
6312
  """
6313
6313
 
6314
6314
  https://www.htx.com/en-us/opend/newApiPages/?id=7ec4cc41-7773-11ed-9966-0242ac110003
@@ -7133,7 +7133,7 @@ class htx(Exchange, ImplicitAPI):
7133
7133
  data = self.safe_list(response, 'data', [])
7134
7134
  return self.parse_incomes(data, market, since, limit)
7135
7135
 
7136
- def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
7136
+ def set_leverage(self, leverage: int, symbol: Str = None, params={}):
7137
7137
  """
7138
7138
  set the level of leverage for a market
7139
7139
 
@@ -8852,6 +8852,7 @@ class htx(Exchange, ImplicitAPI):
8852
8852
  'contracts': self.safe_number(liquidation, 'volume'),
8853
8853
  'contractSize': self.safe_number(market, 'contractSize'),
8854
8854
  'price': self.safe_number(liquidation, 'price'),
8855
+ 'side': self.safe_string_lower(liquidation, 'direction'),
8855
8856
  'baseValue': self.safe_number(liquidation, 'amount'),
8856
8857
  'quoteValue': self.safe_number(liquidation, 'trade_turnover'),
8857
8858
  'timestamp': timestamp,
ccxt/hyperliquid.py CHANGED
@@ -1675,6 +1675,43 @@ class hyperliquid(Exchange, ImplicitAPI):
1675
1675
  if symbol is None:
1676
1676
  raise ArgumentsRequired(self.id + ' cancelOrders() requires a symbol argument')
1677
1677
  self.load_markets()
1678
+ request = self.cancel_orders_request(ids, symbol, params)
1679
+ response = self.privatePostExchange(request)
1680
+ #
1681
+ # {
1682
+ # "status":"ok",
1683
+ # "response":{
1684
+ # "type":"cancel",
1685
+ # "data":{
1686
+ # "statuses":[
1687
+ # "success"
1688
+ # ]
1689
+ # }
1690
+ # }
1691
+ # }
1692
+ #
1693
+ innerResponse = self.safe_dict(response, 'response')
1694
+ data = self.safe_dict(innerResponse, 'data')
1695
+ statuses = self.safe_list(data, 'statuses')
1696
+ orders = []
1697
+ for i in range(0, len(statuses)):
1698
+ status = statuses[i]
1699
+ orders.append(self.safe_order({
1700
+ 'info': status,
1701
+ 'status': status,
1702
+ }))
1703
+ return orders
1704
+
1705
+ def cancel_orders_request(self, ids: List[str], symbol: Str = None, params={}) -> dict:
1706
+ """
1707
+ build the request payload for cancelling multiple orders
1708
+ https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
1709
+ https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
1710
+ :param str[] ids: order ids
1711
+ :param str symbol: unified market symbol
1712
+ :param dict [params]:
1713
+ :returns dict: the raw request object to be sent to the exchange
1714
+ """
1678
1715
  market = self.market(symbol)
1679
1716
  clientOrderId = self.safe_value_2(params, 'clientOrderId', 'client_id')
1680
1717
  params = self.omit(params, ['clientOrderId', 'client_id'])
@@ -1715,31 +1752,7 @@ class hyperliquid(Exchange, ImplicitAPI):
1715
1752
  if vaultAddress is not None:
1716
1753
  params = self.omit(params, 'vaultAddress')
1717
1754
  request['vaultAddress'] = vaultAddress
1718
- response = self.privatePostExchange(request)
1719
- #
1720
- # {
1721
- # "status":"ok",
1722
- # "response":{
1723
- # "type":"cancel",
1724
- # "data":{
1725
- # "statuses":[
1726
- # "success"
1727
- # ]
1728
- # }
1729
- # }
1730
- # }
1731
- #
1732
- innerResponse = self.safe_dict(response, 'response')
1733
- data = self.safe_dict(innerResponse, 'data')
1734
- statuses = self.safe_list(data, 'statuses')
1735
- orders = []
1736
- for i in range(0, len(statuses)):
1737
- status = statuses[i]
1738
- orders.append(self.safe_order({
1739
- 'info': status,
1740
- 'status': status,
1741
- }))
1742
- return orders
1755
+ return request
1743
1756
 
1744
1757
  def cancel_orders_for_symbols(self, orders: List[CancellationRequest], params={}):
1745
1758
  """
@@ -2468,6 +2481,8 @@ class hyperliquid(Exchange, ImplicitAPI):
2468
2481
  }, market)
2469
2482
 
2470
2483
  def parse_order_status(self, status: Str):
2484
+ if status is None:
2485
+ return None
2471
2486
  statuses: dict = {
2472
2487
  'triggered': 'open',
2473
2488
  'filled': 'closed',
@@ -2476,6 +2491,10 @@ class hyperliquid(Exchange, ImplicitAPI):
2476
2491
  'rejected': 'rejected',
2477
2492
  'marginCanceled': 'canceled',
2478
2493
  }
2494
+ if status.endswith('Rejected'):
2495
+ return 'rejected'
2496
+ if status.endswith('Canceled'):
2497
+ return 'canceled'
2479
2498
  return self.safe_string(statuses, status, status)
2480
2499
 
2481
2500
  def parse_order_type(self, status):
@@ -2805,7 +2824,7 @@ class hyperliquid(Exchange, ImplicitAPI):
2805
2824
  #
2806
2825
  return response
2807
2826
 
2808
- def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
2827
+ def set_leverage(self, leverage: int, symbol: Str = None, params={}):
2809
2828
  """
2810
2829
  set the level of leverage for a market
2811
2830
  :param float leverage: the rate of leverage
@@ -3058,7 +3077,7 @@ class hyperliquid(Exchange, ImplicitAPI):
3058
3077
  'status': 'ok',
3059
3078
  }
3060
3079
 
3061
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
3080
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
3062
3081
  """
3063
3082
  make a withdrawal(only support USDC)
3064
3083
 
@@ -3586,6 +3605,27 @@ class hyperliquid(Exchange, ImplicitAPI):
3586
3605
  'rate': rate,
3587
3606
  }
3588
3607
 
3608
+ def reserve_request_weight(self, weight: Num, params={}) -> dict:
3609
+ """
3610
+ Instead of trading to increase the address based rate limits, self action allows reserving additional actions for 0.0005 USDC per request. The cost is paid from the Perps balance.
3611
+ :param number weight: the weight to reserve, 1 weight = 1 action, 0.0005 USDC per action
3612
+ :param dict [params]: extra parameters specific to the exchange API endpoint
3613
+ :returns dict: a response object
3614
+ """
3615
+ nonce = self.milliseconds()
3616
+ request: dict = {
3617
+ 'nonce': nonce,
3618
+ }
3619
+ action: dict = {
3620
+ 'type': 'reserveRequestWeight',
3621
+ 'weight': weight,
3622
+ }
3623
+ signature = self.sign_l1_action(action, nonce)
3624
+ request['action'] = action
3625
+ request['signature'] = signature
3626
+ response = self.privatePostExchange(self.extend(request, params))
3627
+ return response
3628
+
3589
3629
  def extract_type_from_delta(self, data=[]):
3590
3630
  records = []
3591
3631
  for i in range(0, len(data)):
@@ -3639,8 +3679,10 @@ class hyperliquid(Exchange, ImplicitAPI):
3639
3679
  responsePayload = self.safe_dict(response, 'response', {})
3640
3680
  data = self.safe_dict(responsePayload, 'data', {})
3641
3681
  statuses = self.safe_list(data, 'statuses', [])
3642
- firstStatus = self.safe_dict(statuses, 0)
3643
- message = self.safe_string(firstStatus, 'error')
3682
+ for i in range(0, len(statuses)):
3683
+ message = self.safe_string(statuses[i], 'error')
3684
+ if message is not None:
3685
+ break
3644
3686
  feedback = self.id + ' ' + body
3645
3687
  nonEmptyMessage = ((message is not None) and (message != ''))
3646
3688
  if nonEmptyMessage:
@@ -922,7 +922,7 @@ class independentreserve(Exchange, ImplicitAPI):
922
922
  'tag': self.safe_string(depositAddress, 'Tag'),
923
923
  }
924
924
 
925
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
925
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
926
926
  """
927
927
  make a withdrawal
928
928
 
ccxt/indodax.py CHANGED
@@ -1144,7 +1144,7 @@ class indodax(Exchange, ImplicitAPI):
1144
1144
  transactions = self.array_concat(withdraws, deposits)
1145
1145
  return self.parse_transactions(transactions, currency, since, limit)
1146
1146
 
1147
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1147
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
1148
1148
  """
1149
1149
  make a withdrawal
1150
1150
 
ccxt/kraken.py CHANGED
@@ -3037,7 +3037,7 @@ class kraken(Exchange, ImplicitAPI):
3037
3037
  'tag': tag,
3038
3038
  }
3039
3039
 
3040
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
3040
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
3041
3041
  """
3042
3042
  make a withdrawal
3043
3043
 
ccxt/krakenfutures.py CHANGED
@@ -246,6 +246,7 @@ class krakenfutures(Exchange, ImplicitAPI):
246
246
  'executions': 'private',
247
247
  'triggers': 'private',
248
248
  'accountlogcsv': 'private',
249
+ 'account-log': 'private',
249
250
  },
250
251
  },
251
252
  },
@@ -2606,7 +2607,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2606
2607
  'toAccount': toAccount,
2607
2608
  })
2608
2609
 
2609
- def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
2610
+ def set_leverage(self, leverage: int, symbol: Str = None, params={}):
2610
2611
  """
2611
2612
  set the level of leverage for a market
2612
2613
 
ccxt/kucoin.py CHANGED
@@ -3386,7 +3386,7 @@ class kucoin(Exchange, ImplicitAPI):
3386
3386
  'tierBased': True,
3387
3387
  }
3388
3388
 
3389
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
3389
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
3390
3390
  """
3391
3391
  make a withdrawal
3392
3392
 
@@ -4801,7 +4801,7 @@ class kucoin(Exchange, ImplicitAPI):
4801
4801
  data = self.safe_list(response, 'data', [])
4802
4802
  return self.parse_deposit_withdraw_fees(data, codes, 'currency')
4803
4803
 
4804
- def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
4804
+ def set_leverage(self, leverage: int, symbol: Str = None, params={}):
4805
4805
  """
4806
4806
  set the level of leverage for a market
4807
4807
 
ccxt/kucoinfutures.py CHANGED
@@ -2416,6 +2416,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
2416
2416
  https://www.kucoin.com/docs/rest/funding/funding-overview/get-account-detail-futures
2417
2417
 
2418
2418
  :param dict [params]: extra parameters specific to the exchange API endpoint
2419
+ :param dict [params.code]: the unified currency code to fetch the balance for, if not provided, the default .options['fetchBalance']['code'] will be used
2419
2420
  :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
2420
2421
  """
2421
2422
  self.load_markets()
@@ -3217,7 +3218,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
3217
3218
  'marginMode': marginMode,
3218
3219
  })
3219
3220
 
3220
- def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
3221
+ def set_leverage(self, leverage: int, symbol: Str = None, params={}):
3221
3222
  """
3222
3223
  set the level of leverage for a market
3223
3224
 
ccxt/lbank.py CHANGED
@@ -967,7 +967,7 @@ class lbank(Exchange, ImplicitAPI):
967
967
  timestamp = self.milliseconds()
968
968
  if market['swap']:
969
969
  return self.parse_order_book(orderbook, market['symbol'], timestamp, 'bids', 'asks', 'price', 'volume')
970
- return self.parse_order_book(orderbook, market['symbol'], timestamp, 'bids', 'asks', 1, 0)
970
+ return self.parse_order_book(orderbook, market['symbol'], timestamp, 'bids', 'asks')
971
971
 
972
972
  def parse_trade(self, trade: dict, market: Market = None) -> Trade:
973
973
  #
@@ -2234,7 +2234,7 @@ class lbank(Exchange, ImplicitAPI):
2234
2234
  'tag': tag,
2235
2235
  }
2236
2236
 
2237
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2237
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
2238
2238
  """
2239
2239
  make a withdrawal
2240
2240
 
ccxt/mercado.py CHANGED
@@ -704,7 +704,7 @@ class mercado(Exchange, ImplicitAPI):
704
704
  order = self.safe_dict(responseData, 'order')
705
705
  return self.parse_order(order, market)
706
706
 
707
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
707
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
708
708
  """
709
709
  make a withdrawal
710
710
  :param str code: unified currency code
ccxt/mexc.py CHANGED
@@ -487,6 +487,12 @@ class mexc(Exchange, ImplicitAPI):
487
487
  'ZKSYNC': 'ZKSYNCERA',
488
488
  'TRC20': 'TRX',
489
489
  'TON': 'TONCOIN',
490
+ 'ARBITRUM': 'ARB',
491
+ 'STX': 'STACKS',
492
+ 'LUNC': 'LUNA',
493
+ 'STARK': 'STARKNET',
494
+ 'APT': 'APTOS',
495
+ 'PEAQ': 'PEAQEVM',
490
496
  'AVAXC': 'AVAX_CCHAIN',
491
497
  'ERC20': 'ETH',
492
498
  'ACA': 'ACALA',
@@ -516,6 +522,7 @@ class mexc(Exchange, ImplicitAPI):
516
522
  # 'DNX': 'Dynex(DNX)',
517
523
  # 'DOGE': 'Dogecoin(DOGE)',
518
524
  # 'DOT': 'Polkadot(DOT)',
525
+ 'DOT': 'DOTASSETHUB',
519
526
  # 'DYM': 'Dymension(DYM)',
520
527
  'ETHF': 'ETF',
521
528
  'HRC20': 'HECO',
@@ -4055,7 +4062,7 @@ class mexc(Exchange, ImplicitAPI):
4055
4062
  """
4056
4063
  return self.modify_margin_helper(symbol, amount, 'ADD', params)
4057
4064
 
4058
- def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
4065
+ def set_leverage(self, leverage: int, symbol: Str = None, params={}):
4059
4066
  """
4060
4067
  set the level of leverage for a market
4061
4068
 
@@ -5241,7 +5248,7 @@ class mexc(Exchange, ImplicitAPI):
5241
5248
  }
5242
5249
  return self.safe_string(statuses, status, status)
5243
5250
 
5244
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
5251
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
5245
5252
  """
5246
5253
  make a withdrawal
5247
5254
 
ccxt/modetrade.py CHANGED
@@ -1025,6 +1025,97 @@ class modetrade(Exchange, ImplicitAPI):
1025
1025
  sorted = self.sort_by(rates, 'timestamp')
1026
1026
  return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
1027
1027
 
1028
+ def parse_income(self, income, market: Market = None):
1029
+ #
1030
+ # {
1031
+ # "symbol": "PERP_ETH_USDC",
1032
+ # "funding_rate": 0.00046875,
1033
+ # "mark_price": 2100,
1034
+ # "funding_fee": 0.000016,
1035
+ # "payment_type": "Pay",
1036
+ # "status": "Accrued",
1037
+ # "created_time": 1682235722003,
1038
+ # "updated_time": 1682235722003
1039
+ # }
1040
+ #
1041
+ marketId = self.safe_string(income, 'symbol')
1042
+ symbol = self.safe_symbol(marketId, market)
1043
+ amount = self.safe_string(income, 'funding_fee')
1044
+ code = self.safe_currency_code('USDC')
1045
+ timestamp = self.safe_integer(income, 'updated_time')
1046
+ rate = self.safe_number(income, 'funding_rate')
1047
+ paymentType = self.safe_string(income, 'payment_type')
1048
+ amount = Precise.string_neg(amount) if (paymentType == 'Pay') else amount
1049
+ return {
1050
+ 'info': income,
1051
+ 'symbol': symbol,
1052
+ 'code': code,
1053
+ 'timestamp': timestamp,
1054
+ 'datetime': self.iso8601(timestamp),
1055
+ 'id': None,
1056
+ 'amount': self.parse_number(amount),
1057
+ 'rate': rate,
1058
+ }
1059
+
1060
+ def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1061
+ """
1062
+ fetch the history of funding payments paid and received on self account
1063
+
1064
+ https://orderly.network/docs/build-on-omnichain/evm-api/restful-api/private/get-funding-fee-history
1065
+
1066
+ :param str [symbol]: unified market symbol
1067
+ :param int [since]: the earliest time in ms to fetch funding history for
1068
+ :param int [limit]: the maximum number of funding history structures to retrieve
1069
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1070
+ :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
1071
+ :returns dict: a `funding history structure <https://docs.ccxt.com/#/?id=funding-history-structure>`
1072
+ """
1073
+ self.load_markets()
1074
+ paginate = False
1075
+ paginate, params = self.handle_option_and_params(params, 'fetchFundingHistory', 'paginate')
1076
+ if paginate:
1077
+ return self.fetch_paginated_call_incremental('fetchFundingHistory', symbol, since, limit, params, 'page', 500)
1078
+ request: dict = {}
1079
+ market: Market = None
1080
+ if symbol is not None:
1081
+ market = self.market(symbol)
1082
+ request['symbol'] = market['id']
1083
+ if since is not None:
1084
+ request['start_t'] = since
1085
+ until = self.safe_integer(params, 'until') # unified in milliseconds
1086
+ params = self.omit(params, ['until'])
1087
+ if until is not None:
1088
+ request['end_t'] = until
1089
+ if limit is not None:
1090
+ request['size'] = min(limit, 500)
1091
+ response = self.v1PrivateGetFundingFeeHistory(self.extend(request, params))
1092
+ #
1093
+ # {
1094
+ # "success": True,
1095
+ # "timestamp": 1702989203989,
1096
+ # "data": {
1097
+ # "meta": {
1098
+ # "total": 9,
1099
+ # "records_per_page": 25,
1100
+ # "current_page": 1
1101
+ # },
1102
+ # "rows": [{
1103
+ # "symbol": "PERP_ETH_USDC",
1104
+ # "funding_rate": 0.00046875,
1105
+ # "mark_price": 2100,
1106
+ # "funding_fee": 0.000016,
1107
+ # "payment_type": "Pay",
1108
+ # "status": "Accrued",
1109
+ # "created_time": 1682235722003,
1110
+ # "updated_time": 1682235722003
1111
+ # }]
1112
+ # }
1113
+ # }
1114
+ #
1115
+ data = self.safe_dict(response, 'data', {})
1116
+ rows = self.safe_list(data, 'rows', [])
1117
+ return self.parse_incomes(rows, market, since, limit)
1118
+
1028
1119
  def fetch_trading_fees(self, params={}) -> TradingFees:
1029
1120
  """
1030
1121
  fetch the trading fees for multiple markets
@@ -2330,7 +2421,7 @@ class modetrade(Exchange, ImplicitAPI):
2330
2421
  def sign_message(self, message, privateKey):
2331
2422
  return self.sign_hash(self.hash_message(message), privateKey[-64:])
2332
2423
 
2333
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2424
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
2334
2425
  """
2335
2426
  make a withdrawal
2336
2427
 
@@ -2460,7 +2551,7 @@ class modetrade(Exchange, ImplicitAPI):
2460
2551
  data = self.safe_dict(response, 'data', {})
2461
2552
  return self.parse_leverage(data, market)
2462
2553
 
2463
- def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
2554
+ def set_leverage(self, leverage: int, symbol: Str = None, params={}):
2464
2555
  """
2465
2556
  set the level of leverage for a market
2466
2557
 
ccxt/ndax.py CHANGED
@@ -2357,7 +2357,7 @@ class ndax(Exchange, ImplicitAPI):
2357
2357
  'network': None,
2358
2358
  }
2359
2359
 
2360
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2360
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
2361
2361
  """
2362
2362
  make a withdrawal
2363
2363
  :param str code: unified currency code
ccxt/novadax.py CHANGED
@@ -46,6 +46,9 @@ class novadax(Exchange, ImplicitAPI):
46
46
  'future': False,
47
47
  'option': False,
48
48
  'addMargin': False,
49
+ 'borrowCrossMargin': False,
50
+ 'borrowIsolatedMargin': False,
51
+ 'borrowMargin': False,
49
52
  'cancelOrder': True,
50
53
  'closeAllPositions': False,
51
54
  'closePosition': False,
@@ -58,9 +61,14 @@ class novadax(Exchange, ImplicitAPI):
58
61
  'createStopMarketOrder': True,
59
62
  'createStopOrder': True,
60
63
  'fetchAccounts': True,
64
+ 'fetchAllGreeks': False,
61
65
  'fetchBalance': True,
66
+ 'fetchBorrowInterest': False,
67
+ 'fetchBorrowRate': False,
62
68
  'fetchBorrowRateHistories': False,
63
69
  'fetchBorrowRateHistory': False,
70
+ 'fetchBorrowRates': False,
71
+ 'fetchBorrowRatesPerSymbol': False,
64
72
  'fetchClosedOrders': True,
65
73
  'fetchCrossBorrowRate': False,
66
74
  'fetchCrossBorrowRates': False,
@@ -70,20 +78,40 @@ class novadax(Exchange, ImplicitAPI):
70
78
  'fetchDeposits': True,
71
79
  'fetchDepositsWithdrawals': True,
72
80
  'fetchFundingHistory': False,
81
+ 'fetchFundingInterval': False,
82
+ 'fetchFundingIntervals': False,
73
83
  'fetchFundingRate': False,
74
84
  'fetchFundingRateHistory': False,
75
85
  'fetchFundingRates': False,
86
+ 'fetchGreeks': False,
76
87
  'fetchIndexOHLCV': False,
77
88
  'fetchIsolatedBorrowRate': False,
78
89
  'fetchIsolatedBorrowRates': False,
90
+ 'fetchIsolatedPositions': False,
79
91
  'fetchLeverage': False,
92
+ 'fetchLeverages': False,
80
93
  'fetchLeverageTiers': False,
94
+ 'fetchLiquidations': False,
95
+ 'fetchLongShortRatio': False,
96
+ 'fetchLongShortRatioHistory': False,
97
+ 'fetchMarginAdjustmentHistory': False,
98
+ 'fetchMarginMode': False,
99
+ 'fetchMarginModes': False,
100
+ 'fetchMarketLeverageTiers': False,
81
101
  'fetchMarkets': True,
82
102
  'fetchMarkOHLCV': False,
103
+ 'fetchMarkPrice': False,
104
+ 'fetchMarkPrices': False,
105
+ 'fetchMyLiquidations': False,
106
+ 'fetchMySettlementHistory': False,
83
107
  'fetchMyTrades': True,
84
108
  'fetchOHLCV': True,
109
+ 'fetchOpenInterest': False,
85
110
  'fetchOpenInterestHistory': False,
111
+ 'fetchOpenInterests': False,
86
112
  'fetchOpenOrders': True,
113
+ 'fetchOption': False,
114
+ 'fetchOptionChain': False,
87
115
  'fetchOrder': True,
88
116
  'fetchOrderBook': True,
89
117
  'fetchOrders': True,
@@ -96,6 +124,7 @@ class novadax(Exchange, ImplicitAPI):
96
124
  'fetchPositionsHistory': False,
97
125
  'fetchPositionsRisk': False,
98
126
  'fetchPremiumIndexOHLCV': False,
127
+ 'fetchSettlementHistory': False,
99
128
  'fetchTicker': True,
100
129
  'fetchTickers': True,
101
130
  'fetchTime': True,
@@ -103,9 +132,14 @@ class novadax(Exchange, ImplicitAPI):
103
132
  'fetchTradingFee': False,
104
133
  'fetchTradingFees': False,
105
134
  'fetchTransactions': 'emulated',
135
+ 'fetchUnderlyingAssets': False,
136
+ 'fetchVolatilityHistory': False,
106
137
  'fetchWithdrawals': True,
107
138
  'reduceMargin': False,
139
+ 'repayCrossMargin': False,
140
+ 'repayIsolatedMargin': False,
108
141
  'setLeverage': False,
142
+ 'setMargin': False,
109
143
  'setMarginMode': False,
110
144
  'setPositionMode': False,
111
145
  'transfer': True,
@@ -1267,7 +1301,7 @@ class novadax(Exchange, ImplicitAPI):
1267
1301
  }
1268
1302
  return self.safe_string(statuses, status, 'failed')
1269
1303
 
1270
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1304
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
1271
1305
  """
1272
1306
  make a withdrawal
1273
1307
 
ccxt/okcoin.py CHANGED
@@ -2416,7 +2416,7 @@ class okcoin(Exchange, ImplicitAPI):
2416
2416
  }
2417
2417
  return self.safe_string(statuses, status, status)
2418
2418
 
2419
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2419
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
2420
2420
  """
2421
2421
 
2422
2422
  https://www.okcoin.com/docs-v5/en/#rest-api-funding-withdrawal
ccxt/okx.py CHANGED
@@ -4954,7 +4954,7 @@ class okx(Exchange, ImplicitAPI):
4954
4954
  first = self.safe_string(keys, 0)
4955
4955
  return self.safe_dict(response, first)
4956
4956
 
4957
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
4957
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
4958
4958
  """
4959
4959
  make a withdrawal
4960
4960
 
@@ -6351,7 +6351,7 @@ class okx(Exchange, ImplicitAPI):
6351
6351
  sorted = self.sort_by(result, 'timestamp')
6352
6352
  return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
6353
6353
 
6354
- def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
6354
+ def set_leverage(self, leverage: int, symbol: Str = None, params={}):
6355
6355
  """
6356
6356
  set the level of leverage for a market
6357
6357