ccxt 4.4.99__py2.py3-none-any.whl → 4.5.0__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 (198) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/bingx.py +1 -0
  3. ccxt/alpaca.py +1 -1
  4. ccxt/apex.py +1 -1
  5. ccxt/ascendex.py +1 -1
  6. ccxt/async_support/__init__.py +1 -1
  7. ccxt/async_support/alpaca.py +1 -1
  8. ccxt/async_support/apex.py +1 -1
  9. ccxt/async_support/ascendex.py +1 -1
  10. ccxt/async_support/base/exchange.py +44 -9
  11. ccxt/async_support/base/ws/client.py +3 -1
  12. ccxt/async_support/bigone.py +1 -1
  13. ccxt/async_support/binance.py +3 -2
  14. ccxt/async_support/bingx.py +33 -4
  15. ccxt/async_support/bitbank.py +1 -1
  16. ccxt/async_support/bitfinex.py +4 -1
  17. ccxt/async_support/bitflyer.py +1 -1
  18. ccxt/async_support/bitget.py +32 -14
  19. ccxt/async_support/bithumb.py +1 -1
  20. ccxt/async_support/bitmart.py +2 -2
  21. ccxt/async_support/bitmex.py +3 -2
  22. ccxt/async_support/bitopro.py +1 -1
  23. ccxt/async_support/bitrue.py +2 -2
  24. ccxt/async_support/bitso.py +1 -1
  25. ccxt/async_support/bitstamp.py +1 -1
  26. ccxt/async_support/bittrade.py +1 -1
  27. ccxt/async_support/bitvavo.py +1 -1
  28. ccxt/async_support/blockchaincom.py +1 -1
  29. ccxt/async_support/blofin.py +1 -1
  30. ccxt/async_support/btcmarkets.py +1 -1
  31. ccxt/async_support/bybit.py +2 -2
  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 +2 -2
  36. ccxt/async_support/coinex.py +3 -3
  37. ccxt/async_support/coinmate.py +1 -1
  38. ccxt/async_support/coinsph.py +1 -1
  39. ccxt/async_support/cryptocom.py +1 -1
  40. ccxt/async_support/defx.py +2 -2
  41. ccxt/async_support/delta.py +1 -1
  42. ccxt/async_support/deribit.py +1 -1
  43. ccxt/async_support/digifinex.py +2 -2
  44. ccxt/async_support/ellipx.py +1 -1
  45. ccxt/async_support/exmo.py +1 -1
  46. ccxt/async_support/foxbit.py +3 -3
  47. ccxt/async_support/gate.py +17 -2
  48. ccxt/async_support/gemini.py +1 -1
  49. ccxt/async_support/hashkey.py +2 -2
  50. ccxt/async_support/hibachi.py +1 -1
  51. ccxt/async_support/hitbtc.py +2 -2
  52. ccxt/async_support/hollaex.py +1 -1
  53. ccxt/async_support/htx.py +4 -3
  54. ccxt/async_support/hyperliquid.py +71 -29
  55. ccxt/async_support/independentreserve.py +1 -1
  56. ccxt/async_support/indodax.py +1 -1
  57. ccxt/async_support/kraken.py +1 -1
  58. ccxt/async_support/krakenfutures.py +2 -1
  59. ccxt/async_support/kucoin.py +2 -2
  60. ccxt/async_support/kucoinfutures.py +2 -1
  61. ccxt/async_support/lbank.py +2 -2
  62. ccxt/async_support/mercado.py +1 -1
  63. ccxt/async_support/mexc.py +9 -2
  64. ccxt/async_support/modetrade.py +93 -2
  65. ccxt/async_support/ndax.py +1 -1
  66. ccxt/async_support/novadax.py +1 -1
  67. ccxt/async_support/okcoin.py +1 -1
  68. ccxt/async_support/okx.py +2 -2
  69. ccxt/async_support/onetrading.py +33 -0
  70. ccxt/async_support/oxfun.py +1 -1
  71. ccxt/async_support/p2b.py +32 -0
  72. ccxt/async_support/paradex.py +2 -1
  73. ccxt/async_support/phemex.py +2 -2
  74. ccxt/async_support/poloniex.py +2 -2
  75. ccxt/async_support/probit.py +36 -1
  76. ccxt/async_support/tokocrypto.py +1 -1
  77. ccxt/async_support/upbit.py +1 -1
  78. ccxt/async_support/vertex.py +1 -1
  79. ccxt/async_support/wavesexchange.py +1 -1
  80. ccxt/async_support/whitebit.py +2 -2
  81. ccxt/async_support/woo.py +4 -4
  82. ccxt/async_support/woofipro.py +93 -2
  83. ccxt/async_support/xt.py +2 -2
  84. ccxt/async_support/yobit.py +1 -1
  85. ccxt/async_support/zaif.py +1 -1
  86. ccxt/async_support/zonda.py +1 -1
  87. ccxt/base/errors.py +6 -0
  88. ccxt/base/exchange.py +11 -9
  89. ccxt/base/types.py +1 -0
  90. ccxt/bigone.py +1 -1
  91. ccxt/binance.py +3 -2
  92. ccxt/bingx.py +33 -4
  93. ccxt/bitbank.py +1 -1
  94. ccxt/bitfinex.py +4 -1
  95. ccxt/bitflyer.py +1 -1
  96. ccxt/bitget.py +32 -14
  97. ccxt/bithumb.py +1 -1
  98. ccxt/bitmart.py +2 -2
  99. ccxt/bitmex.py +3 -2
  100. ccxt/bitopro.py +1 -1
  101. ccxt/bitrue.py +2 -2
  102. ccxt/bitso.py +1 -1
  103. ccxt/bitstamp.py +1 -1
  104. ccxt/bittrade.py +1 -1
  105. ccxt/bitvavo.py +1 -1
  106. ccxt/blockchaincom.py +1 -1
  107. ccxt/blofin.py +1 -1
  108. ccxt/btcmarkets.py +1 -1
  109. ccxt/bybit.py +2 -2
  110. ccxt/coinbase.py +1 -1
  111. ccxt/coinbaseexchange.py +1 -1
  112. ccxt/coinbaseinternational.py +1 -1
  113. ccxt/coincatch.py +2 -2
  114. ccxt/coinex.py +3 -3
  115. ccxt/coinmate.py +1 -1
  116. ccxt/coinsph.py +1 -1
  117. ccxt/cryptocom.py +1 -1
  118. ccxt/defx.py +2 -2
  119. ccxt/delta.py +1 -1
  120. ccxt/deribit.py +1 -1
  121. ccxt/digifinex.py +2 -2
  122. ccxt/ellipx.py +1 -1
  123. ccxt/exmo.py +1 -1
  124. ccxt/foxbit.py +3 -3
  125. ccxt/gate.py +17 -2
  126. ccxt/gemini.py +1 -1
  127. ccxt/hashkey.py +2 -2
  128. ccxt/hibachi.py +1 -1
  129. ccxt/hitbtc.py +2 -2
  130. ccxt/hollaex.py +1 -1
  131. ccxt/htx.py +4 -3
  132. ccxt/hyperliquid.py +71 -29
  133. ccxt/independentreserve.py +1 -1
  134. ccxt/indodax.py +1 -1
  135. ccxt/kraken.py +1 -1
  136. ccxt/krakenfutures.py +2 -1
  137. ccxt/kucoin.py +2 -2
  138. ccxt/kucoinfutures.py +2 -1
  139. ccxt/lbank.py +2 -2
  140. ccxt/mercado.py +1 -1
  141. ccxt/mexc.py +9 -2
  142. ccxt/modetrade.py +93 -2
  143. ccxt/ndax.py +1 -1
  144. ccxt/novadax.py +1 -1
  145. ccxt/okcoin.py +1 -1
  146. ccxt/okx.py +2 -2
  147. ccxt/onetrading.py +33 -0
  148. ccxt/oxfun.py +1 -1
  149. ccxt/p2b.py +32 -0
  150. ccxt/paradex.py +2 -1
  151. ccxt/phemex.py +2 -2
  152. ccxt/poloniex.py +2 -2
  153. ccxt/pro/__init__.py +1 -1
  154. ccxt/pro/binance.py +2 -1
  155. ccxt/pro/bitvavo.py +1 -1
  156. ccxt/pro/bybit.py +1 -0
  157. ccxt/pro/coinex.py +1 -1
  158. ccxt/pro/hyperliquid.py +99 -12
  159. ccxt/pro/kucoin.py +1 -1
  160. ccxt/pro/kucoinfutures.py +1 -1
  161. ccxt/pro/mexc.py +337 -149
  162. ccxt/pro/okx.py +2 -1
  163. ccxt/pro/oxfun.py +1 -1
  164. ccxt/probit.py +36 -1
  165. ccxt/protobuf/__init__.py +0 -0
  166. ccxt/protobuf/mexc/PrivateAccountV3Api_pb2.py +37 -0
  167. ccxt/protobuf/mexc/PrivateDealsV3Api_pb2.py +37 -0
  168. ccxt/protobuf/mexc/PrivateOrdersV3Api_pb2.py +37 -0
  169. ccxt/protobuf/mexc/PublicAggreBookTickerV3Api_pb2.py +37 -0
  170. ccxt/protobuf/mexc/PublicAggreDealsV3Api_pb2.py +39 -0
  171. ccxt/protobuf/mexc/PublicAggreDepthsV3Api_pb2.py +39 -0
  172. ccxt/protobuf/mexc/PublicBookTickerBatchV3Api_pb2.py +38 -0
  173. ccxt/protobuf/mexc/PublicBookTickerV3Api_pb2.py +37 -0
  174. ccxt/protobuf/mexc/PublicDealsV3Api_pb2.py +39 -0
  175. ccxt/protobuf/mexc/PublicIncreaseDepthsBatchV3Api_pb2.py +38 -0
  176. ccxt/protobuf/mexc/PublicIncreaseDepthsV3Api_pb2.py +39 -0
  177. ccxt/protobuf/mexc/PublicLimitDepthsV3Api_pb2.py +39 -0
  178. ccxt/protobuf/mexc/PublicMiniTickerV3Api_pb2.py +37 -0
  179. ccxt/protobuf/mexc/PublicMiniTickersV3Api_pb2.py +38 -0
  180. ccxt/protobuf/mexc/PublicSpotKlineV3Api_pb2.py +37 -0
  181. ccxt/protobuf/mexc/PushDataV3ApiWrapper_pb2.py +52 -0
  182. ccxt/protobuf/mexc/__init__.py +0 -0
  183. ccxt/tokocrypto.py +1 -1
  184. ccxt/upbit.py +1 -1
  185. ccxt/vertex.py +1 -1
  186. ccxt/wavesexchange.py +1 -1
  187. ccxt/whitebit.py +2 -2
  188. ccxt/woo.py +4 -4
  189. ccxt/woofipro.py +93 -2
  190. ccxt/xt.py +2 -2
  191. ccxt/yobit.py +1 -1
  192. ccxt/zaif.py +1 -1
  193. ccxt/zonda.py +1 -1
  194. {ccxt-4.4.99.dist-info → ccxt-4.5.0.dist-info}/METADATA +5 -5
  195. {ccxt-4.4.99.dist-info → ccxt-4.5.0.dist-info}/RECORD +198 -180
  196. {ccxt-4.4.99.dist-info → ccxt-4.5.0.dist-info}/LICENSE.txt +0 -0
  197. {ccxt-4.4.99.dist-info → ccxt-4.5.0.dist-info}/WHEEL +0 -0
  198. {ccxt-4.4.99.dist-info → ccxt-4.5.0.dist-info}/top_level.txt +0 -0
