unicex 0.13.7__py3-none-any.whl → 0.13.9__py3-none-any.whl
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/binance/uni_websocket_manager.py +3 -3
- unicex/bybit/client.py +14 -7
- {unicex-0.13.7.dist-info → unicex-0.13.9.dist-info}/METADATA +1 -1
- {unicex-0.13.7.dist-info → unicex-0.13.9.dist-info}/RECORD +7 -7
- {unicex-0.13.7.dist-info → unicex-0.13.9.dist-info}/WHEEL +0 -0
- {unicex-0.13.7.dist-info → unicex-0.13.9.dist-info}/licenses/LICENSE +0 -0
- {unicex-0.13.7.dist-info → unicex-0.13.9.dist-info}/top_level.txt +0 -0
|
@@ -5,7 +5,7 @@ from typing import Any
|
|
|
5
5
|
|
|
6
6
|
from unicex._abc import IUniWebsocketManager
|
|
7
7
|
from unicex._base import Websocket
|
|
8
|
-
from unicex.enums import Exchange, Timeframe
|
|
8
|
+
from unicex.enums import Exchange, MarketType, Timeframe
|
|
9
9
|
from unicex.types import LoggerLike
|
|
10
10
|
|
|
11
11
|
from .adapter import Adapter
|
|
@@ -57,7 +57,7 @@ class UniWebsocketManager(IUniWebsocketManager):
|
|
|
57
57
|
callback=wrapper,
|
|
58
58
|
symbol=symbol,
|
|
59
59
|
symbols=symbols,
|
|
60
|
-
interval=timeframe.to_exchange_format(Exchange.BINANCE),
|
|
60
|
+
interval=timeframe.to_exchange_format(Exchange.BINANCE, MarketType.SPOT),
|
|
61
61
|
)
|
|
62
62
|
|
|
63
63
|
def futures_klines(
|
|
@@ -85,7 +85,7 @@ class UniWebsocketManager(IUniWebsocketManager):
|
|
|
85
85
|
callback=wrapper,
|
|
86
86
|
symbol=symbol,
|
|
87
87
|
symbols=symbols,
|
|
88
|
-
interval=timeframe.to_exchange_format(Exchange.BINANCE),
|
|
88
|
+
interval=timeframe.to_exchange_format(Exchange.BINANCE, MarketType.FUTURES),
|
|
89
89
|
)
|
|
90
90
|
|
|
91
91
|
def trades(
|
unicex/bybit/client.py
CHANGED
|
@@ -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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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=
|
|
120
|
+
params=params,
|
|
114
121
|
headers=headers,
|
|
115
122
|
)
|
|
116
123
|
|
|
@@ -17,7 +17,7 @@ unicex/binance/adapter.py,sha256=JbUFyjnDAFtyuYYrh90YeOvQOZQ6faim0nWS6U0NxXw,879
|
|
|
17
17
|
unicex/binance/client.py,sha256=1qPx0uRT4prC6saLBQ55pXDWcWTCKhYEwVIysiihPgU,60984
|
|
18
18
|
unicex/binance/exchange_info.py,sha256=LNDkgBC5HB3JxtIBi39puqDg6LIVWqIWjT-6akDxtMs,2437
|
|
19
19
|
unicex/binance/uni_client.py,sha256=W4yxiU0kkJKPJjimhv4KAWreuEBwt7GgrWXefcw5BEA,8365
|
|
20
|
-
unicex/binance/uni_websocket_manager.py,sha256=
|
|
20
|
+
unicex/binance/uni_websocket_manager.py,sha256=HYHs6PYOTxBqN31AuOzbzs6o4oLBsZPMccqbjJiMu_4,8696
|
|
21
21
|
unicex/binance/user_websocket.py,sha256=HJ_3VZV0Bil0vfsdLrZElXm-gUqd8mGzXzfQ0_sHjFc,7861
|
|
22
22
|
unicex/binance/websocket_manager.py,sha256=Idrq0Qzi14QgpIG5d77S-r1h_BvRXphcxY2BT2IOQXA,45511
|
|
23
23
|
unicex/bitget/__init__.py,sha256=8govSOEyWjA62js-ZTQIiSYWSmcEUFSC9hVTpS8eosk,929
|
|
@@ -30,7 +30,7 @@ unicex/bitget/user_websocket.py,sha256=tlkv7Rmsw_FSfCJnEMOK_9jRsXRk2Ah_slqG8C-uh
|
|
|
30
30
|
unicex/bitget/websocket_manager.py,sha256=2OhH2gKy2gN03oYeCFvf3_l6RA29dDOvpajGhbXI9Zw,9886
|
|
31
31
|
unicex/bybit/__init__.py,sha256=SrMBh6K5zUt4JheWUpNUYNb1NCDr2ujTFv4IDguaGZI,926
|
|
32
32
|
unicex/bybit/adapter.py,sha256=U6QP2eGefZqfXq7H4P1G9M23HieAjmylb5FnrHISn5s,8147
|
|
33
|
-
unicex/bybit/client.py,sha256=
|
|
33
|
+
unicex/bybit/client.py,sha256=csOCEl1FhJLuCGd012TLgPvA83QDATDfx2Nu0gEQyx0,61539
|
|
34
34
|
unicex/bybit/exchange_info.py,sha256=6DySi-61kyU1Wpfp7G-5Zu7G1bFfcR4qo2oO5d0YutI,2200
|
|
35
35
|
unicex/bybit/uni_client.py,sha256=0wmIRRgofuJXWvZMB1gHwuIEfoWuPhLJXthmK1f9w40,8382
|
|
36
36
|
unicex/bybit/uni_websocket_manager.py,sha256=OpnvWD0xZ8T_By0HZCSg3jWoZqScRATAsku4IIBqhlw,10252
|
|
@@ -86,8 +86,8 @@ unicex/okx/uni_client.py,sha256=E_Wod0JSGt1K6k1mAIWnOv350pELbv-nic7g1KgOuos,8694
|
|
|
86
86
|
unicex/okx/uni_websocket_manager.py,sha256=b4f_QjA64DJmENQdIGb5IOVc7kvit7KMCdWeCmRbxGY,9326
|
|
87
87
|
unicex/okx/user_websocket.py,sha256=8c9kpm-xVa729pW93OKUGLHaE9MY0uzEpjIgNIFRF80,126
|
|
88
88
|
unicex/okx/websocket_manager.py,sha256=wROXTUDqKzOE-wDnCtXso_MC4SzfPuPols5aPg_Z3y4,26027
|
|
89
|
-
unicex-0.13.
|
|
90
|
-
unicex-0.13.
|
|
91
|
-
unicex-0.13.
|
|
92
|
-
unicex-0.13.
|
|
93
|
-
unicex-0.13.
|
|
89
|
+
unicex-0.13.9.dist-info/licenses/LICENSE,sha256=lNNK4Vqak9cXm6qVJLhbqS7iR_BMj6k7fd7XQ6l1k54,1507
|
|
90
|
+
unicex-0.13.9.dist-info/METADATA,sha256=8XqWJLJgeXSuVjvYjvBcRQSWED-P0U_2xQQ725aewwA,11752
|
|
91
|
+
unicex-0.13.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
92
|
+
unicex-0.13.9.dist-info/top_level.txt,sha256=_7rar-0OENIg4KRy6cgjWiebFYAJhjKEcMggAocGWG4,7
|
|
93
|
+
unicex-0.13.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|