unicex 0.13.6__tar.gz → 0.13.8__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.6/unicex.egg-info → unicex-0.13.8}/PKG-INFO +1 -1
  2. {unicex-0.13.6 → unicex-0.13.8}/pyproject.toml +1 -1
  3. {unicex-0.13.6 → unicex-0.13.8}/unicex/bybit/client.py +14 -7
  4. {unicex-0.13.6 → unicex-0.13.8}/unicex/hyperliquid/websocket_manager.py +35 -9
  5. {unicex-0.13.6 → unicex-0.13.8/unicex.egg-info}/PKG-INFO +1 -1
  6. {unicex-0.13.6 → unicex-0.13.8}/LICENSE +0 -0
  7. {unicex-0.13.6 → unicex-0.13.8}/README.md +0 -0
  8. {unicex-0.13.6 → unicex-0.13.8}/setup.cfg +0 -0
  9. {unicex-0.13.6 → unicex-0.13.8}/unicex/__init__.py +0 -0
  10. {unicex-0.13.6 → unicex-0.13.8}/unicex/_abc/__init__.py +0 -0
  11. {unicex-0.13.6 → unicex-0.13.8}/unicex/_abc/exchange_info.py +0 -0
  12. {unicex-0.13.6 → unicex-0.13.8}/unicex/_abc/uni_client.py +0 -0
  13. {unicex-0.13.6 → unicex-0.13.8}/unicex/_abc/uni_websocket_manager.py +0 -0
  14. {unicex-0.13.6 → unicex-0.13.8}/unicex/_base/__init__.py +0 -0
  15. {unicex-0.13.6 → unicex-0.13.8}/unicex/_base/client.py +0 -0
  16. {unicex-0.13.6 → unicex-0.13.8}/unicex/_base/websocket.py +0 -0
  17. {unicex-0.13.6 → unicex-0.13.8}/unicex/binance/__init__.py +0 -0
  18. {unicex-0.13.6 → unicex-0.13.8}/unicex/binance/adapter.py +0 -0
  19. {unicex-0.13.6 → unicex-0.13.8}/unicex/binance/client.py +0 -0
  20. {unicex-0.13.6 → unicex-0.13.8}/unicex/binance/exchange_info.py +0 -0
  21. {unicex-0.13.6 → unicex-0.13.8}/unicex/binance/uni_client.py +0 -0
  22. {unicex-0.13.6 → unicex-0.13.8}/unicex/binance/uni_websocket_manager.py +0 -0
  23. {unicex-0.13.6 → unicex-0.13.8}/unicex/binance/user_websocket.py +0 -0
  24. {unicex-0.13.6 → unicex-0.13.8}/unicex/binance/websocket_manager.py +0 -0
  25. {unicex-0.13.6 → unicex-0.13.8}/unicex/bitget/__init__.py +0 -0
  26. {unicex-0.13.6 → unicex-0.13.8}/unicex/bitget/adapter.py +0 -0
  27. {unicex-0.13.6 → unicex-0.13.8}/unicex/bitget/client.py +0 -0
  28. {unicex-0.13.6 → unicex-0.13.8}/unicex/bitget/exchange_info.py +0 -0
  29. {unicex-0.13.6 → unicex-0.13.8}/unicex/bitget/uni_client.py +0 -0
  30. {unicex-0.13.6 → unicex-0.13.8}/unicex/bitget/uni_websocket_manager.py +0 -0
  31. {unicex-0.13.6 → unicex-0.13.8}/unicex/bitget/user_websocket.py +0 -0
  32. {unicex-0.13.6 → unicex-0.13.8}/unicex/bitget/websocket_manager.py +0 -0
  33. {unicex-0.13.6 → unicex-0.13.8}/unicex/bybit/__init__.py +0 -0
  34. {unicex-0.13.6 → unicex-0.13.8}/unicex/bybit/adapter.py +0 -0
  35. {unicex-0.13.6 → unicex-0.13.8}/unicex/bybit/exchange_info.py +0 -0
  36. {unicex-0.13.6 → unicex-0.13.8}/unicex/bybit/uni_client.py +0 -0
  37. {unicex-0.13.6 → unicex-0.13.8}/unicex/bybit/uni_websocket_manager.py +0 -0
  38. {unicex-0.13.6 → unicex-0.13.8}/unicex/bybit/user_websocket.py +0 -0
  39. {unicex-0.13.6 → unicex-0.13.8}/unicex/bybit/websocket_manager.py +0 -0
  40. {unicex-0.13.6 → unicex-0.13.8}/unicex/enums.py +0 -0
  41. {unicex-0.13.6 → unicex-0.13.8}/unicex/exceptions.py +0 -0
  42. {unicex-0.13.6 → unicex-0.13.8}/unicex/extra.py +0 -0
  43. {unicex-0.13.6 → unicex-0.13.8}/unicex/gate/__init__.py +0 -0
  44. {unicex-0.13.6 → unicex-0.13.8}/unicex/gate/adapter.py +0 -0
  45. {unicex-0.13.6 → unicex-0.13.8}/unicex/gate/client.py +0 -0
  46. {unicex-0.13.6 → unicex-0.13.8}/unicex/gate/exchange_info.py +0 -0
  47. {unicex-0.13.6 → unicex-0.13.8}/unicex/gate/uni_client.py +0 -0
  48. {unicex-0.13.6 → unicex-0.13.8}/unicex/gate/uni_websocket_manager.py +0 -0
  49. {unicex-0.13.6 → unicex-0.13.8}/unicex/gate/user_websocket.py +0 -0
  50. {unicex-0.13.6 → unicex-0.13.8}/unicex/gate/websocket_manager.py +0 -0
  51. {unicex-0.13.6 → unicex-0.13.8}/unicex/hyperliquid/__init__.py +0 -0
  52. {unicex-0.13.6 → unicex-0.13.8}/unicex/hyperliquid/adapter.py +0 -0
  53. {unicex-0.13.6 → unicex-0.13.8}/unicex/hyperliquid/client.py +0 -0
  54. {unicex-0.13.6 → unicex-0.13.8}/unicex/hyperliquid/exchange_info.py +0 -0
  55. {unicex-0.13.6 → unicex-0.13.8}/unicex/hyperliquid/uni_client.py +0 -0
  56. {unicex-0.13.6 → unicex-0.13.8}/unicex/hyperliquid/uni_websocket_manager.py +0 -0
  57. {unicex-0.13.6 → unicex-0.13.8}/unicex/hyperliquid/user_websocket.py +0 -0
  58. {unicex-0.13.6 → unicex-0.13.8}/unicex/mapper.py +0 -0
  59. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/__init__.py +0 -0
  60. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/_spot_ws_proto/PrivateAccountV3Api_pb2.py +0 -0
  61. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/_spot_ws_proto/PrivateDealsV3Api_pb2.py +0 -0
  62. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/_spot_ws_proto/PrivateOrdersV3Api_pb2.py +0 -0
  63. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/_spot_ws_proto/PublicAggreBookTickerV3Api_pb2.py +0 -0
  64. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/_spot_ws_proto/PublicAggreDealsV3Api_pb2.py +0 -0
  65. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/_spot_ws_proto/PublicAggreDepthsV3Api_pb2.py +0 -0
  66. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/_spot_ws_proto/PublicBookTickerBatchV3Api_pb2.py +0 -0
  67. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/_spot_ws_proto/PublicBookTickerV3Api_pb2.py +0 -0
  68. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/_spot_ws_proto/PublicDealsV3Api_pb2.py +0 -0
  69. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/_spot_ws_proto/PublicFuture_pb2.py +0 -0
  70. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/_spot_ws_proto/PublicIncreaseDepthsBatchV3Api_pb2.py +0 -0
  71. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/_spot_ws_proto/PublicIncreaseDepthsV3Api_pb2.py +0 -0
  72. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/_spot_ws_proto/PublicLimitDepthsV3Api_pb2.py +0 -0
  73. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/_spot_ws_proto/PublicMiniTickerV3Api_pb2.py +0 -0
  74. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/_spot_ws_proto/PublicMiniTickersV3Api_pb2.py +0 -0
  75. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/_spot_ws_proto/PublicSpotKlineV3Api_pb2.py +0 -0
  76. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/_spot_ws_proto/PushDataV3ApiWrapper_pb2.py +0 -0
  77. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/_spot_ws_proto/__init__.py +0 -0
  78. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/adapter.py +0 -0
  79. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/client.py +0 -0
  80. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/exchange_info.py +0 -0
  81. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/uni_client.py +0 -0
  82. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/uni_websocket_manager.py +0 -0
  83. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/user_websocket.py +0 -0
  84. {unicex-0.13.6 → unicex-0.13.8}/unicex/mexc/websocket_manager.py +0 -0
  85. {unicex-0.13.6 → unicex-0.13.8}/unicex/okx/__init__.py +0 -0
  86. {unicex-0.13.6 → unicex-0.13.8}/unicex/okx/adapter.py +0 -0
  87. {unicex-0.13.6 → unicex-0.13.8}/unicex/okx/client.py +0 -0
  88. {unicex-0.13.6 → unicex-0.13.8}/unicex/okx/exchange_info.py +0 -0
  89. {unicex-0.13.6 → unicex-0.13.8}/unicex/okx/uni_client.py +0 -0
  90. {unicex-0.13.6 → unicex-0.13.8}/unicex/okx/uni_websocket_manager.py +0 -0
  91. {unicex-0.13.6 → unicex-0.13.8}/unicex/okx/user_websocket.py +0 -0
  92. {unicex-0.13.6 → unicex-0.13.8}/unicex/okx/websocket_manager.py +0 -0
  93. {unicex-0.13.6 → unicex-0.13.8}/unicex/types.py +0 -0
  94. {unicex-0.13.6 → unicex-0.13.8}/unicex/utils.py +0 -0
  95. {unicex-0.13.6 → unicex-0.13.8}/unicex.egg-info/SOURCES.txt +0 -0
  96. {unicex-0.13.6 → unicex-0.13.8}/unicex.egg-info/dependency_links.txt +0 -0
  97. {unicex-0.13.6 → unicex-0.13.8}/unicex.egg-info/requires.txt +0 -0
  98. {unicex-0.13.6 → unicex-0.13.8}/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.6