ccxt/async_support/woo.py CHANGED
@@ -1111,7 +1111,7 @@ class woo(Exchange, ImplicitAPI):
1111
1111
  raise NotSupported(self.id + ' createMarketSellOrderWithCost() supports spot orders only')
1112
1112
  return await self.create_order(symbol, 'market', 'sell', cost, 1, params)
1113
1113
 
1114
- async def create_trailing_amount_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingAmount=None, trailingTriggerPrice=None, params={}) -> Order:
1114
+ async def create_trailing_amount_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingAmount: Num = None, trailingTriggerPrice: Num = None, params={}) -> Order:
1115
1115
  """
1116
1116
  create a trailing order by providing the symbol, type, side, amount, price and trailingAmount
1117
1117
 
@@ -1135,7 +1135,7 @@ class woo(Exchange, ImplicitAPI):
1135
1135
  params['trailingTriggerPrice'] = trailingTriggerPrice
1136
1136
  return await self.create_order(symbol, type, side, amount, price, params)
1137
1137
 
1138
- async def create_trailing_percent_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingPercent=None, trailingTriggerPrice=None, params={}) -> Order:
1138
+ async 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:
1139
1139
  """
1140
1140
  create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
1141
1141
 
@@ -2839,7 +2839,7 @@ class woo(Exchange, ImplicitAPI):
2839
2839
  }
