unicex 0.14.1__tar.gz → 0.14.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 (107) hide show
  1. {unicex-0.14.1/unicex.egg-info → unicex-0.14.2}/PKG-INFO +1 -1
  2. {unicex-0.14.1 → unicex-0.14.2}/pyproject.toml +1 -1
  3. {unicex-0.14.1 → unicex-0.14.2}/unicex/kucoin/adapter.py +11 -1
  4. {unicex-0.14.1 → unicex-0.14.2}/unicex/kucoin/client.py +21 -5
  5. unicex-0.14.2/unicex/kucoin/exchange_info.py +47 -0
  6. {unicex-0.14.1 → unicex-0.14.2}/unicex/okx/adapter.py +0 -10
  7. {unicex-0.14.1 → unicex-0.14.2/unicex.egg-info}/PKG-INFO +1 -1
  8. unicex-0.14.1/unicex/kucoin/exchange_info.py +0 -22
  9. {unicex-0.14.1 → unicex-0.14.2}/LICENSE +0 -0
  10. {unicex-0.14.1 → unicex-0.14.2}/README.md +0 -0
  11. {unicex-0.14.1 → unicex-0.14.2}/setup.cfg +0 -0
  12. {unicex-0.14.1 → unicex-0.14.2}/unicex/__init__.py +0 -0
  13. {unicex-0.14.1 → unicex-0.14.2}/unicex/_abc/__init__.py +0 -0
  14. {unicex-0.14.1 → unicex-0.14.2}/unicex/_abc/exchange_info.py +0 -0
  15. {unicex-0.14.1 → unicex-0.14.2}/unicex/_abc/uni_client.py +0 -0
  16. {unicex-0.14.1 → unicex-0.14.2}/unicex/_abc/uni_websocket_manager.py +0 -0
  17. {unicex-0.14.1 → unicex-0.14.2}/unicex/_base/__init__.py +0 -0
  18. {unicex-0.14.1 → unicex-0.14.2}/unicex/_base/client.py +0 -0
  19. {unicex-0.14.1 → unicex-0.14.2}/unicex/_base/websocket.py +0 -0
  20. {unicex-0.14.1 → unicex-0.14.2}/unicex/binance/__init__.py +0 -0
  21. {unicex-0.14.1 → unicex-0.14.2}/unicex/binance/adapter.py +0 -0
  22. {unicex-0.14.1 → unicex-0.14.2}/unicex/binance/client.py +0 -0
  23. {unicex-0.14.1 → unicex-0.14.2}/unicex/binance/exchange_info.py +0 -0
  24. {unicex-0.14.1 → unicex-0.14.2}/unicex/binance/uni_client.py +0 -0
  25. {unicex-0.14.1 → unicex-0.14.2}/unicex/binance/uni_websocket_manager.py +0 -0
  26. {unicex-0.14.1 → unicex-0.14.2}/unicex/binance/user_websocket.py +0 -0
  27. {unicex-0.14.1 → unicex-0.14.2}/unicex/binance/websocket_manager.py +0 -0
  28. {unicex-0.14.1 → unicex-0.14.2}/unicex/bitget/__init__.py +0 -0
  29. {unicex-0.14.1 → unicex-0.14.2}/unicex/bitget/adapter.py +0 -0
  30. {unicex-0.14.1 → unicex-0.14.2}/unicex/bitget/client.py +0 -0
  31. {unicex-0.14.1 → unicex-0.14.2}/unicex/bitget/exchange_info.py +0 -0
  32. {unicex-0.14.1 → unicex-0.14.2}/unicex/bitget/uni_client.py +0 -0
  33. {unicex-0.14.1 → unicex-0.14.2}/unicex/bitget/uni_websocket_manager.py +0 -0
  34. {unicex-0.14.1 → unicex-0.14.2}/unicex/bitget/user_websocket.py +0 -0
  35. {unicex-0.14.1 → unicex-0.14.2}/unicex/bitget/websocket_manager.py +0 -0
  36. {unicex-0.14.1 → unicex-0.14.2}/unicex/bybit/__init__.py +0 -0
  37. {unicex-0.14.1 → unicex-0.14.2}/unicex/bybit/adapter.py +0 -0
  38. {unicex-0.14.1 → unicex-0.14.2}/unicex/bybit/client.py +0 -0
  39. {unicex-0.14.1 → unicex-0.14.2}/unicex/bybit/exchange_info.py +0 -0
  40. {unicex-0.14.1 → unicex-0.14.2}/unicex/bybit/uni_client.py +0 -0
  41. {unicex-0.14.1 → unicex-0.14.2}/unicex/bybit/uni_websocket_manager.py +0 -0
  42. {unicex-0.14.1 → unicex-0.14.2}/unicex/bybit/user_websocket.py +0 -0
  43. {unicex-0.14.1 → unicex-0.14.2}/unicex/bybit/websocket_manager.py +0 -0
  44. {unicex-0.14.1 → unicex-0.14.2}/unicex/enums.py +0 -0
  45. {unicex-0.14.1 → unicex-0.14.2}/unicex/exceptions.py +0 -0
  46. {unicex-0.14.1 → unicex-0.14.2}/unicex/extra.py +0 -0
  47. {unicex-0.14.1 → unicex-0.14.2}/unicex/gate/__init__.py +0 -0
  48. {unicex-0.14.1 → unicex-0.14.2}/unicex/gate/adapter.py +0 -0
  49. {unicex-0.14.1 → unicex-0.14.2}/unicex/gate/client.py +0 -0
  50. {unicex-0.14.1 → unicex-0.14.2}/unicex/gate/exchange_info.py +0 -0
  51. {unicex-0.14.1 → unicex-0.14.2}/unicex/gate/uni_client.py +0 -0
  52. {unicex-0.14.1 → unicex-0.14.2}/unicex/gate/uni_websocket_manager.py +0 -0
  53. {unicex-0.14.1 → unicex-0.14.2}/unicex/gate/user_websocket.py +0 -0
  54. {unicex-0.14.1 → unicex-0.14.2}/unicex/gate/websocket_manager.py +0 -0
  55. {unicex-0.14.1 → unicex-0.14.2}/unicex/hyperliquid/__init__.py +0 -0
  56. {unicex-0.14.1 → unicex-0.14.2}/unicex/hyperliquid/adapter.py +0 -0
  57. {unicex-0.14.1 → unicex-0.14.2}/unicex/hyperliquid/client.py +0 -0
  58. {unicex-0.14.1 → unicex-0.14.2}/unicex/hyperliquid/exchange_info.py +0 -0
  59. {unicex-0.14.1 → unicex-0.14.2}/unicex/hyperliquid/uni_client.py +0 -0
  60. {unicex-0.14.1 → unicex-0.14.2}/unicex/hyperliquid/uni_websocket_manager.py +0 -0
  61. {unicex-0.14.1 → unicex-0.14.2}/unicex/hyperliquid/user_websocket.py +0 -0
  62. {unicex-0.14.1 → unicex-0.14.2}/unicex/hyperliquid/websocket_manager.py +0 -0
  63. {unicex-0.14.1 → unicex-0.14.2}/unicex/kucoin/__init__.py +0 -0
  64. {unicex-0.14.1 → unicex-0.14.2}/unicex/kucoin/uni_client.py +0 -0
  65. {unicex-0.14.1 → unicex-0.14.2}/unicex/kucoin/uni_websocket_manager.py +0 -0
  66. {unicex-0.14.1 → unicex-0.14.2}/unicex/kucoin/user_websocket.py +0 -0
  67. {unicex-0.14.1 → unicex-0.14.2}/unicex/kucoin/websocket_manager.py +0 -0
  68. {unicex-0.14.1 → unicex-0.14.2}/unicex/mapper.py +0 -0
  69. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/__init__.py +0 -0
  70. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/_spot_ws_proto/PrivateAccountV3Api_pb2.py +0 -0
  71. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/_spot_ws_proto/PrivateDealsV3Api_pb2.py +0 -0
  72. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/_spot_ws_proto/PrivateOrdersV3Api_pb2.py +0 -0
  73. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/_spot_ws_proto/PublicAggreBookTickerV3Api_pb2.py +0 -0
  74. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/_spot_ws_proto/PublicAggreDealsV3Api_pb2.py +0 -0
  75. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/_spot_ws_proto/PublicAggreDepthsV3Api_pb2.py +0 -0
  76. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/_spot_ws_proto/PublicBookTickerBatchV3Api_pb2.py +0 -0
  77. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/_spot_ws_proto/PublicBookTickerV3Api_pb2.py +0 -0
  78. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/_spot_ws_proto/PublicDealsV3Api_pb2.py +0 -0
  79. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/_spot_ws_proto/PublicFuture_pb2.py +0 -0
  80. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/_spot_ws_proto/PublicIncreaseDepthsBatchV3Api_pb2.py +0 -0
  81. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/_spot_ws_proto/PublicIncreaseDepthsV3Api_pb2.py +0 -0
  82. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/_spot_ws_proto/PublicLimitDepthsV3Api_pb2.py +0 -0
  83. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/_spot_ws_proto/PublicMiniTickerV3Api_pb2.py +0 -0
  84. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/_spot_ws_proto/PublicMiniTickersV3Api_pb2.py +0 -0
  85. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/_spot_ws_proto/PublicSpotKlineV3Api_pb2.py +0 -0
  86. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/_spot_ws_proto/PushDataV3ApiWrapper_pb2.py +0 -0
  87. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/_spot_ws_proto/__init__.py +0 -0
  88. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/adapter.py +0 -0
  89. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/client.py +0 -0
  90. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/exchange_info.py +0 -0
  91. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/uni_client.py +0 -0
  92. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/uni_websocket_manager.py +0 -0
  93. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/user_websocket.py +0 -0
  94. {unicex-0.14.1 → unicex-0.14.2}/unicex/mexc/websocket_manager.py +0 -0
  95. {unicex-0.14.1 → unicex-0.14.2}/unicex/okx/__init__.py +0 -0
  96. {unicex-0.14.1 → unicex-0.14.2}/unicex/okx/client.py +0 -0
  97. {unicex-0.14.1 → unicex-0.14.2}/unicex/okx/exchange_info.py +0 -0
  98. {unicex-0.14.1 → unicex-0.14.2}/unicex/okx/uni_client.py +0 -0
  99. {unicex-0.14.1 → unicex-0.14.2}/unicex/okx/uni_websocket_manager.py +0 -0
  100. {unicex-0.14.1 → unicex-0.14.2}/unicex/okx/user_websocket.py +0 -0
  101. {unicex-0.14.1 → unicex-0.14.2}/unicex/okx/websocket_manager.py +0 -0
  102. {unicex-0.14.1 → unicex-0.14.2}/unicex/types.py +0 -0
  103. {unicex-0.14.1 → unicex-0.14.2}/unicex/utils.py +0 -0
  104. {unicex-0.14.1 → unicex-0.14.2}/unicex.egg-info/SOURCES.txt +0 -0
  105. {unicex-0.14.1 → unicex-0.14.2}/unicex.egg-info/dependency_links.txt +0 -0
  106. {unicex-0.14.1 → unicex-0.14.2}/unicex.egg-info/requires.txt +0 -0
  107. {unicex-0.14.1 → unicex-0.14.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.14.1
3
+ Version: 0.14.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.14.1"
7
+ version = "0.14.2"
8
8
 
9
9
  description = "Unified Crypto Exchange API "
10
10
  readme = "README.md"
@@ -5,6 +5,8 @@ from typing import Any
5
5
  from unicex.types import OpenInterestDict, OpenInterestItem, TickerDailyDict, TickerDailyItem
6
6
  from unicex.utils import catch_adapter_errors, decorate_all_methods
7
7
 
8
+ from .exchange_info import ExchangeInfo
9
+
8
10
 
9
11
  @decorate_all_methods(catch_adapter_errors)
10
12
  class Adapter:
@@ -75,7 +77,15 @@ class Adapter:
75
77
  return {
76
78
  item["symbol"]: OpenInterestItem(
77
79
  t=item["ts"],
78
- v=float(item["openInterest"]),
80
+ v=float(item["openInterest"]) * Adapter._get_contract_size(item["symbol"]),
79
81
  )
80
82
  for item in raw_data["data"]
81
83
  }
84
+
85
+ @staticmethod
86
+ def _get_contract_size(symbol: str) -> float:
87
+ """Возвращает размер контракта для указанного символа тикера."""
88
+ try:
89
+ return ExchangeInfo.get_futures_ticker_info(symbol)["contract_size"] or 1
90
+ except: # noqa
91
+ return 1
@@ -12,14 +12,21 @@ class Client(BaseClient):
12
12
  _BASE_URL: str = "https://api.kucoin.com"
13
13
  """Базовый URL для запросов."""
14
14
 
15
- async def open_interest(self) -> dict[str, Any]:
16
- """Получение открытого интереса.
15
+ async def symbol(
16
+ self,
17
+ trade_type: Literal["SPOT", "FUTURES", "ISOLATED", "CROSS"],
18
+ symbol: str | None = None,
19
+ ) -> dict[str, Any]:
20
+ """Получение символов и информации о них.
17
21
 
18
- https://www.kucoin.com/docs-new/3476287e0
22
+ https://www.kucoin.com/docs-new/rest/ua/get-symbol
19
23
  """
20
- url = self._BASE_URL + "/api/ua/v1/market/open-interest"
24
+ url = self._BASE_URL + "/api/ua/v1/market/instrument"
25
+ params = {"tradeType": trade_type}
26
+ if symbol:
27
+ params["symbol"] = symbol
21
28
 
22
- return await self._make_request("GET", url)
29
+ return await self._make_request("GET", url, params=params)
23
30
 
24
31
  async def ticker(
25
32
  self,
@@ -36,3 +43,12 @@ class Client(BaseClient):
36
43
  params["symbol"] = symbol
37
44
 
38
45
  return await self._make_request("GET", url, params=params)
46
+
47
+ async def open_interest(self) -> dict[str, Any]:
48
+ """Получение открытого интереса.
49
+
50
+ https://www.kucoin.com/docs-new/3476287e0
51
+ """
52
+ url = self._BASE_URL + "/api/ua/v1/market/open-interest"
53
+
54
+ return await self._make_request("GET", url)
@@ -0,0 +1,47 @@
1
+ __all__ = ["ExchangeInfo"]
2
+
3
+ import aiohttp
4
+
5
+ from unicex._abc import IExchangeInfo
6
+ from unicex.types import TickerInfoItem
7
+
8
+ from .client import Client
9
+
10
+
11
+ class ExchangeInfo(IExchangeInfo):
12
+ """Предзагружает информацию о тикерах для биржи Kucoin."""
13
+
14
+ exchange_name = "Kucoin"
15
+ """Название биржи, на которой работает класс."""
16
+
17
+ @classmethod
18
+ async def _load_spot_exchange_info(cls, session: aiohttp.ClientSession) -> None:
19
+ """Загружает информацию о бирже для спотового рынка."""
20
+ tickers_info = {}
21
+ exchange_info = await Client(session).symbol("SPOT")
22
+ for el in exchange_info["data"]["list"]:
23
+ tickers_info[el["symbol"]] = TickerInfoItem(
24
+ tick_precision=None,
25
+ tick_step=None,
26
+ size_precision=None,
27
+ size_step=None,
28
+ contract_size=1,
29
+ )
30
+
31
+ cls._tickers_info = tickers_info
32
+
33
+ @classmethod
34
+ async def _load_futures_exchange_info(cls, session: aiohttp.ClientSession) -> None:
35
+ """Загружает информацию о бирже для фьючерсного рынка."""
36
+ tickers_info = {}
37
+ exchange_info = await Client(session).symbol("FUTURES")
38
+ for el in exchange_info["data"]["list"]:
39
+ tickers_info[el["symbol"]] = TickerInfoItem(
40
+ tick_precision=None,
41
+ tick_step=None,
42
+ size_precision=None,
43
+ size_step=None,
44
+ contract_size=float(el["unitSize"]),
45
+ )
46
+
47
+ cls._futures_tickers_info = tickers_info
@@ -10,8 +10,6 @@ from unicex.types import (
10
10
  )
11
11
  from unicex.utils import catch_adapter_errors, decorate_all_methods
12
12
 
13
- from .exchange_info import ExchangeInfo
14
-
15
13
 
16
14
  @decorate_all_methods(catch_adapter_errors)
17
15
  class Adapter:
@@ -140,11 +138,3 @@ class Adapter:
140
138
  )
141
139
  for item in raw_data["data"]
142
140
  }
143
-
144
- @staticmethod
145
- def _get_contract_size(symbol: str) -> float:
146
- """Возвращает размер контракта для указанного символа тикера."""
147
- try:
148
- return ExchangeInfo.get_futures_ticker_info(symbol)["contract_size"] or 1
149
- except: # noqa
150
- return 1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unicex
3
- Version: 0.14.1
3
+ Version: 0.14.2
4
4
  Summary: Unified Crypto Exchange API
5
5
  Author-email: LoveBloodAndDiamonds <ayazshakirzyanov27@gmail.com>
6
6
  License: BSD 3-Clause License
@@ -1,22 +0,0 @@
1
- __all__ = ["ExchangeInfo"]
2
-
3
- import aiohttp
4
-
5
- from unicex._abc import IExchangeInfo
6
-
7
-
8
- class ExchangeInfo(IExchangeInfo):
9
- """Предзагружает информацию о тикерах для биржи Kucoin."""
10
-
11
- exchange_name = "Kucoin"
12
- """Название биржи, на которой работает класс."""
13
-
14
- @classmethod
15
- async def _load_spot_exchange_info(cls, session: aiohttp.ClientSession) -> None:
16
- """Загружает информацию о бирже для спотового рынка."""
17
- ...
18
-
19
- @classmethod
20
- async def _load_futures_exchange_info(cls, session: aiohttp.ClientSession) -> None:
21
- """Загружает информацию о бирже для фьючерсного рынка."""
22
- ...
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