unicex 0.16.0__tar.gz → 0.16.2__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 (114) hide show
  1. {unicex-0.16.0/unicex.egg-info → unicex-0.16.2}/PKG-INFO +1 -1
  2. {unicex-0.16.0 → unicex-0.16.2}/pyproject.toml +1 -1
  3. {unicex-0.16.0 → unicex-0.16.2}/unicex/__init__.py +0 -2
  4. {unicex-0.16.0 → unicex-0.16.2}/unicex/binance/adapter.py +2 -3
  5. {unicex-0.16.0 → unicex-0.16.2}/unicex/bitget/adapter.py +1 -2
  6. {unicex-0.16.0 → unicex-0.16.2}/unicex/gate/adapter.py +11 -1
  7. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/adapter.py +1 -1
  8. {unicex-0.16.0 → unicex-0.16.2}/unicex/okx/adapter.py +11 -1
  9. {unicex-0.16.0 → unicex-0.16.2}/unicex/okx/exchange_info.py +2 -2
  10. {unicex-0.16.0 → unicex-0.16.2}/unicex/okx/websocket_manager.py +116 -163
  11. {unicex-0.16.0 → unicex-0.16.2}/unicex/types.py +0 -7
  12. {unicex-0.16.0 → unicex-0.16.2/unicex.egg-info}/PKG-INFO +1 -1
  13. {unicex-0.16.0 → unicex-0.16.2}/LICENSE +0 -0
  14. {unicex-0.16.0 → unicex-0.16.2}/README.md +0 -0
  15. {unicex-0.16.0 → unicex-0.16.2}/setup.cfg +0 -0
  16. {unicex-0.16.0 → unicex-0.16.2}/unicex/_abc/__init__.py +0 -0
  17. {unicex-0.16.0 → unicex-0.16.2}/unicex/_abc/exchange_info.py +0 -0
  18. {unicex-0.16.0 → unicex-0.16.2}/unicex/_abc/uni_client.py +0 -0
  19. {unicex-0.16.0 → unicex-0.16.2}/unicex/_abc/uni_websocket_manager.py +0 -0
  20. {unicex-0.16.0 → unicex-0.16.2}/unicex/_base/__init__.py +0 -0
  21. {unicex-0.16.0 → unicex-0.16.2}/unicex/_base/client.py +0 -0
  22. {unicex-0.16.0 → unicex-0.16.2}/unicex/_base/websocket.py +0 -0
  23. {unicex-0.16.0 → unicex-0.16.2}/unicex/binance/__init__.py +0 -0
  24. {unicex-0.16.0 → unicex-0.16.2}/unicex/binance/client.py +0 -0
  25. {unicex-0.16.0 → unicex-0.16.2}/unicex/binance/exchange_info.py +0 -0
  26. {unicex-0.16.0 → unicex-0.16.2}/unicex/binance/uni_client.py +0 -0
  27. {unicex-0.16.0 → unicex-0.16.2}/unicex/binance/uni_websocket_manager.py +0 -0
  28. {unicex-0.16.0 → unicex-0.16.2}/unicex/binance/user_websocket.py +0 -0
  29. {unicex-0.16.0 → unicex-0.16.2}/unicex/binance/websocket_manager.py +0 -0
  30. {unicex-0.16.0 → unicex-0.16.2}/unicex/bingx/__init__.py +0 -0
  31. {unicex-0.16.0 → unicex-0.16.2}/unicex/bingx/adapter.py +0 -0
  32. {unicex-0.16.0 → unicex-0.16.2}/unicex/bingx/client.py +0 -0
  33. {unicex-0.16.0 → unicex-0.16.2}/unicex/bingx/exchange_info.py +0 -0
  34. {unicex-0.16.0 → unicex-0.16.2}/unicex/bingx/uni_client.py +0 -0
  35. {unicex-0.16.0 → unicex-0.16.2}/unicex/bingx/uni_websocket_manager.py +0 -0
  36. {unicex-0.16.0 → unicex-0.16.2}/unicex/bingx/user_websocket.py +0 -0
  37. {unicex-0.16.0 → unicex-0.16.2}/unicex/bingx/websocket_manager.py +0 -0
  38. {unicex-0.16.0 → unicex-0.16.2}/unicex/bitget/__init__.py +0 -0
  39. {unicex-0.16.0 → unicex-0.16.2}/unicex/bitget/client.py +0 -0
  40. {unicex-0.16.0 → unicex-0.16.2}/unicex/bitget/exchange_info.py +0 -0
  41. {unicex-0.16.0 → unicex-0.16.2}/unicex/bitget/uni_client.py +0 -0
  42. {unicex-0.16.0 → unicex-0.16.2}/unicex/bitget/uni_websocket_manager.py +0 -0
  43. {unicex-0.16.0 → unicex-0.16.2}/unicex/bitget/user_websocket.py +0 -0
  44. {unicex-0.16.0 → unicex-0.16.2}/unicex/bitget/websocket_manager.py +0 -0
  45. {unicex-0.16.0 → unicex-0.16.2}/unicex/bybit/__init__.py +0 -0
  46. {unicex-0.16.0 → unicex-0.16.2}/unicex/bybit/adapter.py +0 -0
  47. {unicex-0.16.0 → unicex-0.16.2}/unicex/bybit/client.py +0 -0
  48. {unicex-0.16.0 → unicex-0.16.2}/unicex/bybit/exchange_info.py +0 -0
  49. {unicex-0.16.0 → unicex-0.16.2}/unicex/bybit/uni_client.py +0 -0
  50. {unicex-0.16.0 → unicex-0.16.2}/unicex/bybit/uni_websocket_manager.py +0 -0
  51. {unicex-0.16.0 → unicex-0.16.2}/unicex/bybit/user_websocket.py +0 -0
  52. {unicex-0.16.0 → unicex-0.16.2}/unicex/bybit/websocket_manager.py +0 -0
  53. {unicex-0.16.0 → unicex-0.16.2}/unicex/enums.py +0 -0
  54. {unicex-0.16.0 → unicex-0.16.2}/unicex/exceptions.py +0 -0
  55. {unicex-0.16.0 → unicex-0.16.2}/unicex/extra.py +0 -0
  56. {unicex-0.16.0 → unicex-0.16.2}/unicex/gate/__init__.py +0 -0
  57. {unicex-0.16.0 → unicex-0.16.2}/unicex/gate/client.py +0 -0
  58. {unicex-0.16.0 → unicex-0.16.2}/unicex/gate/exchange_info.py +0 -0
  59. {unicex-0.16.0 → unicex-0.16.2}/unicex/gate/uni_client.py +0 -0
  60. {unicex-0.16.0 → unicex-0.16.2}/unicex/gate/uni_websocket_manager.py +0 -0
  61. {unicex-0.16.0 → unicex-0.16.2}/unicex/gate/user_websocket.py +0 -0
  62. {unicex-0.16.0 → unicex-0.16.2}/unicex/gate/websocket_manager.py +0 -0
  63. {unicex-0.16.0 → unicex-0.16.2}/unicex/hyperliquid/__init__.py +0 -0
  64. {unicex-0.16.0 → unicex-0.16.2}/unicex/hyperliquid/adapter.py +0 -0
  65. {unicex-0.16.0 → unicex-0.16.2}/unicex/hyperliquid/client.py +0 -0
  66. {unicex-0.16.0 → unicex-0.16.2}/unicex/hyperliquid/exchange_info.py +0 -0
  67. {unicex-0.16.0 → unicex-0.16.2}/unicex/hyperliquid/uni_client.py +0 -0
  68. {unicex-0.16.0 → unicex-0.16.2}/unicex/hyperliquid/uni_websocket_manager.py +0 -0
  69. {unicex-0.16.0 → unicex-0.16.2}/unicex/hyperliquid/user_websocket.py +0 -0
  70. {unicex-0.16.0 → unicex-0.16.2}/unicex/hyperliquid/websocket_manager.py +0 -0
  71. {unicex-0.16.0 → unicex-0.16.2}/unicex/kucoin/__init__.py +0 -0
  72. {unicex-0.16.0 → unicex-0.16.2}/unicex/kucoin/adapter.py +0 -0
  73. {unicex-0.16.0 → unicex-0.16.2}/unicex/kucoin/client.py +0 -0
  74. {unicex-0.16.0 → unicex-0.16.2}/unicex/kucoin/exchange_info.py +0 -0
  75. {unicex-0.16.0 → unicex-0.16.2}/unicex/kucoin/uni_client.py +0 -0
  76. {unicex-0.16.0 → unicex-0.16.2}/unicex/kucoin/uni_websocket_manager.py +0 -0
  77. {unicex-0.16.0 → unicex-0.16.2}/unicex/kucoin/user_websocket.py +0 -0
  78. {unicex-0.16.0 → unicex-0.16.2}/unicex/kucoin/websocket_manager.py +0 -0
  79. {unicex-0.16.0 → unicex-0.16.2}/unicex/mapper.py +0 -0
  80. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/__init__.py +0 -0
  81. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/_spot_ws_proto/PrivateAccountV3Api_pb2.py +0 -0
  82. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/_spot_ws_proto/PrivateDealsV3Api_pb2.py +0 -0
  83. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/_spot_ws_proto/PrivateOrdersV3Api_pb2.py +0 -0
  84. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/_spot_ws_proto/PublicAggreBookTickerV3Api_pb2.py +0 -0
  85. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/_spot_ws_proto/PublicAggreDealsV3Api_pb2.py +0 -0
  86. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/_spot_ws_proto/PublicAggreDepthsV3Api_pb2.py +0 -0
  87. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/_spot_ws_proto/PublicBookTickerBatchV3Api_pb2.py +0 -0
  88. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/_spot_ws_proto/PublicBookTickerV3Api_pb2.py +0 -0
  89. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/_spot_ws_proto/PublicDealsV3Api_pb2.py +0 -0
  90. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/_spot_ws_proto/PublicFuture_pb2.py +0 -0
  91. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/_spot_ws_proto/PublicIncreaseDepthsBatchV3Api_pb2.py +0 -0
  92. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/_spot_ws_proto/PublicIncreaseDepthsV3Api_pb2.py +0 -0
  93. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/_spot_ws_proto/PublicLimitDepthsV3Api_pb2.py +0 -0
  94. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/_spot_ws_proto/PublicMiniTickerV3Api_pb2.py +0 -0
  95. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/_spot_ws_proto/PublicMiniTickersV3Api_pb2.py +0 -0
  96. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/_spot_ws_proto/PublicSpotKlineV3Api_pb2.py +0 -0
  97. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/_spot_ws_proto/PushDataV3ApiWrapper_pb2.py +0 -0
  98. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/_spot_ws_proto/__init__.py +0 -0
  99. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/client.py +0 -0
  100. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/exchange_info.py +0 -0
  101. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/uni_client.py +0 -0
  102. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/uni_websocket_manager.py +0 -0
  103. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/user_websocket.py +0 -0
  104. {unicex-0.16.0 → unicex-0.16.2}/unicex/mexc/websocket_manager.py +0 -0
  105. {unicex-0.16.0 → unicex-0.16.2}/unicex/okx/__init__.py +0 -0
  106. {unicex-0.16.0 → unicex-0.16.2}/unicex/okx/client.py +0 -0
  107. {unicex-0.16.0 → unicex-0.16.2}/unicex/okx/uni_client.py +0 -0
  108. {unicex-0.16.0 → unicex-0.16.2}/unicex/okx/uni_websocket_manager.py +0 -0
  109. {unicex-0.16.0 → unicex-0.16.2}/unicex/okx/user_websocket.py +0 -0
  110. {unicex-0.16.0 → unicex-0.16.2}/unicex/utils.py +0 -0
  111. {unicex-0.16.0 → unicex-0.16.2}/unicex.egg-info/SOURCES.txt +0 -0
  112. {unicex-0.16.0 → unicex-0.16.2}/unicex.egg-info/dependency_links.txt +0 -0
  113. {unicex-0.16.0 → unicex-0.16.2}/unicex.egg-info/requires.txt +0 -0
  114. {unicex-0.16.0 → unicex-0.16.2}/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.16.0