2840
2840
  return self.safe_string(statuses, status, status)
2841
2841
 
2842
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2842
+ async def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
2843
2843
  """
2844
2844
  make a withdrawal
2845
2845
 
@@ -3455,7 +3455,7 @@ class woo(Exchange, ImplicitAPI):
3455
3455
  'shortLeverage': shortLeverage,
3456
3456
  }
3457
3457
 
3458
- async def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
3458
+ async def set_leverage(self, leverage: int, symbol: Str = None, params={}):
3459
3459
  """
3460
3460
  set the level of leverage for a market
3461
3461
 
@@ -1036,6 +1036,97 @@ class woofipro(Exchange, ImplicitAPI):
1036
1036
  sorted = self.sort_by(rates, 'timestamp')
1037
1037
  return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
1038
1038
 
1039
+ def parse_income(self, income, market: Market = None):
1040
+ #
1041
+ # {
1042
+ # "symbol": "PERP_ETH_USDC",
1043
+ # "funding_rate": 0.00046875,
1044
+ # "mark_price": 2100,
1045
+ # "funding_fee": 0.000016,
1046
+ # "payment_type": "Pay",
1047
+ # "status": "Accrued",
1048
+ # "created_time": 1682235722003,
1049
+ # "updated_time": 1682235722003
1050
+ # }
1051
+ #
1052
+ marketId = self.safe_string(income, 'symbol')
1053
+ symbol = self.safe_symbol(marketId, market)
1054
+ amount = self.safe_string(income, 'funding_fee')
1055
+ code = self.safe_currency_code('USDC')
1056
+ timestamp = self.safe_integer(income, 'updated_time')
1057
+ rate = self.safe_number(income, 'funding_rate')
1058
+ paymentType = self.safe_string(income, 'payment_type')
1059
+ amount = Precise.string_neg(amount) if (paymentType == 'Pay') else amount
1060
+ return {
1061
+ 'info': income,
1062
+ 'symbol': symbol,
1063
+ 'code': code,
1064
+ 'timestamp': timestamp,
1065
+ 'datetime': self.iso8601(timestamp),
1066
+ 'id': None,
1067
+ 'amount': self.parse_number(amount),
1068
+ 'rate': rate,
1069
+ }
1070
+
1071
+ async def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1072
+ """
1073
+ fetch the history of funding payments paid and received on self account
1074
+
1075
+ https://orderly.network/docs/build-on-omnichain/evm-api/restful-api/private/get-funding-fee-history
1076
+
1077
+ :param str [symbol]: unified market symbol
1078
+ :param int [since]: the earliest time in ms to fetch funding history for
1079
+ :param int [limit]: the maximum number of funding history structures to retrieve
1080
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1081
+ :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)
1082
+ :returns dict: a `funding history structure <https://docs.ccxt.com/#/?id=funding-history-structure>`
1083
+ """
1084
+ await self.load_markets()
1085
+ paginate = False
1086
+ paginate, params = self.handle_option_and_params(params, 'fetchFundingHistory', 'paginate')
1087
+ if paginate:
1088
+ return await self.fetch_paginated_call_incremental('fetchFundingHistory', symbol, since, limit, params, 'page', 500)
1089
+ request: dict = {}
1090
+ market: Market = None
1091
+ if symbol is not None:
1092
+ market = self.market(symbol)
1093
+ request['symbol'] = market['id']
1094
+ if since is not None:
1095
+ request['start_t'] = since
1096
+ until = self.safe_integer(params, 'until') # unified in milliseconds
1097
+ params = self.omit(params, ['until'])
1098
+ if until is not None:
1099
+ request['end_t'] = until
1100
+ if limit is not None:
1101
+ request['size'] = min(limit, 500)
1102
+ response = await self.v1PrivateGetFundingFeeHistory(self.extend(request, params))
1103
+ #
1104
+ # {
1105
+ # "success": True,
1106
+ # "timestamp": 1702989203989,
1107
+ # "data": {
1108
+ # "meta": {
1109
+ # "total": 9,
1110
+ # "records_per_page": 25,
1111
+ # "current_page": 1
1112
+ # },
1113
+ # "rows": [{
1114
+ # "symbol": "PERP_ETH_USDC",
1115
+ # "funding_rate": 0.00046875,
1116
+ # "mark_price": 2100,
1117
+ # "funding_fee": 0.000016,
1118
+ # "payment_type": "Pay",
1119
+ # "status": "Accrued",
1120
+ # "created_time": 1682235722003,
1121
+ # "updated_time": 1682235722003
1122
+ # }]
1123
+ # }
1124
+ # }
1125
+ #
1126
+ data = self.safe_dict(response, 'data', {})
1127
+ rows = self.safe_list(data, 'rows', [])
1128
+ return self.parse_incomes(rows, market, since, limit)
1129
+
1039
1130
  async def fetch_trading_fees(self, params={}) -> TradingFees:
