unicex 0.16.5__tar.gz → 0.16.7__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.
- {unicex-0.16.5/unicex.egg-info → unicex-0.16.7}/PKG-INFO +1 -1
- {unicex-0.16.5 → unicex-0.16.7}/pyproject.toml +1 -1
- {unicex-0.16.5 → unicex-0.16.7}/unicex/_abc/uni_websocket_manager.py +15 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bybit/uni_websocket_manager.py +6 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/uni_websocket_manager.py +7 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/okx/uni_client.py +1 -1
- {unicex-0.16.5 → unicex-0.16.7/unicex.egg-info}/PKG-INFO +1 -1
- {unicex-0.16.5 → unicex-0.16.7}/LICENSE +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/README.md +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/setup.cfg +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/__init__.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/_abc/__init__.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/_abc/exchange_info.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/_abc/uni_client.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/_base/__init__.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/_base/client.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/_base/websocket.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/binance/__init__.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/binance/adapter.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/binance/client.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/binance/exchange_info.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/binance/uni_client.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/binance/uni_websocket_manager.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/binance/user_websocket.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/binance/websocket_manager.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bingx/__init__.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bingx/adapter.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bingx/client.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bingx/exchange_info.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bingx/uni_client.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bingx/uni_websocket_manager.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bingx/user_websocket.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bingx/websocket_manager.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bitget/__init__.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bitget/adapter.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bitget/client.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bitget/exchange_info.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bitget/uni_client.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bitget/uni_websocket_manager.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bitget/user_websocket.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bitget/websocket_manager.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bybit/__init__.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bybit/adapter.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bybit/client.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bybit/exchange_info.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bybit/uni_client.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bybit/user_websocket.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/bybit/websocket_manager.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/enums.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/exceptions.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/extra.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/gate/__init__.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/gate/adapter.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/gate/client.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/gate/exchange_info.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/gate/uni_client.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/gate/uni_websocket_manager.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/gate/user_websocket.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/gate/websocket_manager.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/hyperliquid/__init__.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/hyperliquid/adapter.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/hyperliquid/client.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/hyperliquid/exchange_info.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/hyperliquid/uni_client.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/hyperliquid/uni_websocket_manager.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/hyperliquid/user_websocket.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/hyperliquid/websocket_manager.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/kucoin/__init__.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/kucoin/adapter.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/kucoin/client.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/kucoin/exchange_info.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/kucoin/uni_client.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/kucoin/uni_websocket_manager.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/kucoin/user_websocket.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/kucoin/websocket_manager.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mapper.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/__init__.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/PrivateAccountV3Api_pb2.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/PrivateDealsV3Api_pb2.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/PrivateOrdersV3Api_pb2.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/PublicAggreBookTickerV3Api_pb2.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/PublicAggreDealsV3Api_pb2.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/PublicAggreDepthsV3Api_pb2.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/PublicBookTickerBatchV3Api_pb2.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/PublicBookTickerV3Api_pb2.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/PublicDealsV3Api_pb2.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/PublicFuture_pb2.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/PublicIncreaseDepthsBatchV3Api_pb2.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/PublicIncreaseDepthsV3Api_pb2.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/PublicLimitDepthsV3Api_pb2.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/PublicMiniTickerV3Api_pb2.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/PublicMiniTickersV3Api_pb2.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/PublicSpotKlineV3Api_pb2.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/PushDataV3ApiWrapper_pb2.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/__init__.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/adapter.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/client.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/exchange_info.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/uni_client.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/user_websocket.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/websocket_manager.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/okx/__init__.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/okx/adapter.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/okx/client.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/okx/exchange_info.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/okx/uni_websocket_manager.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/okx/user_websocket.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/okx/websocket_manager.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/types.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex/utils.py +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex.egg-info/SOURCES.txt +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex.egg-info/dependency_links.txt +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex.egg-info/requires.txt +0 -0
- {unicex-0.16.5 → unicex-0.16.7}/unicex.egg-info/top_level.txt +0 -0
|
@@ -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.
|
|
7
|
+
version = "0.16.7"
|
|
8
8
|
|
|
9
9
|
description = "Unified Crypto Exchange API "
|
|
10
10
|
readme = "README.md"
|
|
@@ -8,6 +8,7 @@ from loguru import logger as _logger
|
|
|
8
8
|
|
|
9
9
|
from unicex._base import BaseClient, Websocket
|
|
10
10
|
from unicex.enums import Timeframe
|
|
11
|
+
from unicex.exceptions import AdapterError
|
|
11
12
|
from unicex.types import LoggerLike
|
|
12
13
|
|
|
13
14
|
from .uni_client import IUniClient
|
|
@@ -41,6 +42,13 @@ class IUniWebsocketManager(ABC):
|
|
|
41
42
|
try:
|
|
42
43
|
adapted = adapter_func(raw_msg)
|
|
43
44
|
except Exception as e:
|
|
45
|
+
if isinstance(e, AdapterError):
|
|
46
|
+
try:
|
|
47
|
+
if self._is_service_message(raw_msg):
|
|
48
|
+
return
|
|
49
|
+
except Exception as err:
|
|
50
|
+
self._logger.error(f"Failed to handle adapter error: {e}")
|
|
51
|
+
raise err from e
|
|
44
52
|
self._logger.warning(f"Failed to adapt message: {e}")
|
|
45
53
|
return
|
|
46
54
|
if isinstance(adapted, list):
|
|
@@ -51,6 +59,13 @@ class IUniWebsocketManager(ABC):
|
|
|
51
59
|
|
|
52
60
|
return _wrapper
|
|
53
61
|
|
|
62
|
+
def _is_service_message(self, raw_msg: Any) -> bool:
|
|
63
|
+
"""Дополнительно обрабатывает ошибку адаптации сообщения на случай, если это сервисное сообщение, например `ping` или `subscribe`.
|
|
64
|
+
|
|
65
|
+
Переопределяется в каждом наследнике в связи с разным форматом входящих данных.
|
|
66
|
+
"""
|
|
67
|
+
return False
|
|
68
|
+
|
|
54
69
|
@overload
|
|
55
70
|
def klines(
|
|
56
71
|
self,
|
|
@@ -36,6 +36,12 @@ class UniWebsocketManager(IUniWebsocketManager):
|
|
|
36
36
|
self._websocket_manager = WebsocketManager(self._client, **ws_kwargs) # type: ignore
|
|
37
37
|
self._adapter = Adapter()
|
|
38
38
|
|
|
39
|
+
def _is_service_message(self, raw_msg: Any) -> bool:
|
|
40
|
+
"""Дополнительно обрабатывает ошибку адаптации сообщения с вебсокета Bybit."""
|
|
41
|
+
if raw_msg.get("op") == "subscribe":
|
|
42
|
+
return True
|
|
43
|
+
return False
|
|
44
|
+
|
|
39
45
|
@overload
|
|
40
46
|
def klines(
|
|
41
47
|
self,
|
|
@@ -36,6 +36,13 @@ class UniWebsocketManager(IUniWebsocketManager):
|
|
|
36
36
|
self._websocket_manager = WebsocketManager(self._client, **ws_kwargs) # type: ignore
|
|
37
37
|
self._adapter = Adapter()
|
|
38
38
|
|
|
39
|
+
def _is_service_message(self, raw_msg: Any) -> bool:
|
|
40
|
+
"""Дополнительно обрабатывает ошибку адаптации сообщения на случай, если это сервисное сообщение, например `ping` или `subscribe`.
|
|
41
|
+
|
|
42
|
+
Переопределяется в каждом наследнике в связи с разным форматом входящих данных.
|
|
43
|
+
"""
|
|
44
|
+
return raw_msg.get("msg") == "PONG"
|
|
45
|
+
|
|
39
46
|
@overload
|
|
40
47
|
def klines(
|
|
41
48
|
self,
|
|
@@ -173,7 +173,7 @@ class UniClient(IUniClient[Client]):
|
|
|
173
173
|
raise ValueError("Symbol is required to okx funding rate")
|
|
174
174
|
raw_data = await self._client.get_funding_rate(inst_id=symbol)
|
|
175
175
|
adapted_data = Adapter.funding_rate(raw_data)
|
|
176
|
-
return adapted_data
|
|
176
|
+
return adapted_data[symbol]
|
|
177
177
|
|
|
178
178
|
@overload
|
|
179
179
|
async def open_interest(self, symbol: str) -> OpenInterestItem: ...
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/PublicAggreBookTickerV3Api_pb2.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/PublicBookTickerBatchV3Api_pb2.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{unicex-0.16.5 → unicex-0.16.7}/unicex/mexc/_spot_ws_proto/PublicIncreaseDepthsBatchV3Api_pb2.py
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|