unicex 0.13.9__tar.gz → 0.13.11__tar.gz

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 (98) hide show
  1. {unicex-0.13.9/unicex.egg-info → unicex-0.13.11}/PKG-INFO +1 -1
  2. {unicex-0.13.9 → unicex-0.13.11}/pyproject.toml +1 -1
  3. {unicex-0.13.9 → unicex-0.13.11}/unicex/binance/client.py +67 -31
  4. {unicex-0.13.9 → unicex-0.13.11/unicex.egg-info}/PKG-INFO +1 -1
  5. {unicex-0.13.9 → unicex-0.13.11}/LICENSE +0 -0
  6. {unicex-0.13.9 → unicex-0.13.11}/README.md +0 -0
  7. {unicex-0.13.9 → unicex-0.13.11}/setup.cfg +0 -0
  8. {unicex-0.13.9 → unicex-0.13.11}/unicex/__init__.py +0 -0
  9. {unicex-0.13.9 → unicex-0.13.11}/unicex/_abc/__init__.py +0 -0
  10. {unicex-0.13.9 → unicex-0.13.11}/unicex/_abc/exchange_info.py +0 -0
  11. {unicex-0.13.9 → unicex-0.13.11}/unicex/_abc/uni_client.py +0 -0
  12. {unicex-0.13.9 → unicex-0.13.11}/unicex/_abc/uni_websocket_manager.py +0 -0
  13. {unicex-0.13.9 → unicex-0.13.11}/unicex/_base/__init__.py +0 -0
  14. {unicex-0.13.9 → unicex-0.13.11}/unicex/_base/client.py +0 -0
  15. {unicex-0.13.9 → unicex-0.13.11}/unicex/_base/websocket.py +0 -0
  16. {unicex-0.13.9 → unicex-0.13.11}/unicex/binance/__init__.py +0 -0
  17. {unicex-0.13.9 → unicex-0.13.11}/unicex/binance/adapter.py +0 -0
  18. {unicex-0.13.9 → unicex-0.13.11}/unicex/binance/exchange_info.py +0 -0
  19. {unicex-0.13.9 → unicex-0.13.11}/unicex/binance/uni_client.py +0 -0
  20. {unicex-0.13.9 → unicex-0.13.11}/unicex/binance/uni_websocket_manager.py +0 -0
  21. {unicex-0.13.9 → unicex-0.13.11}/unicex/binance/user_websocket.py +0 -0
  22. {unicex-0.13.9 → unicex-0.13.11}/unicex/binance/websocket_manager.py +0 -0
  23. {unicex-0.13.9 → unicex-0.13.11}/unicex/bitget/__init__.py +0 -0
  24. {unicex-0.13.9 → unicex-0.13.11}/unicex/bitget/adapter.py +0 -0
  25. {unicex-0.13.9 → unicex-0.13.11}/unicex/bitget/client.py +0 -0
  26. {unicex-0.13.9 → unicex-0.13.11}/unicex/bitget/exchange_info.py +0 -0
  27. {unicex-0.13.9 → unicex-0.13.11}/unicex/bitget/uni_client.py +0 -0
  28. {unicex-0.13.9 → unicex-0.13.11}/unicex/bitget/uni_websocket_manager.py +0 -0
  29. {unicex-0.13.9 → unicex-0.13.11}/unicex/bitget/user_websocket.py +0 -0
  30. {unicex-0.13.9 → unicex-0.13.11}/unicex/bitget/websocket_manager.py +0 -0
  31. {unicex-0.13.9 → unicex-0.13.11}/unicex/bybit/__init__.py +0 -0
  32. {unicex-0.13.9 → unicex-0.13.11}/unicex/bybit/adapter.py +0 -0
  33. {unicex-0.13.9 → unicex-0.13.11}/unicex/bybit/client.py +0 -0
  34. {unicex-0.13.9 → unicex-0.13.11}/unicex/bybit/exchange_info.py +0 -0
  35. {unicex-0.13.9 → unicex-0.13.11}/unicex/bybit/uni_client.py +0 -0
  36. {unicex-0.13.9 → unicex-0.13.11}/unicex/bybit/uni_websocket_manager.py +0 -0
  37. {unicex-0.13.9 → unicex-0.13.11}/unicex/bybit/user_websocket.py +0 -0
  38. {unicex-0.13.9 → unicex-0.13.11}/unicex/bybit/websocket_manager.py +0 -0
  39. {unicex-0.13.9 → unicex-0.13.11}/unicex/enums.py +0 -0
  40. {unicex-0.13.9 → unicex-0.13.11}/unicex/exceptions.py +0 -0
  41. {unicex-0.13.9 → unicex-0.13.11}/unicex/extra.py +0 -0
  42. {unicex-0.13.9 → unicex-0.13.11}/unicex/gate/__init__.py +0 -0
  43. {unicex-0.13.9 → unicex-0.13.11}/unicex/gate/adapter.py +0 -0
  44. {unicex-0.13.9 → unicex-0.13.11}/unicex/gate/client.py +0 -0
  45. {unicex-0.13.9 → unicex-0.13.11}/unicex/gate/exchange_info.py +0 -0
  46. {unicex-0.13.9 → unicex-0.13.11}/unicex/gate/uni_client.py +0 -0
  47. {unicex-0.13.9 → unicex-0.13.11}/unicex/gate/uni_websocket_manager.py +0 -0
  48. {unicex-0.13.9 → unicex-0.13.11}/unicex/gate/user_websocket.py +0 -0
  49. {unicex-0.13.9 → unicex-0.13.11}/unicex/gate/websocket_manager.py +0 -0
  50. {unicex-0.13.9 → unicex-0.13.11}/unicex/hyperliquid/__init__.py +0 -0
  51. {unicex-0.13.9 → unicex-0.13.11}/unicex/hyperliquid/adapter.py +0 -0
  52. {unicex-0.13.9 → unicex-0.13.11}/unicex/hyperliquid/client.py +0 -0
  53. {unicex-0.13.9 → unicex-0.13.11}/unicex/hyperliquid/exchange_info.py +0 -0
  54. {unicex-0.13.9 → unicex-0.13.11}/unicex/hyperliquid/uni_client.py +0 -0
  55. {unicex-0.13.9 → unicex-0.13.11}/unicex/hyperliquid/uni_websocket_manager.py +0 -0
  56. {unicex-0.13.9 → unicex-0.13.11}/unicex/hyperliquid/user_websocket.py +0 -0
  57. {unicex-0.13.9 → unicex-0.13.11}/unicex/hyperliquid/websocket_manager.py +0 -0
  58. {unicex-0.13.9 → unicex-0.13.11}/unicex/mapper.py +0 -0
  59. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/__init__.py +0 -0
  60. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/_spot_ws_proto/PrivateAccountV3Api_pb2.py +0 -0
  61. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/_spot_ws_proto/PrivateDealsV3Api_pb2.py +0 -0
  62. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/_spot_ws_proto/PrivateOrdersV3Api_pb2.py +0 -0
  63. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/_spot_ws_proto/PublicAggreBookTickerV3Api_pb2.py +0 -0
  64. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/_spot_ws_proto/PublicAggreDealsV3Api_pb2.py +0 -0
  65. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/_spot_ws_proto/PublicAggreDepthsV3Api_pb2.py +0 -0
  66. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/_spot_ws_proto/PublicBookTickerBatchV3Api_pb2.py +0 -0
  67. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/_spot_ws_proto/PublicBookTickerV3Api_pb2.py +0 -0
  68. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/_spot_ws_proto/PublicDealsV3Api_pb2.py +0 -0
  69. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/_spot_ws_proto/PublicFuture_pb2.py +0 -0
  70. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/_spot_ws_proto/PublicIncreaseDepthsBatchV3Api_pb2.py +0 -0
  71. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/_spot_ws_proto/PublicIncreaseDepthsV3Api_pb2.py +0 -0
  72. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/_spot_ws_proto/PublicLimitDepthsV3Api_pb2.py +0 -0
  73. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/_spot_ws_proto/PublicMiniTickerV3Api_pb2.py +0 -0
  74. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/_spot_ws_proto/PublicMiniTickersV3Api_pb2.py +0 -0
  75. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/_spot_ws_proto/PublicSpotKlineV3Api_pb2.py +0 -0
  76. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/_spot_ws_proto/PushDataV3ApiWrapper_pb2.py +0 -0
  77. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/_spot_ws_proto/__init__.py +0 -0
  78. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/adapter.py +0 -0
  79. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/client.py +0 -0
  80. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/exchange_info.py +0 -0
  81. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/uni_client.py +0 -0
  82. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/uni_websocket_manager.py +0 -0
  83. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/user_websocket.py +0 -0
  84. {unicex-0.13.9 → unicex-0.13.11}/unicex/mexc/websocket_manager.py +0 -0
  85. {unicex-0.13.9 → unicex-0.13.11}/unicex/okx/__init__.py +0 -0
  86. {unicex-0.13.9 → unicex-0.13.11}/unicex/okx/adapter.py +0 -0
  87. {unicex-0.13.9 → unicex-0.13.11}/unicex/okx/client.py +0 -0
  88. {unicex-0.13.9 → unicex-0.13.11}/unicex/okx/exchange_info.py +0 -0
  89. {unicex-0.13.9 → unicex-0.13.11}/unicex/okx/uni_client.py +0 -0
  90. {unicex-0.13.9 → unicex-0.13.11}/unicex/okx/uni_websocket_manager.py +0 -0
  91. {unicex-0.13.9 → unicex-0.13.11}/unicex/okx/user_websocket.py +0 -0
  92. {unicex-0.13.9 → unicex-0.13.11}/unicex/okx/websocket_manager.py +0 -0
  93. {unicex-0.13.9 → unicex-0.13.11}/unicex/types.py +0 -0
  94. {unicex-0.13.9 → unicex-0.13.11}/unicex/utils.py +0 -0
  95. {unicex-0.13.9 → unicex-0.13.11}/unicex.egg-info/SOURCES.txt +0 -0
  96. {unicex-0.13.9 → unicex-0.13.11}/unicex.egg-info/dependency_links.txt +0 -0
  97. {unicex-0.13.9 → unicex-0.13.11}/unicex.egg-info/requires.txt +0 -0
  98. {unicex-0.13.9 → unicex-0.13.11}/unicex.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unicex