1040
1131
  """
1041
1132
  fetch the trading fees for multiple markets
@@ -2341,7 +2432,7 @@ class woofipro(Exchange, ImplicitAPI):
2341
2432
  def sign_message(self, message, privateKey):
2342
2433
  return self.sign_hash(self.hash_message(message), privateKey[-64:])
2343
2434
 
2344
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2435
+ async def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
2345
2436
  """
2346
2437
  make a withdrawal
2347
2438
 
@@ -2471,7 +2562,7 @@ class woofipro(Exchange, ImplicitAPI):
2471
2562
  data = self.safe_dict(response, 'data', {})
2472
2563
  return self.parse_leverage(data, market)
2473
2564
 
2474
- async def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
2565
+ async def set_leverage(self, leverage: int, symbol: Str = None, params={}):
2475
2566
  """
2476
2567
  set the level of leverage for a market
2477
2568
 
ccxt/async_support/xt.py CHANGED
@@ -3781,7 +3781,7 @@ class xt(Exchange, ImplicitAPI):
3781
3781
  withdrawals = self.safe_value(data, 'items', [])
3782
3782
  return self.parse_transactions(withdrawals, currency, since, limit, params)
3783
3783
 
3784
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
3784
+ async def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
3785
3785
  """
3786
3786
  make a withdrawal
3787
3787
 
@@ -3911,7 +3911,7 @@ class xt(Exchange, ImplicitAPI):
3911
3911
  }
3912
3912
  return self.safe_string(statuses, status, status)
3913
3913
 
3914
- async def set_leverage(self, leverage: Int, symbol: str = None, params={}):
3914
+ async def set_leverage(self, leverage: int, symbol: str = None, params={}):
3915
3915
  """
3916
3916
  set the level of leverage for a market
3917
3917
 
@@ -1276,7 +1276,7 @@ class yobit(Exchange, ImplicitAPI):
1276
1276
  'tag': None,
1277
1277
  }
1278
1278
 
1279
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1279
+ async def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
1280
1280
  """
1281
1281
 
1282
1282
  https://yobit.net/en/api
@@ -659,7 +659,7 @@ class zaif(Exchange, ImplicitAPI):
659
659
  response = await self.privatePostTradeHistory(self.extend(request, params))
660
660
  return self.parse_orders(response['return'], market, since, limit)
661
661
 
662
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
662
+ async def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
663
663
  """
664
664
 
665
665
  https://zaif-api-document.readthedocs.io/ja/latest/TradingAPI.html#id41
@@ -1776,7 +1776,7 @@ class zonda(Exchange, ImplicitAPI):
1776
1776
  }
1777
1777
  return self.safe_string(statuses, status, status)
1778
1778
 
1779
- async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1779
+ async def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
1780
1780
  """
1781
1781
 
1782
1782
  https://docs.zondacrypto.exchange/reference/crypto-withdrawal-1
ccxt/base/errors.py CHANGED
@@ -1,3 +1,9 @@
1
+ # ----------------------------------------------------------------------------
2
+
3
+ # PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+ # EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
+
1
7
  error_hierarchy = {
2
8
  'BaseError': {
3
9
  'ExchangeError': {
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.99'
7
+ __version__ = '4.5.0'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -1862,6 +1862,8 @@ class Exchange(object):
1862
1862
  signature = auth_data.signature
1863
1863
  return signature
1864
1864
 
1865
+ def is_binary_message(self, message):
1866
+ return isinstance(message, bytes) or isinstance(message, bytearray)
1865
1867
 
1866
1868
  # ########################################################################
1867
1869
  # ########################################################################
@@ -2774,13 +2776,13 @@ class Exchange(object):
2774
2776
  def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}):
2775
2777
  raise NotSupported(self.id + ' transfer() is not supported yet')
2776
2778
 
2777
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2779
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}):
2778
2780
  raise NotSupported(self.id + ' withdraw() is not supported yet')
2779
2781
 
2780
2782
  def create_deposit_address(self, code: str, params={}):
2781
2783
  raise NotSupported(self.id + ' createDepositAddress() is not supported yet')
2782
2784
 
2783
- def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
2785
+ def set_leverage(self, leverage: int, symbol: Str = None, params={}):
2784
2786
  raise NotSupported(self.id + ' setLeverage() is not supported yet')
2785
2787
 
2786
2788
  def fetch_leverage(self, symbol: str, params={}):
@@ -2829,7 +2831,7 @@ class Exchange(object):
2829
2831
  def fetch_deposit_addresses_by_network(self, code: str, params={}):
2830
2832
  raise NotSupported(self.id + ' fetchDepositAddressesByNetwork() is not supported yet')
2831
2833
 
2832
- def fetch_open_interest_history(self, symbol: str, timeframe='1h', since: Int = None, limit: Int = None, params={}):
2834
+ def fetch_open_interest_history(self, symbol: str, timeframe: str = '1h', since: Int = None, limit: Int = None, params={}):
2833
2835
  raise NotSupported(self.id + ' fetchOpenInterestHistory() is not supported yet')
2834
2836
 
2835
2837
  def fetch_open_interest(self, symbol: str, params={}):
@@ -5073,7 +5075,7 @@ class Exchange(object):
5073
5075
  def fetch_position_mode(self, symbol: Str = None, params={}):
5074
5076
  raise NotSupported(self.id + ' fetchPositionMode() is not supported yet')
5075
5077
 
5076
- def create_trailing_amount_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingAmount=None, trailingTriggerPrice=None, params={}):
5078
+ def create_trailing_amount_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingAmount: Num = None, trailingTriggerPrice: Num = None, params={}):
5077
5079
  """
5078
5080
  create a trailing order by providing the symbol, type, side, amount, price and trailingAmount
5079
5081
  :param str symbol: unified symbol of the market to create an order in
@@ -5095,7 +5097,7 @@ class Exchange(object):
5095
5097
  return self.create_order(symbol, type, side, amount, price, params)
5096
5098
  raise NotSupported(self.id + ' createTrailingAmountOrder() is not supported yet')
5097
5099
 
5098
- def create_trailing_amount_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingAmount=None, trailingTriggerPrice=None, params={}):
5100
+ def create_trailing_amount_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingAmount: Num = None, trailingTriggerPrice: Num = None, params={}):
5099
5101
  """
5100
5102
  create a trailing order by providing the symbol, type, side, amount, price and trailingAmount
5101
5103
  :param str symbol: unified symbol of the market to create an order in
@@ -5117,7 +5119,7 @@ class Exchange(object):
5117
5119
  return self.create_order_ws(symbol, type, side, amount, price, params)
5118
5120
  raise NotSupported(self.id + ' createTrailingAmountOrderWs() is not supported yet')
5119
5121
 
5120
- def create_trailing_percent_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingPercent=None, trailingTriggerPrice=None, params={}):
5122
+ def create_trailing_percent_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingPercent: Num = None, trailingTriggerPrice: Num = None, params={}):
5121
5123
  """
5122
5124
  create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
5123
5125
  :param str symbol: unified symbol of the market to create an order in
@@ -5139,7 +5141,7 @@ class Exchange(object):
5139
5141
  return self.create_order(symbol, type, side, amount, price, params)
5140
5142
  raise NotSupported(self.id + ' createTrailingPercentOrder() is not supported yet')
5141
5143
 
5142
- def create_trailing_percent_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingPercent=None, trailingTriggerPrice=None, params={}):
5144
+ def create_trailing_percent_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingPercent: Num = None, trailingTriggerPrice: Num = None, params={}):
5143
5145
  """
5144
5146
  create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
5145
5147
  :param str symbol: unified symbol of the market to create an order in
@@ -6193,7 +6195,7 @@ class Exchange(object):
6193
6195
  else:
6194
6196
  raise NotSupported(self.id + ' fetchFundingInterval() is not supported yet')
6195
6197
 
6196
- def fetch_mark_ohlcv(self, symbol, timeframe='1m', since: Int = None, limit: Int = None, params={}):
6198
+ def fetch_mark_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}):
6197
6199
  """
6198
6200
  fetches historical mark price candlestick data containing the open, high, low, and close price of a market
6199
6201
  :param str symbol: unified symbol of the market to fetch OHLCV data for
ccxt/base/types.py CHANGED
@@ -190,6 +190,7 @@ class Liquidation(TypedDict):
190
190
  price: Num
191
191
  baseValue: Num
192
192
  quoteValue: Num
193
+ side: OrderSide
193
194
 
194
195
 
195
196
  class FundingHistory(TypedDict):
ccxt/bigone.py CHANGED
@@ -2176,7 +2176,7 @@ class bigone(Exchange, ImplicitAPI):
2176
2176
  }
2177
2177
  return self.safe_string(statuses, status, 'failed')
2178
2178
 
2179
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2179
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
2180
2180
  """
2181
2181
  make a withdrawal
2182
2182
 