3
+ Version: 0.13.8
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.6"
7
+ version = "0.13.8"
8
8
 
9
9
  description = "Unified Crypto Exchange API "
10
10
  readme = "README.md"
@@ -7,7 +7,7 @@ from typing import Any, Literal
7
7
  from unicex._base import BaseClient
8
8
  from unicex.exceptions import NotAuthorized
9
9
  from unicex.types import RequestMethod
10
- from unicex.utils import filter_params, generate_hmac_sha256_signature
10
+ from unicex.utils import dict_to_query_string, filter_params, generate_hmac_sha256_signature
11
11
 
12
12
 
13
13
  class Client(BaseClient):
@@ -35,7 +35,7 @@ class Client(BaseClient):
35
35
  headers["X-BAPI-TIMESTAMP"] = timestamp
36
36
  return headers
37
37
 
38
- def _generate_signature(self, timestamp: str, payload: dict) -> str:
38
+ def _generate_signature(self, timestamp: str, payload: dict, method: RequestMethod) -> str:
39
39
  """Генерация подписи.
40
40
 
41
41
  Источник: https://github.com/bybit-exchange/api-usage-examples/blob/master/V5_demo/api_demo/Encryption_HMAC.py
@@ -44,9 +44,16 @@ class Client(BaseClient):
44
44
  if not self.is_authorized():
45
45
  raise NotAuthorized("Api key and api secret is required to private endpoints")
46
46
 
47
- dumped_payload = json.dumps(payload)
48
- prepared_query_string = timestamp + self._api_key + self._RECV_WINDOW + dumped_payload # type: ignore[attrDefined]
49
- return generate_hmac_sha256_signature(self._api_secret, prepared_query_string) # type: ignore[attrDefined]
47
+ if method == "POST":
48
+ # timestamp+api_key+recv_window+jsonBodyString
49
+ dumped_payload = json.dumps(payload)
50
+ prepared_query_string = timestamp + self._api_key + self._RECV_WINDOW + dumped_payload # type: ignore[attrDefined]
51
+ return generate_hmac_sha256_signature(self._api_secret, prepared_query_string) # type: ignore[attrDefined]
52
+ else:
53
+ # timestamp+api_key+recv_window+queryString
54
+ query_string = dict_to_query_string(payload)
55
+ prepared_query_string = timestamp + self._api_key + self._RECV_WINDOW + query_string # type: ignore[attrDefined]
56
+ return generate_hmac_sha256_signature(self._api_secret, prepared_query_string) # type: ignore[attrDefined]
50
57
 
51
58
  async def _make_request(
52
59
  self,
@@ -94,7 +101,7 @@ class Client(BaseClient):
94
101
  payload = params
95
102
 
96
103
  # Генерируем строку для подписи
97
- signature = self._generate_signature(timestamp, payload)
104
+ signature = self._generate_signature(timestamp, payload, method)
98
105
 
99
106
  # Генерируем заголовки (вкл. в себя подпись и апи ключ)
100
107
  headers = self._get_headers(timestamp, signature)
@@ -110,7 +117,7 @@ class Client(BaseClient):
110
117
  return await super()._make_request(
111
118
  method=method,
112
119
  url=url,
113
- params=payload,
120
+ params=params,
114
121
  headers=headers,
115
122
  )
116
123
 
@@ -99,24 +99,38 @@ class WebsocketManager:
99
99
  **self._ws_kwargs,
100
100
  )
101
101
 
102
- def candle(self, callback: CallbackType, coin: str, interval: str) -> Websocket:
102
+ def candle(
103
+ self,
104
+ callback: CallbackType,
105
+ interval: str,
106
+ coin: str | None = None,
107
+ coins: list[str] | None = None,
108
+ ) -> Websocket:
103
109
  """Создает вебсокет для получения свечей.
