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/pro/hyperliquid.py CHANGED
@@ -8,7 +8,6 @@ from ccxt.async_support.base.ws.cache import ArrayCache, ArrayCacheBySymbolById,
8
8
  from ccxt.base.types import Any, Bool, Int, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade
9
9
  from ccxt.async_support.base.ws.client import Client
10
10
  from typing import List
11
- from ccxt.base.errors import ExchangeError
12
11
 
13
12
 
14
13
  class hyperliquid(ccxt.async_support.hyperliquid):
@@ -17,6 +16,8 @@ class hyperliquid(ccxt.async_support.hyperliquid):
17
16
  return self.deep_extend(super(hyperliquid, self).describe(), {
18
17
  'has': {
19
18
  'ws': True,
19
+ 'cancelOrderWs': True,
20
+ 'cancelOrdersWs': True,
20
21
  'createOrderWs': True,
21
22
  'createOrdersWs': True,
22
23
  'editOrderWs': True,
@@ -104,9 +105,6 @@ class hyperliquid(ccxt.async_support.hyperliquid):
104
105
  order, globalParams = self.parseCreateEditOrderArgs(None, symbol, type, side, amount, price, params)
105
106
  orders = await self.create_orders_ws([order], globalParams)
106
107
  parsedOrder = orders[0]
107
- orderInfo = self.safe_dict(parsedOrder, 'info')
108
- # handle potential error here
109
- self.handle_errors(None, None, None, None, None, self.json(orderInfo), orderInfo, None, None)
110
108
  return parsedOrder
111
109
 
112
110
  async def edit_order_ws(self, id: str, symbol: str, type: str, side: str, amount: Num = None, price: Num = None, params={}):
@@ -145,11 +143,57 @@ class hyperliquid(ccxt.async_support.hyperliquid):
145
143
  statuses = self.safe_list(dataObject, 'statuses', [])
146
144
  first = self.safe_dict(statuses, 0, {})
147
145
  parsedOrder = self.parse_order(first, market)
148
- orderInfo = self.safe_dict(parsedOrder, 'info')
149
- # handle potential error here
150
- self.handle_errors(None, None, None, None, None, self.json(orderInfo), orderInfo, None, None)
151
146
  return parsedOrder
152
147
 
148
+ async def cancel_orders_ws(self, ids: List[str], symbol: Str = None, params={}):
149
+ """
150
+ cancel multiple orders using WebSocket post request
151
+
152
+ https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/post-requests
153
+
154
+ :param str[] ids: list of order ids to cancel
155
+ :param str symbol: unified symbol of the market the orders were made in
156
+ :param dict [params]: extra parameters specific to the exchange API endpoint
157
+ :param str[] [params.clientOrderId]: list of client order ids to cancel instead of order ids
158
+ :param str [params.vaultAddress]: the vault address for order cancellation
159
+ :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
160
+ """
161
+ self.check_required_credentials()
162
+ await self.load_markets()
163
+ request = self.cancelOrdersRequest(ids, symbol, params)
164
+ url = self.urls['api']['ws']['public']
165
+ wrapped = self.wrap_as_post_action(request)
166
+ wsRequest = self.safe_dict(wrapped, 'request', {})
167
+ requestId = self.safe_string(wrapped, 'requestId')
168
+ response = await self.watch(url, requestId, wsRequest, requestId)
169
+ responseObj = self.safe_dict(response, 'response', {})
170
+ data = self.safe_dict(responseObj, 'data', {})
171
+ statuses = self.safe_list(data, 'statuses', [])
172
+ orders = []
173
+ for i in range(0, len(statuses)):
174
+ status = statuses[i]
175
+ orders.append(self.safe_order({
176
+ 'info': status,
177
+ 'status': status,
178
+ }))
179
+ return orders
180
+
181
+ async def cancel_order_ws(self, id: str, symbol: Str = None, params={}):
182
+ """
183
+ cancel a single order using WebSocket post request
184
+
185
+ https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/post-requests
186
+
187
+ :param str id: order id to cancel
188
+ :param str symbol: unified symbol of the market the order was made in
189
+ :param dict [params]: extra parameters specific to the exchange API endpoint
190
+ :param str [params.clientOrderId]: client order id to cancel instead of order id
191
+ :param str [params.vaultAddress]: the vault address for order cancellation
192
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
193
+ """
194
+ orders = await self.cancel_orders_ws([id], symbol, params)
195
+ return self.safe_dict(orders, 0)
196
+
153
197
  async def watch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
154
198
  """
155
199
  watches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
@@ -825,17 +869,60 @@ class hyperliquid(ccxt.async_support.hyperliquid):
825
869
 
826
870
  def handle_error_message(self, client: Client, message) -> Bool:
827
871
  #
828
- # {
872
+ # {
873
+ # "channel": "post",
874
+ # "data": {
875
+ # "id": 1,
876
+ # "response": {
877
+ # "type": "action",
878
+ # "payload": {
879
+ # "status": "ok",
880
+ # "response": {
881
+ # "type": "order",
882
+ # "data": {
883
+ # "statuses": [
884
+ # {
885
+ # "error": "Order price cannot be more than 80% away from the reference price"
886
+ # }
887
+ # ]
888
+ # }
889
+ # }
890
+ # }
891
+ # }
892
+ # }
893
+ # }
894
+ #
895
+ # {
829
896
  # "channel": "error",
830
897
  # "data": "Error parsing JSON into valid websocket request: {\"type\": \"allMids\"}"
831
898
  # }
832
899
  #
833
900
  channel = self.safe_string(message, 'channel', '')
834
- ret_msg = self.safe_string(message, 'data', '')
835
901
  if channel == 'error':
836
- raise ExchangeError(self.id + ' ' + ret_msg)
837
- else:
838
- return False
902
+ ret_msg = self.safe_string(message, 'data', '')
903
+ errorMsg = self.id + ' ' + ret_msg
904
+ client.reject(errorMsg)
905
+ return True
906
+ data = self.safe_dict(message, 'data', {})
907
+ id = self.safe_string(message, 'id')
908
+ response = self.safe_dict(data, 'response', {})
909
+ payload = self.safe_dict(response, 'payload', {})
910
+ status = self.safe_string(payload, 'status')
911
+ if status is not None and status != 'ok':
912
+ errorMsg = self.id + ' ' + self.json(payload)
913
+ client.reject(errorMsg, id)
914
+ return True
915
+ type = self.safe_string(payload, 'type')
916
+ if type == 'error':
917
+ error = self.id + ' ' + self.json(payload)
918
+ client.reject(error, id)
919
+ return True
920
+ try:
921
+ self.handle_errors(0, '', '', '', {}, self.json(payload), payload, {}, {})
922
+ except Exception as e:
923
+ client.reject(e, id)
924
+ return True
925
+ return False
839
926
 
840
927
  def handle_order_book_unsubscription(self, client: Client, subscription: dict):
841
928
  #
ccxt/pro/kucoin.py CHANGED
@@ -1336,7 +1336,7 @@ class kucoin(ccxt.async_support.kucoin):
1336
1336
  if client.url.find('connectId=private') >= 0:
1337
1337
  type = 'private'
1338
1338
  self.options['urls'][type] = None
1339
- self.handle_errors(None, None, client.url, None, None, data, message, None, None)
1339
+ self.handle_errors(1, '', client.url, '', {}, data, message, {}, {})
1340
1340
  return False
1341
1341
 
1342
1342
  def handle_message(self, client: Client, message):
ccxt/pro/kucoinfutures.py CHANGED
@@ -1181,7 +1181,7 @@ class kucoinfutures(ccxt.async_support.kucoinfutures):
1181
1181
  if client.url.find('connectId=private') >= 0:
1182
1182
  type = 'private'
1183
1183
  self.options['urls'][type] = None
1184
- self.handle_errors(None, None, client.url, None, None, data, message, None, None)
1184
+ self.handle_errors(1, '', client.url, '', {}, data, message, {}, {})
1185
1185
  return True
1186
1186
 
1187
1187
  def handle_subscription_status(self, client: Client, message):