ccxt/binance.py CHANGED
@@ -8843,7 +8843,7 @@ class binance(Exchange, ImplicitAPI):
8843
8843
  }
8844
8844
  return result
8845
8845
 
8846
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
8846
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
8847
8847
  """
8848
8848
  make a withdrawal
8849
8849
 
@@ -10551,7 +10551,7 @@ class binance(Exchange, ImplicitAPI):
10551
10551
  raise NotSupported(self.id + ' fetchFundingHistory() supports linear and inverse contracts only')
10552
10552
  return self.parse_incomes(response, market, since, limit)
10553
10553
 
10554
- def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
10554
+ def set_leverage(self, leverage: int, symbol: Str = None, params={}):
10555
10555
  """
10556
10556
  set the level of leverage for a market
10557
10557
 
@@ -12440,6 +12440,7 @@ class binance(Exchange, ImplicitAPI):
12440
12440
  'contracts': self.safe_number(liquidation, 'executedQty'),
12441
12441
  'contractSize': self.safe_number(market, 'contractSize'),
12442
12442
  'price': self.safe_number(liquidation, 'avgPrice'),
12443
+ 'side': self.safe_string_lower(liquidation, 'side'),
12443
12444
  'baseValue': self.safe_number(liquidation, 'cumBase'),
12444
12445
  'quoteValue': self.safe_number(liquidation, 'cumQuote'),
12445
12446
  'timestamp': timestamp,