3
- Version: 0.13.9
3
+ Version: 0.13.11
4
4
  Summary: Unified Crypto Exchange API
5
5
  Author-email: LoveBloodAndDiamonds <ayazshakirzyanov27@gmail.com>
6
6
  License: BSD 3-Clause License
@@ -4,7 +4,7 @@ name = "unicex"
4
4
  # • PATCH (x.y.Z) → увеличивается при багфиксе, который не ломает совместимость.
5
5
  # • MINOR (x.Y.z) → увеличивается при добавлении новой функциональности, но без ломающих изменений (backward-compatible).
6
6
  # • MAJOR (X.y.z) → увеличивается при изменениях, которые ломают обратную совместимость.
7
- version = "0.13.9"
7
+ version = "0.13.11"
8
8
 
9
9
  description = "Unified Crypto Exchange API "
10
10
  readme = "README.md"
@@ -23,16 +23,19 @@ class Client(BaseClient):
23
23
  _RECV_WINDOW: int = 5000
24
24
  """Стандартный интервал времени для получения ответа от сервера."""
25
25
 
26
- def _get_headers(self) -> dict:
26
+ def _get_headers(self, method: RequestMethod) -> dict:
27
27
  """Возвращает заголовки для запросов к Binance API."""
28
28
  headers = {"Accept": "application/json"}