104
110
 
105
111
  Параметры:
106
112
  callback (`CallbackType`): Асинхронная функция обратного вызова для обработки сообщений.
107
113
  coin (`str`): Символ монеты.
114
+ coins (`list[str]`): Список символов монет для мультиплекс подключения.
108
115
  interval (`str`): Интервал свечей ("1m", "3m", "5m", "15m", "30m", "1h", "2h", "4h", "8h", "12h", "1d", "3d", "1w", "1M").
109
116
 
110
117
  Возвращает:
111
118
  `Websocket`: Объект для управления вебсокет соединением.
112
119
  """
113
- subscription_message = self._create_subscription_message(
114
- "candle", coin=coin, interval=interval
115
- )
120
+ if coin and coins:
121
+ raise ValueError("Parameters coin and coins cannot be used together")
122
+ if not (coin or coins):
123
+ raise ValueError("Either coin or coins must be provided")
124
+ if coin:
125
+ coins = [coin]
126
+ subscription_messages = [
127
+ self._create_subscription_message("candle", coin=coin, interval=interval)
128
+ for coin in coins # type: ignore
129
+ ]
116
130
  return Websocket(
117
131
  callback=callback,
118
132
  url=self._URL,
119
- subscription_messages=[subscription_message],
133
+ subscription_messages=subscription_messages,
120
134
  **self._ws_kwargs,
121
135
  )
122
136
 
@@ -152,21 +166,33 @@ class WebsocketManager:
152
166
  **self._ws_kwargs,
153
167
  )
154
168
 
155
- def trades(self, callback: CallbackType, coin: str) -> Websocket:
169
+ def trades(
170
+ self, callback: CallbackType, coin: str | None = None, coins: list[str] | None = None
171
+ ) -> Websocket:
156
172
  """Создает вебсокет для получения сделок.