3
+ Version: 0.16.2
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.16.0"
7
+ version = "0.16.2"
8
8
 
9
9
  description = "Unified Crypto Exchange API "
10
10
  readme = "README.md"
@@ -18,7 +18,6 @@ __all__ = [
18
18
  "TickerDailyItem",
19
19
  "KlineDict",
20
20
  "TradeDict",
21
- "AggTradeDict",
22
21
  "RequestMethod",
23
22
  "LoggerLike",
24
23
  "OpenInterestDict",
@@ -112,7 +111,6 @@ from .types import (
112
111
  TickerDailyItem,
113
112
  KlineDict,
114
113
  TradeDict,
115
- AggTradeDict,
116
114
  RequestMethod,
117
115
  LoggerLike,
118
116
  OpenInterestDict,
@@ -2,7 +2,6 @@ __all__ = ["Adapter"]
2
2
 
3
3
 
4
4
  from unicex.types import (
5
- AggTradeDict,
6
5
  KlineDict,
7
6
  OpenInterestItem,
8
7
  TickerDailyDict,
@@ -150,7 +149,7 @@ class Adapter:
150
149
  ]
151
150
 
152
151
  @staticmethod
153
- def aggtrades_message(raw_msg: dict) -> list[AggTradeDict]:
152
+ def aggtrades_message(raw_msg: dict) -> list[TradeDict]:
154
153
  """Преобразует сырое сообщение с вебсокета, в котором содержится информация о
155
154
  аггрегированных сделке/сделках в унифицированный вид.
156
155
 
@@ -162,7 +161,7 @@ class Adapter:
162
161
  """
163
162
  msg = raw_msg.get("data", raw_msg)
164
163
  return [
165
- AggTradeDict(
164
+ TradeDict(
166
165
  t=int(msg["T"]),
167
166
  s=str(msg["s"]),
168
167
  S="SELL" if bool(msg["m"]) else "BUY",
@@ -1,7 +1,6 @@
1
1
  from typing import Any
2
2
 
3
3
  from unicex.types import (
4
- AggTradeDict,
5
4
  KlineDict,
6
5
  OpenInterestDict,
7
6
  OpenInterestItem,
@@ -155,7 +154,7 @@ class Adapter:
155
154
  symbol = raw_msg["arg"]["instId"]
156
155
 
157
156
  return [
158
- AggTradeDict(
157
+ TradeDict(
159
158
  t=int(trade["ts"]),
160
159
  s=symbol,
161
160
  S=trade["side"].upper(),
@@ -15,6 +15,8 @@ from unicex.types import (
15
15
  )
16
16
  from unicex.utils import catch_adapter_errors, decorate_all_methods
17
17
 
18
+ from .exchange_info import ExchangeInfo
19
+
18
20
 
19
21
  @decorate_all_methods(catch_adapter_errors)
20
22
  class Adapter:
@@ -272,10 +274,18 @@ class Adapter:
272
274
  s=item["contract"],
273
275
  S="BUY" if float(item["size"]) > 0 else "SELL",
274
276
  p=float(item["price"]),
275
- v=abs(float(item["size"])),
277
+ v=abs(float(item["size"])) * Adapter._get_contract_size(item["contract"]),
276
278
  )
277
279
  for item in sorted(
278
280
  raw_msg["result"],
279
281
  key=lambda x: x["create_time_ms"],
280
282
  )
281
283
  ]
284
+
285
+ @staticmethod
286
+ def _get_contract_size(symbol: str) -> float:
287
+ """Возвращает размер контракта для указанного символа тикера."""
288
+ try:
289
+ return ExchangeInfo.get_futures_ticker_info(symbol)["contract_size"] or 1
290
+ except: # noqa
291
+ return 1
@@ -326,7 +326,7 @@ class Adapter:
326
326
  s=raw_msg["symbol"],
327
327
  S="BUY" if item["T"] == 1 else "SELL",
328
328
  p=item["p"],
329
- v=item["v"],
329
+ v=item["v"] * Adapter._get_contract_size(raw_msg["symbol"]),
330
330
  )
331
331
  for item in sorted(
332
332
  raw_msg["data"],
@@ -13,6 +13,8 @@ from unicex.types import (
13
13
  )
14
14
  from unicex.utils import catch_adapter_errors, decorate_all_methods
15
15
 
16
+ from .exchange_info import ExchangeInfo
17
+
16
18
 
17
19
  @decorate_all_methods(catch_adapter_errors)
18
20
  class Adapter:
@@ -185,7 +187,15 @@ class Adapter:
185
187
  s=trade["instId"],
186
188
  S=trade["side"].upper(),
187
189
  p=float(trade["px"]),
188
- v=float(trade["sz"]),
190
+ v=float(trade["sz"]) * Adapter._get_contract_size(trade["instId"]),
189
191
  )
190
192
  for trade in sorted(raw_msg["data"], key=lambda item: int(item["ts"]))
191
193
  ]
194
+
195
+ @staticmethod
196
+ def _get_contract_size(symbol: str) -> float:
197
+ """Возвращает размер контракта для указанного символа тикера."""
198
+ try:
199
+ return ExchangeInfo.get_futures_ticker_info(symbol)["contract_size"] or 1
200
+ except: # noqa
201
+ return 1
@@ -22,9 +22,9 @@ class ExchangeInfo(IExchangeInfo):
22
22
  for el in exchange_info["data"]:
23
23
  tickers_info[el["instId"]] = TickerInfoItem(
24
24
  tick_precision=None,
25
- tick_step=float(el["tickSz"]),
25
+ tick_step=float(el["tickSz"] or "0"),
26
26
  size_precision=None,
27
- size_step=float(el["lotSz"]),
27
+ size_step=float(el["lotSz"] or "0"),
28
28
  contract_size=1,
29
29
  )
30
30
 
@@ -34,6 +34,15 @@ class WebsocketManager:
34
34
  self.client = client
35
35
  self._ws_kwargs = {"ping_message": "ping", **ws_kwargs}
36
36
 
37
+ def _build_subscription_message(self, args: list[dict[str, Any]]) -> str:
38
+ """Формирует JSON-сообщение подписки."""
39
+ return json.dumps(
40
+ {
41
+ "op": "subscribe",
42
+ "args": args,
43
+ }
44
+ )
45
+
37
46
  def instruments(
38
47
  self,
39
48
  callback: CallbackType,
@@ -50,16 +59,13 @@ class WebsocketManager:
50
59
  Возвращает:
51
60
  `Websocket`: Объект для управления вебсокет соединением.
52
61
  """
53
- subscription_message = json.dumps(
54
- {
55
- "op": "subscribe",
56
- "args": [
57
- {
58
- "channel": "instruments",
59
- "instType": inst_type,
60
- }
61
- ],
62
- }
62
+ subscription_message = self._build_subscription_message(
63
+ [
64
+ {
65
+ "channel": "instruments",
66
+ "instType": inst_type,
67
+ }
68
+ ]
63
69
  )
64
70
 
65
71
  return Websocket(
@@ -85,16 +91,13 @@ class WebsocketManager:
85
91
  Возвращает:
86
92
  `Websocket`: Объект для управления вебсокет соединением.
87
93
  """
88
- subscription_message = json.dumps(
89
- {
90
- "op": "subscribe",
91
- "args": [
92
- {
93
- "channel": "open-interest",
94
- "instId": inst_id,
95
- }
96
- ],
97
- }
94
+ subscription_message = self._build_subscription_message(
95
+ [
96
+ {
97
+ "channel": "open-interest",
98
+ "instId": inst_id,
99
+ }
100
+ ]
98
101
  )
99
102
 
100
103
  return Websocket(
@@ -120,16 +123,13 @@ class WebsocketManager:
120
123
  Возвращает:
121
124
  `Websocket`: Объект для управления вебсокет соединением.
122
125
  """
123
- subscription_message = json.dumps(
124
- {
125
- "op": "subscribe",
126
- "args": [
127
- {
128
- "channel": "funding-rate",
129
- "instId": inst_id,
130
- }
131
- ],
132
- }
126
+ subscription_message = self._build_subscription_message(
127
+ [
128
+ {
129
+ "channel": "funding-rate",
130
+ "instId": inst_id,
131
+ }
132
+ ]
133
133
  )
134
134
 
135
135
  return Websocket(
@@ -155,16 +155,13 @@ class WebsocketManager:
155
155
  Возвращает:
156
156
  `Websocket`: Объект для управления вебсокет соединением.
157
157
  """
158
- subscription_message = json.dumps(
159
- {
160
- "op": "subscribe",
161
- "args": [
162
- {
163
- "channel": "price-limit",
164
- "instId": inst_id,
165
- }
166
- ],
167
- }
158
+ subscription_message = self._build_subscription_message(
159
+ [
160
+ {
161
+ "channel": "price-limit",
162
+ "instId": inst_id,
163
+ }
164
+ ]
168
165
  )
169
166
 
170
167
  return Websocket(
@@ -190,16 +187,13 @@ class WebsocketManager:
190
187
  Возвращает:
191
188
  `Websocket`: Объект для управления вебсокет соединением.
192
189
  """
193
- subscription_message = json.dumps(
194
- {
195
- "op": "subscribe",
196
- "args": [
197
- {
198
- "channel": "opt-summary",
199
- "instFamily": inst_family,
200
- }
201
- ],
202
- }
190
+ subscription_message = self._build_subscription_message(
191
+ [
192
+ {
193
+ "channel": "opt-summary",
194
+ "instFamily": inst_family,
195
+ }
196
+ ]
203
197
  )
204
198
 
205
199
  return Websocket(
@@ -244,12 +238,7 @@ class WebsocketManager:
244
238
  if inst_id:
245
239
  args["instId"] = inst_id
246
240
 
247
- subscription_message = json.dumps(
248
- {
249
- "op": "subscribe",
250
- "args": [args],
251
- }
252
- )
241
+ subscription_message = self._build_subscription_message([args])
253
242
 
254
243
  return Websocket(
255
244
  callback=callback,
@@ -274,16 +263,13 @@ class WebsocketManager:
274
263
  Возвращает:
275
264
  `Websocket`: Объект для управления вебсокет соединением.
276
265
  """
277
- subscription_message = json.dumps(
278
- {
279
- "op": "subscribe",
280
- "args": [
281
- {
282
- "channel": "mark-price",
283
- "instId": inst_id,
284
- }
285
- ],
286
- }
266
+ subscription_message = self._build_subscription_message(
267
+ [
268
+ {
269
+ "channel": "mark-price",
270
+ "instId": inst_id,
271
+ }
272
+ ]
287
273
  )
288
274
 
289
275
  return Websocket(
@@ -309,16 +295,13 @@ class WebsocketManager:
309
295
  Возвращает:
310
296
  `Websocket`: Объект для управления вебсокет соединением.
311
297
  """
312
- subscription_message = json.dumps(
313
- {
314
- "op": "subscribe",
315
- "args": [
316
- {
317
- "channel": "index-tickers",
318
- "instId": inst_id,
319
- }
320
- ],
321
- }
298
+ subscription_message = self._build_subscription_message(
299
+ [
300
+ {
301
+ "channel": "index-tickers",
302
+ "instId": inst_id,
303
+ }
304
+ ]
322
305
  )
323
306
 
324
307
  return Websocket(
@@ -375,16 +358,13 @@ class WebsocketManager:
375
358
  `Websocket`: Объект для управления вебсокет соединением.
376
359
  """
377
360
  channel = f"mark-price-candle{interval}"
378
- subscription_message = json.dumps(
379
- {
380
- "op": "subscribe",
381
- "args": [
382
- {
383
- "channel": channel,
384
- "instId": inst_id,
385
- }
386
- ],
387
- }
361
+ subscription_message = self._build_subscription_message(
362
+ [
363
+ {
364
+ "channel": channel,
365
+ "instId": inst_id,
366
+ }
367
+ ]
388
368
  )
389
369
 
390
370
  return Websocket(
@@ -440,16 +420,13 @@ class WebsocketManager:
440
420
  `Websocket`: Объект для управления вебсокет соединением.
441
421
  """
442
422
  channel = f"index-candle{interval}"
443
- subscription_message = json.dumps(
444
- {
445
- "op": "subscribe",
446
- "args": [
447
- {
448
- "channel": channel,
449
- "instId": inst_id,
450
- }
451
- ],
452
- }
423
+ subscription_message = self._build_subscription_message(
424
+ [
425
+ {
426
+ "channel": channel,
427
+ "instId": inst_id,
428
+ }
429
+ ]
453
430
  )
454
431
 
455
432
  return Websocket(
@@ -475,16 +452,13 @@ class WebsocketManager:
475
452
  Возвращает:
476
453
  `Websocket`: Объект для управления вебсокет соединением.
477
454
  """
478
- subscription_message = json.dumps(
479
- {
480
- "op": "subscribe",
481
- "args": [
482
- {
483
- "channel": "liquidation-orders",
484
- "instType": inst_type,
485
- }
486
- ],
487
- }
455
+ subscription_message = self._build_subscription_message(
456
+ [
457
+ {
458
+ "channel": "liquidation-orders",
459
+ "instType": inst_type,
460
+ }
461
+ ]
488
462
  )
489
463
 
490
464
  return Websocket(
@@ -520,12 +494,7 @@ class WebsocketManager:
520
494
  if inst_family:
521
495
  args["instFamily"] = inst_family
522
496
 
523
- subscription_message = json.dumps(
524
- {
525
- "op": "subscribe",
526
- "args": [args],
527
- }
528
- )
497
+ subscription_message = self._build_subscription_message([args])
529
498
 
530
499
  return Websocket(
531
500
  callback=callback,
@@ -550,16 +519,13 @@ class WebsocketManager:
550
519
  Возвращает:
551
520
  `Websocket`: Объект для управления вебсокет соединением.
552
521
  """
553
- subscription_message = json.dumps(
554
- {
555
- "op": "subscribe",
556
- "args": [
557
- {
558
- "channel": "tickers",
559
- "instId": inst_id,
560
- }
561
- ],
562
- }
522
+ subscription_message = self._build_subscription_message(
523
+ [
524
+ {
525
+ "channel": "tickers",
526
+ "instId": inst_id,
527
+ }
528
+ ]
563
529
  )
564
530
 
565
531
  return Websocket(
@@ -615,17 +581,13 @@ class WebsocketManager:
615
581
  Возвращает:
616
582
  `Websocket`: Объект для управления вебсокет соединением.
617
583
  """
618
- channel = f"candle{interval}"
619
- subscription_message = json.dumps(
620
- {
621
- "op": "subscribe",
622
- "args": [
623
- {
624
- "channel": channel,
625
- "instId": inst_id,
626
- }
627
- ],
628
- }
584
+ subscription_message = self._build_subscription_message(
585
+ [
586
+ {
587
+ "channel": f"candle{interval}",
588
+ "instId": inst_id,
589
+ }
590
+ ]
629
591
  )
630
592
 
631
593
  return Websocket(
@@ -651,16 +613,13 @@ class WebsocketManager:
651
613
  Возвращает:
652
614
  `Websocket`: Объект для управления вебсокет соединением.
653
615
  """
654
- subscription_message = json.dumps(
655
- {
656
- "op": "subscribe",
657
- "args": [
658
- {
659
- "channel": "trades",
660
- "instId": inst_id,
661
- }
662
- ],
663
- }
616
+ subscription_message = self._build_subscription_message(
617
+ [
618
+ {
619
+ "channel": "trades",
620
+ "instId": inst_id,
621
+ }
622
+ ]
664
623
  )
665
624
 
666
625
  return Websocket(
@@ -686,16 +645,13 @@ class WebsocketManager:
686
645
  Возвращает:
687
646
  `Websocket`: Объект для управления вебсокет соединением.
688
647
  """
689
- subscription_message = json.dumps(
690
- {
691
- "op": "subscribe",
692
- "args": [
693
- {
694
- "channel": "trades-all",
695
- "instId": inst_id,
696
- }
697
- ],
698
- }
648
+ subscription_message = self._build_subscription_message(
649
+ [
650
+ {
651
+ "channel": "trades-all",
652
+ "instId": inst_id,
653
+ }
654
+ ]
699
655
  )
700
656
 
701
657
  return Websocket(
@@ -723,16 +679,13 @@ class WebsocketManager:
723
679
  Возвращает:
724
680
  `Websocket`: Объект для управления вебсокет соединением.
725
681
  """
726
- subscription_message = json.dumps(
727
- {
728
- "op": "subscribe",
729
- "args": [
730
- {
731
- "channel": channel,
732
- "instId": inst_id,
733
- }
734
- ],
735
- }
682
+ subscription_message = self._build_subscription_message(
683
+ [
684
+ {
685
+ "channel": channel,
686
+ "instId": inst_id,
687
+ }
688
+ ]
736
689
  )
737
690
 
738
691
  return Websocket(
@@ -5,7 +5,6 @@ __all__ = [
5
5
  "TickerDailyItem",
6
6
  "KlineDict",
7
7
  "TradeDict",
8
- "AggTradeDict",
9
8
  "RequestMethod",
10
9
  "LoggerLike",
11
10
  "NumberLike",
@@ -105,12 +104,6 @@ class TradeDict(TypedDict):
105
104
  """Объем сделки. В монетах."""
106
105
 
107
106
 
108
- class AggTradeDict(TradeDict):
109
- """Модель агрегированной сделки."""
110
-
111
- pass
112
-
113
-
114
107
  class OpenInterestItem(TypedDict):
115
108
  """Модель одного элемента открытого интереса."""
116
109
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unicex
3
- Version: 0.16.0
3
+ Version: 0.16.2
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