ccxt/bingx.py CHANGED
@@ -118,6 +118,7 @@ class bingx(Exchange, ImplicitAPI):
118
118
  'urls': {
119
119
  'logo': 'https://github-production-user-asset-6210df.s3.amazonaws.com/1294454/253675376-6983b72e-4999-4549-b177-33b374c195e3.jpg',
120
120
  'api': {
121
+ 'fund': 'https://open-api.{hostname}/openApi',
121
122
  'spot': 'https://open-api.{hostname}/openApi',
122
123
  'swap': 'https://open-api.{hostname}/openApi',
123
124
  'contract': 'https://open-api.{hostname}/openApi',
@@ -154,6 +155,15 @@ class bingx(Exchange, ImplicitAPI):
154
155
  'secret': True,
155
156
  },
156
157
  'api': {
158
+ 'fund': {
159
+ 'v1': {
160
+ 'private': {
161
+ 'get': {
162
+ 'account/balance': 1,
163
+ },
164
+ },
165
+ },
166
+ },
157
167
  'spot': {
158
168
  'v1': {
159
169
  'public': {
@@ -568,8 +578,11 @@ class bingx(Exchange, ImplicitAPI):
568
578
  'LTC': 'LTC',
569
579
  },
570
580
  'networks': {
571
- 'ARB': 'ARBITRUM',
581
+ 'ARBITRUM': 'ARB',
572
582
  'MATIC': 'POLYGON',
583
+ 'ZKSYNC': 'ZKSYNCERA',
584
+ 'AVAXC': 'AVAX-C',
585
+ 'HBAR': 'HEDERA',
573
586
  },
574
587
  },
575
588
  'features': {
@@ -2126,6 +2139,7 @@ class bingx(Exchange, ImplicitAPI):
2126
2139
 
2127
2140
  :param dict [params]: extra parameters specific to the exchange API endpoint
2128
2141
  :param boolean [params.standard]: whether to fetch standard contract balances
2142
+ :param str [params.type]: the type of balance to fetch(spot, swap, funding) default is `spot`
2129
2143
  :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
2130
2144
  """
2131
2145
  self.load_markets()
@@ -2155,6 +2169,21 @@ class bingx(Exchange, ImplicitAPI):
2155
2169
  # ]
2156
2170
  # }
2157
2171
  #
2172
+ elif (marketType == 'funding') or (marketType == 'fund'):
2173
+ response = self.fundV1PrivateGetAccountBalance(marketTypeQuery)
2174
+ # {
2175
+ # code: '0',
2176
+ # timestamp: '1754906016631',
2177
+ # data: {
2178
+ # assets: [
2179
+ # {
2180
+ # asset: 'USDT',
2181
+ # free: '44.37692200000000237300',
2182
+ # locked: '0.00000000000000000000'
2183
+ # }
2184
+ # ]
2185
+ # }
2186
+ # }
2158
2187
  elif marketType == 'spot':
2159
2188
  response = self.spotV1PrivateGetAccountBalance(marketTypeQuery)
2160
2189
  #
@@ -2303,7 +2332,7 @@ class bingx(Exchange, ImplicitAPI):
2303
2332
  firstStandardOrInverse = self.safe_dict(standardAndInverseBalances, 0)
2304
2333
  isStandardOrInverse = firstStandardOrInverse is not None
2305
2334
  spotData = self.safe_dict(response, 'data', {})
2306
- spotBalances = self.safe_list(spotData, 'balances')
2335
+ spotBalances = self.safe_list_2(spotData, 'balances', 'assets', [])
2307
2336
  firstSpot = self.safe_dict(spotBalances, 0)
2308
2337
  isSpot = firstSpot is not None
2309
2338
  if isStandardOrInverse:
@@ -5315,7 +5344,7 @@ class bingx(Exchange, ImplicitAPI):
5315
5344
  'shortLeverage': self.safe_integer(leverage, 'shortLeverage'),
5316
5345
  }
5317
5346
 
5318
- def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
5347
+ def set_leverage(self, leverage: int, symbol: Str = None, params={}):
5319
5348
  """
5320
5349
  set the level of leverage for a market
5321
5350
 
@@ -5562,7 +5591,7 @@ class bingx(Exchange, ImplicitAPI):
5562
5591
  depositWithdrawFees[code] = self.parse_deposit_withdraw_fee(entry)
5563
5592
  return depositWithdrawFees
5564
5593
 
5565
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
5594
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
5566
5595
  """
5567
5596
  make a withdrawal
5568
5597
 
ccxt/bitbank.py CHANGED
@@ -937,7 +937,7 @@ class bitbank(Exchange, ImplicitAPI):
937
937
  'tag': None,
938
938
  }
939
939
 
940
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
940
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
941
941
  """
942
942
  make a withdrawal
943
943
 
ccxt/bitfinex.py CHANGED
@@ -2631,7 +2631,7 @@ class bitfinex(Exchange, ImplicitAPI):
2631
2631
  #
2632
2632
  return self.parse_transactions(response, currency, since, limit)
2633
2633
 
2634
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2634
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
2635
2635
  """
2636
2636
  make a withdrawal
2637
2637
 
@@ -3541,12 +3541,15 @@ class bitfinex(Exchange, ImplicitAPI):
3541
3541
  contractSize = self.safe_string(market, 'contractSize')
3542
3542
  baseValue = Precise.string_mul(contracts, contractSize)
3543
3543
  price = self.safe_string(entry, 11)
3544
+ sideFlag = self.safe_integer(entry, 8)
3545
+ side = 'buy' if (sideFlag == 1) else 'sell'
3544
3546
  return self.safe_liquidation({
3545
3547
  'info': entry,
3546
3548
  'symbol': self.safe_symbol(marketId, market, None, 'contract'),
3547
3549
  'contracts': self.parse_number(contracts),
3548
3550
  'contractSize': self.parse_number(contractSize),
3549
3551
  'price': self.parse_number(price),
3552
+ 'side': side,
3550
3553
  'baseValue': self.parse_number(baseValue),
3551
3554
  'quoteValue': self.parse_number(Precise.string_mul(baseValue, price)),
3552
3555
  'timestamp': timestamp,
ccxt/bitflyer.py CHANGED
@@ -879,7 +879,7 @@ class bitflyer(Exchange, ImplicitAPI):
879
879
  # todo unify parsePosition/parsePositions
880
880
  return response
881
881
 
882
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
882
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
883
883
  """
884
884
  make a withdrawal
885
885
 
ccxt/bitget.py CHANGED
@@ -2730,7 +2730,7 @@ class bitget(Exchange, ImplicitAPI):
2730
2730
  rawTransactions = self.safe_list(response, 'data', [])
2731
2731
  return self.parse_transactions(rawTransactions, None, since, limit)
2732
2732
 
2733
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2733
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
2734
2734
  """
2735
2735
  make a withdrawal
2736
2736
 
@@ -5553,6 +5553,7 @@ class bitget(Exchange, ImplicitAPI):
5553
5553
  :param str [params.planType]: *swap only* either profit_plan, loss_plan, normal_plan, pos_profit, pos_loss, moving_plan or track_plan
5554
5554
  :param boolean [params.trailing]: set to True if you want to cancel a trailing order
5555
5555
  :param boolean [params.uta]: set to True for the unified trading account(uta), defaults to False
5556
+ :param str [params.clientOrderId]: the clientOrderId of the order, id does not need to be provided if clientOrderId is provided
5556
5557
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
5557
5558
  """
5558
5559
  if symbol is None:
@@ -5568,12 +5569,29 @@ class bitget(Exchange, ImplicitAPI):
5568
5569
  params = self.omit(params, ['stop', 'trigger', 'trailing'])
5569
5570
  if not (market['spot'] and trigger):
5570
5571
  request['symbol'] = market['id']
5571
- if not ((market['swap'] or market['future']) and trigger):
5572
- request['orderId'] = id
5573
5572
  uta = None
5574
5573
  uta, params = self.handle_option_and_params(params, 'cancelOrder', 'uta', False)
5574
+ isPlanOrder = trigger or trailing
5575
+ isContract = market['swap'] or market['future']
5576
+ isContractTriggerEndpoint = isContract and isPlanOrder and not uta
5577
+ clientOrderId = self.safe_string_2(params, 'clientOrderId', 'clientOid')
5578
+ if isContractTriggerEndpoint:
5579
+ orderIdList = []
5580
+ orderId: dict = {}
5581
+ if clientOrderId is not None:
5582
+ params = self.omit(params, 'clientOrderId')
5583
+ orderId['clientOid'] = clientOrderId
5584
+ else:
5585
+ orderId['orderId'] = id
5586
+ orderIdList.append(orderId)
5587
+ request['orderIdList'] = orderIdList
5588
+ else:
5589
+ if clientOrderId is not None:
5590
+ params = self.omit(params, 'clientOrderId')
5591
+ request['clientOid'] = clientOrderId
5592
+ else:
5593
+ request['orderId'] = id
5575
5594
  if uta:
5576
- request['orderId'] = id
5577
5595
  if trigger:
5578
5596
  response = self.privateUtaPostV3TradeCancelStrategyOrder(self.extend(request, params))
5579
5597
  else:
@@ -5582,13 +5600,6 @@ class bitget(Exchange, ImplicitAPI):
5582
5600
  productType = None
5583
5601
  productType, params = self.handle_product_type_and_params(market, params)
5584
5602
  request['productType'] = productType
5585
- if trigger or trailing:
5586
- orderIdList = []
5587
- orderId: dict = {
5588
- 'orderId': id,
5589
- }
5590
- orderIdList.append(orderId)
5591
- request['orderIdList'] = orderIdList
5592
5603
  if trailing:
5593
5604
  planType = self.safe_string(params, 'planType', 'track_plan')
5594
5605
  request['planType'] = planType
@@ -5662,7 +5673,7 @@ class bitget(Exchange, ImplicitAPI):
5662
5673
  #
5663
5674
  data = self.safe_value(response, 'data', {})
5664
5675
  order = None
5665
- if (market['swap'] or market['future']) and trigger and not uta:
5676
+ if isContractTriggerEndpoint:
5666
5677
  orderInfo = self.safe_value(data, 'successList', [])
5667
5678
  order = orderInfo[0]
5668
5679
  else:
@@ -5935,6 +5946,7 @@ class bitget(Exchange, ImplicitAPI):
5935
5946
  :param str symbol: unified symbol of the market the order was made in
5936
5947
  :param dict [params]: extra parameters specific to the exchange API endpoint
5937
5948
  :param boolean [params.uta]: set to True for the unified trading account(uta), defaults to False
5949
+ :param str [params.clientOrderId]: the clientOrderId of the order, id does not need to be provided if clientOrderId is provided
5938
5950
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
5939
5951
  """
5940
5952
  if symbol is None:
@@ -5942,8 +5954,14 @@ class bitget(Exchange, ImplicitAPI):
5942
5954
  self.load_markets()
5943
5955
  market = self.market(symbol)
5944
5956
  request: dict = {
5945
- 'orderId': id,
5957
+ # 'orderId': id,
5946
5958
  }
5959
+ clientOrderId = self.safe_string_2(params, 'clientOrderId', 'clientOid')
5960
+ if clientOrderId is not None:
5961
+ params = self.omit(params, ['clientOrderId'])
5962
+ request['clientOid'] = clientOrderId
5963
+ else:
5964
+ request['orderId'] = id
5947
5965
  response = None
5948
5966
  uta = None
5949
5967
  uta, params = self.handle_option_and_params(params, 'fetchOrder', 'uta', False)
@@ -8382,7 +8400,7 @@ class bitget(Exchange, ImplicitAPI):
8382
8400
  'shortLeverage': self.safe_integer(leverage, shortLevKey),
8383
8401
  }
8384
8402
 
8385
- def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
8403
+ def set_leverage(self, leverage: int, symbol: Str = None, params={}):
8386
8404
  """
8387
8405
  set the level of leverage for a market
8388
8406
 
ccxt/bithumb.py CHANGED
@@ -1094,7 +1094,7 @@ class bithumb(Exchange, ImplicitAPI):
1094
1094
  }
1095
1095
  return self.cancel_order(order['id'], order['symbol'], self.extend(request, params))
1096
1096
 
1097
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1097
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
1098
1098
  """
1099
1099
  make a withdrawal
1100
1100
 
ccxt/bitmart.py CHANGED
@@ -3606,7 +3606,7 @@ class bitmart(Exchange, ImplicitAPI):
3606
3606
  'tag': self.safe_string_2(depositAddress, 'address_memo', 'memo'),
3607
3607
  }
3608
3608
 
3609
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
3609
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
3610
3610
  """
3611
3611
  make a withdrawal
3612
3612
 
@@ -4466,7 +4466,7 @@ class bitmart(Exchange, ImplicitAPI):
4466
4466
  'info': interest,
4467
4467
  }, market)
4468
4468
 
4469
- def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
4469
+ def set_leverage(self, leverage: int, symbol: Str = None, params={}):
4470
4470
  """
4471
4471
  set the level of leverage for a market
4472
4472
 
ccxt/bitmex.py CHANGED
@@ -2446,7 +2446,7 @@ class bitmex(Exchange, ImplicitAPI):
2446
2446
  'takeProfitPrice': None,
2447
2447
  })
2448
2448
 
2449
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2449
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
2450
2450
  """
2451
2451
  make a withdrawal
2452
2452
 
@@ -2625,7 +2625,7 @@ class bitmex(Exchange, ImplicitAPI):
2625
2625
  'datetime': datetime,
2626
2626
  }
2627
2627
 
2628
- def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
2628
+ def set_leverage(self, leverage: int, symbol: Str = None, params={}):
2629
2629
  """
2630
2630
  set the level of leverage for a market
2631
2631
 
@@ -2883,6 +2883,7 @@ class bitmex(Exchange, ImplicitAPI):
2883
2883
  'contracts': None,
2884
2884
  'contractSize': self.safe_number(market, 'contractSize'),
2885
2885
  'price': self.safe_number(liquidation, 'price'),
2886
+ 'side': self.safe_string_lower(liquidation, 'side'),
2886
2887
  'baseValue': None,
2887
2888
  'quoteValue': None,
2888
2889
  'timestamp': None,
ccxt/bitopro.py CHANGED
@@ -1680,7 +1680,7 @@ class bitopro(Exchange, ImplicitAPI):
1680
1680
  #
1681
1681
  return self.parse_transaction(result, currency)
1682
1682
 
1683
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1683
+ def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
1684
1684
  """
1685
1685
  make a withdrawal
1686
1686