157
173
 
158
174
  Параметры:
159
175
  callback (`CallbackType`): Асинхронная функция обратного вызова для обработки сообщений.
160
- coin (`str`): Символ монеты.
176
+ coin (`str | None`): Символ монеты.
177
+ coins (`list[str] | None`): Список символов монет для мультиплекс подключения.
161
178
 
162
179
  Возвращает:
163
180
  `Websocket`: Объект для управления вебсокет соединением.
164
181
  """
165
- subscription_message = self._create_subscription_message("trades", coin=coin)
182
+ if coin and coins:
183
+ raise ValueError("Parameters coin and coins cannot be used together")
184
+ if not (coin or coins):
185
+ raise ValueError("Either coin or coins must be provided")
186
+ if coin:
187
+ coins = [coin]
188
+ subscription_messages = [
189
+ self._create_subscription_message("trades", coin=coin)
190
+ for coin in coins # type: ignore
191
+ ]
166
192
  return Websocket(
167
193
  callback=callback,
168
194
  url=self._URL,
169
- subscription_messages=[subscription_message],
195
+ subscription_messages=subscription_messages,
170
196
  **self._ws_kwargs,
171
197
  )
172
198
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unicex
3
- Version: 0.13.6
3
+ Version: 0.13.8
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
File without changes
File without changes
File without changes
File without changes