29
29
  if self._api_key: # type: ignore[attr-defined]
30
30
  headers["X-MBX-APIKEY"] = self._api_key # type: ignore[attr-defined]
31
+ if method in ["POST", "PUT", "DELETE"]:
32
+ headers.update({"Content-Type": "application/x-www-form-urlencoded"})
31
33
  return headers
32
34
 
33
35
  def _prepare_payload(
34
36
  self,
35
37
  *,
38
+ method: RequestMethod,
36
39
  signed: bool,
37
40
  params: dict[str, Any] | None,
38
41
  data: dict[str, Any] | None,
@@ -46,6 +49,7 @@ class Client(BaseClient):
46
49
  - возвращает только отфильтрованные params/data.
47
50
 
48
51
  Параметры:
52
+ method (`RequestMethod`): Метод запроса.
49
53
  signed (`bool`): Нужно ли подписывать запрос.
50
54
  params (`dict | None`): Параметры для query string.
51
55
  data (`dict | None`): Параметры для тела запроса.
@@ -78,7 +82,7 @@ class Client(BaseClient):
78
82
  "hex",
79
83
  )
80
84
 
81
- headers = self._get_headers()
85
+ headers = self._get_headers(method)
82
86
  return payload, headers
83
87
 
84
88
  async def _make_request(
@@ -108,7 +112,9 @@ class Client(BaseClient):
108
112
  Возвращает:
109
113
  `dict`: Ответ в формате JSON.
110
114
  """
111
- payload, headers = self._prepare_payload(signed=signed, params=params, data=data)
115
+ payload, headers = self._prepare_payload(
116
+ method=method, signed=signed, params=params, data=data
117
+ )
112
118
 
113
119
  if not signed:
114
120
  return await super()._make_request(method=method, url=url, **payload)
@@ -400,7 +406,8 @@ class Client(BaseClient):
400
406
  "selfTradePreventionMode": self_trade_prevention_mode,
401
407
  }
402
408
 
403
- return await self._make_request("POST", url, True, data=data)
409
+ # return await self._make_request("POST", url, True, data=data)
410
+ return await self._make_request("POST", url, True, params=data)
404
411
 
405
412
  async def order_test(
406
413
  self,
@@ -484,42 +491,69 @@ class Client(BaseClient):
484
491
  self,
485
492
  symbol: str,
486
493
  side: str,
487
- quantity: float,
488
- price: float,
489
- stop_price: float,
490
- stop_limit_price: float | None = None,
494
+ quantity: str,
491
495
  list_client_order_id: str | None = None,
492
- limit_client_order_id: str | None = None,
493
- stop_client_order_id: str | None = None,
494
- stop_limit_time_in_force: str | None = None,
496
+ # ABOVE ORDER
497
+ above_type: str = "TAKE_PROFIT_LIMIT",
498
+ above_client_order_id: str | None = None,
499
+ above_price: str | None = None,
500
+ above_stop_price: str | None = None,
501
+ above_trailing_delta: int | None = None,
502
+ above_time_in_force: str | None = None,
503
+ above_iceberg_qty: str | None = None,
504
+ above_strategy_id: int | None = None,
505
+ above_strategy_type: int | None = None,
506
+ # BELOW ORDER
507
+ below_type: str = "STOP_LOSS_LIMIT",
508
+ below_client_order_id: str | None = None,
509
+ below_price: str | None = None,
510
+ below_stop_price: str | None = None,
511
+ below_trailing_delta: int | None = None,
512
+ below_time_in_force: str | None = None,
513
+ below_iceberg_qty: str | None = None,
514
+ below_strategy_id: int | None = None,
515
+ below_strategy_type: int | None = None,
516
+ # EXTRA
495
517
  new_order_resp_type: str | None = None,
496
518
  self_trade_prevention_mode: str | None = None,
497
- limit_iceberg_qty: float | None = None,
498
- stop_iceberg_qty: float | None = None,
499
519
  ) -> dict:
500
- """Создание OCO ордера.
520
+ """Создание OCO ордера (новая версия).
501
521
 
502
- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/spot-trading-endpoints#new-oco-trade
522
+ https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-list---oco-trade
503
523
  """
504
- url = self._BASE_SPOT_URL + "/api/v3/order/oco"
524
+ url = self._BASE_SPOT_URL + "/api/v3/orderList/oco"
525
+
505
526
  data = {
506
527
  "symbol": symbol,
507
528
  "side": side,
508
529
  "quantity": quantity,
509
- "price": price,
510
- "stopPrice": stop_price,
511
- "stopLimitPrice": stop_limit_price,
512
530
  "listClientOrderId": list_client_order_id,
513
- "limitClientOrderId": limit_client_order_id,
514
- "stopClientOrderId": stop_client_order_id,
515
- "stopLimitTimeInForce": stop_limit_time_in_force,
531
+ # ABOVE
532
+ "aboveType": above_type,
533
+ "aboveClientOrderId": above_client_order_id,
534
+ "abovePrice": above_price,
535
+ "aboveStopPrice": above_stop_price,
536
+ "aboveTrailingDelta": above_trailing_delta,
537
+ "aboveTimeInForce": above_time_in_force,
538
+ "aboveIcebergQty": above_iceberg_qty,
539
+ "aboveStrategyId": above_strategy_id,
540
+ "aboveStrategyType": above_strategy_type,
541
+ # BELOW
542
+ "belowType": below_type,
543
+ "belowClientOrderId": below_client_order_id,
544
+ "belowPrice": below_price,
545
+ "belowStopPrice": below_stop_price,
546
+ "belowTrailingDelta": below_trailing_delta,
547
+ "belowTimeInForce": below_time_in_force,
548
+ "belowIcebergQty": below_iceberg_qty,
549
+ "belowStrategyId": below_strategy_id,
550
+ "belowStrategyType": below_strategy_type,
551
+ # EXTRA
516
552
  "newOrderRespType": new_order_resp_type,
517
553
  "selfTradePreventionMode": self_trade_prevention_mode,
518
- "limitIcebergQty": limit_iceberg_qty,
519
- "stopIcebergQty": stop_iceberg_qty,
520
554
  }
521
555
 
522
- return await self._make_request("POST", url, True, data=data)
556
+ return await self._make_request("POST", url, True, params=data)
523
557
 
524
558
  async def oco_order_cancel(
525
559
  self,
@@ -1486,7 +1520,7 @@ class Client(BaseClient):
1486
1520
  )
1487
1521
  url = self._BASE_SPOT_URL + "/api/v3/userDataStream"
1488
1522
 
1489
- return await super()._make_request("POST", url, headers=self._get_headers())
1523
+ return await super()._make_request("POST", url, headers=self._get_headers("POST"))
1490
1524
 
1491
1525
  async def renew_listen_key(self, listen_key: str) -> dict:
1492
1526
  """Обновление ключа прослушивания для подключения к пользовательскому вебсокету.
@@ -1501,7 +1535,9 @@ class Client(BaseClient):
1501
1535
  url = self._BASE_SPOT_URL + "/api/v3/userDataStream"
1502
1536
  params = {"listenKey": listen_key}
1503
1537
 
1504
- return await super()._make_request("PUT", url, params=params, headers=self._get_headers())
1538
+ return await super()._make_request(
1539
+ "PUT", url, params=params, headers=self._get_headers("PUT")
1540
+ )
1505
1541
 
1506
1542
  async def close_listen_key(self, listen_key: str) -> dict:
1507
1543
  """Закрытие ключа прослушивания для подключения к пользовательскому вебсокету.
@@ -1517,7 +1553,7 @@ class Client(BaseClient):
1517
1553
  params = {"listenKey": listen_key}
1518
1554
 
1519
1555
  return await super()._make_request(
1520
- "DELETE", url, params=params, headers=self._get_headers()
1556
+ "DELETE", url, params=params, headers=self._get_headers("DELETE")
1521
1557
  )
1522
1558
 
1523
1559
  # topic: futures user data streams
@@ -1529,7 +1565,7 @@ class Client(BaseClient):
1529
1565
  """
1530
1566
  url = self._BASE_FUTURES_URL + "/fapi/v1/listenKey"
1531
1567
 
1532
- return await super()._make_request("POST", url, headers=self._get_headers())
1568
+ return await super()._make_request("POST", url, headers=self._get_headers("POST"))
1533
1569
 
1534
1570
  async def futures_renew_listen_key(self) -> dict:
1535
1571
  """Обновление ключа прослушивания для подключения к пользовательскому вебсокету.
@@ -1538,7 +1574,7 @@ class Client(BaseClient):
1538
1574
  """
1539
1575
  url = self._BASE_FUTURES_URL + "/fapi/v1/listenKey"
1540
1576
 
1541
- return await super()._make_request("PUT", url, headers=self._get_headers())
1577
+ return await super()._make_request("PUT", url, headers=self._get_headers("PUT"))
1542
1578
 
1543
1579
  async def futures_close_listen_key(self) -> dict:
1544
1580
  """Закрытие ключа прослушивания для подключения к пользовательскому вебсокету.
@@ -1547,4 +1583,4 @@ class Client(BaseClient):
1547
1583
  """
1548
1584
  url = self._BASE_FUTURES_URL + "/fapi/v1/listenKey"
1549
1585
 
1550
- return await super()._make_request("DELETE", url, headers=self._get_headers())
1586
+ return await super()._make_request("DELETE", url, headers=self._get_headers("DELETE"))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unicex
3
- Version: 0.13.9
3
+ Version: 0.13.11
4
4
  Summary: Unified Crypto Exchange API
5
5
  Author-email: LoveBloodAndDiamonds <ayazshakirzyanov27@gmail.com>
6
6
  License: BSD 3-Clause License
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes