unicex 0.13.9__py3-none-any.whl → 0.13.10__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/client.py +19 -10
- {unicex-0.13.9.dist-info → unicex-0.13.10.dist-info}/METADATA +1 -1
- {unicex-0.13.9.dist-info → unicex-0.13.10.dist-info}/RECORD +6 -6
- {unicex-0.13.9.dist-info → unicex-0.13.10.dist-info}/WHEEL +0 -0
- {unicex-0.13.9.dist-info → unicex-0.13.10.dist-info}/licenses/LICENSE +0 -0
- {unicex-0.13.9.dist-info → unicex-0.13.10.dist-info}/top_level.txt +0 -0
unicex/binance/client.py
CHANGED
|
@@ -23,16 +23,19 @@ class Client(BaseClient):
|
|
|
23
23
|
_RECV_WINDOW: int = 5000
|
|
24
24
|
"""Стандартный интервал времени для получения ответа от сервера."""
|
|
25
25
|
|
|
26
|
-
def _get_headers(self) -> dict:
|
|
26
|
+
def _get_headers(self, method: RequestMethod) -> dict:
|
|
27
27
|
"""Возвращает заголовки для запросов к Binance API."""
|
|
28
28
|
headers = {"Accept": "application/json"}
|
|
29
29
|
if self._api_key: # type: ignore[attr-defined]
|
|
30
30
|
headers["X-MBX-APIKEY"] = self._api_key # type: ignore[attr-defined]
|
|
31
|
+
if method in ["POST", "PUT", "DELETE"]:
|
|
32
|
+
headers.update({"Content-Type": "application/x-www-form-urlencoded"})
|
|
31
33
|
return headers
|
|
32
34
|
|
|
33
35
|
def _prepare_payload(
|
|
34
36
|
self,
|
|
35
37
|
*,
|
|
38
|
+
method: RequestMethod,
|
|
36
39
|
signed: bool,
|
|
37
40
|
params: dict[str, Any] | None,
|
|
38
41
|
data: dict[str, Any] | None,
|
|
@@ -46,6 +49,7 @@ class Client(BaseClient):
|
|
|
46
49
|
- возвращает только отфильтрованные params/data.
|
|
47
50
|
|
|
48
51
|
Параметры:
|
|
52
|
+
method (`RequestMethod`): Метод запроса.
|
|
49
53
|
signed (`bool`): Нужно ли подписывать запрос.
|
|
50
54
|
params (`dict | None`): Параметры для query string.
|
|
51
55
|
data (`dict | None`): Параметры для тела запроса.
|
|
@@ -78,7 +82,7 @@ class Client(BaseClient):
|
|
|
78
82
|
"hex",
|
|
79
83
|
)
|
|
80
84
|
|
|
81
|
-
headers = self._get_headers()
|
|
85
|
+
headers = self._get_headers(method)
|
|
82
86
|
return payload, headers
|
|
83
87
|
|
|
84
88
|
async def _make_request(
|
|
@@ -108,7 +112,9 @@ class Client(BaseClient):
|
|
|
108
112
|
Возвращает:
|
|
109
113
|
`dict`: Ответ в формате JSON.
|
|
110
114
|
"""
|
|
111
|
-
payload, headers = self._prepare_payload(
|
|
115
|
+
payload, headers = self._prepare_payload(
|
|
116
|
+
method=method, signed=signed, params=params, data=data
|
|
117
|
+
)
|
|
112
118
|
|
|
113
119
|
if not signed:
|
|
114
120
|
return await super()._make_request(method=method, url=url, **payload)
|
|
@@ -400,7 +406,8 @@ class Client(BaseClient):
|
|
|
400
406
|
"selfTradePreventionMode": self_trade_prevention_mode,
|
|
401
407
|
}
|
|
402
408
|
|
|
403
|
-
return await self._make_request("POST", url, True, data=data)
|
|
409
|
+
# return await self._make_request("POST", url, True, data=data)
|
|
410
|
+
return await self._make_request("POST", url, True, params=data)
|
|
404
411
|
|
|
405
412
|
async def order_test(
|
|
406
413
|
self,
|
|
@@ -1486,7 +1493,7 @@ class Client(BaseClient):
|
|
|
1486
1493
|
)
|
|
1487
1494
|
url = self._BASE_SPOT_URL + "/api/v3/userDataStream"
|
|
1488
1495
|
|
|
1489
|
-
return await super()._make_request("POST", url, headers=self._get_headers())
|
|
1496
|
+
return await super()._make_request("POST", url, headers=self._get_headers("POST"))
|
|
1490
1497
|
|
|
1491
1498
|
async def renew_listen_key(self, listen_key: str) -> dict:
|
|
1492
1499
|
"""Обновление ключа прослушивания для подключения к пользовательскому вебсокету.
|
|
@@ -1501,7 +1508,9 @@ class Client(BaseClient):
|
|
|
1501
1508
|
url = self._BASE_SPOT_URL + "/api/v3/userDataStream"
|
|
1502
1509
|
params = {"listenKey": listen_key}
|
|
1503
1510
|
|
|
1504
|
-
return await super()._make_request(
|
|
1511
|
+
return await super()._make_request(
|
|
1512
|
+
"PUT", url, params=params, headers=self._get_headers("PUT")
|
|
1513
|
+
)
|
|
1505
1514
|
|
|
1506
1515
|
async def close_listen_key(self, listen_key: str) -> dict:
|
|
1507
1516
|
"""Закрытие ключа прослушивания для подключения к пользовательскому вебсокету.
|
|
@@ -1517,7 +1526,7 @@ class Client(BaseClient):
|
|
|
1517
1526
|
params = {"listenKey": listen_key}
|
|
1518
1527
|
|
|
1519
1528
|
return await super()._make_request(
|
|
1520
|
-
"DELETE", url, params=params, headers=self._get_headers()
|
|
1529
|
+
"DELETE", url, params=params, headers=self._get_headers("DELETE")
|
|
1521
1530
|
)
|
|
1522
1531
|
|
|
1523
1532
|
# topic: futures user data streams
|
|
@@ -1529,7 +1538,7 @@ class Client(BaseClient):
|
|
|
1529
1538
|
"""
|
|
1530
1539
|
url = self._BASE_FUTURES_URL + "/fapi/v1/listenKey"
|
|
1531
1540
|
|
|
1532
|
-
return await super()._make_request("POST", url, headers=self._get_headers())
|
|
1541
|
+
return await super()._make_request("POST", url, headers=self._get_headers("POST"))
|
|
1533
1542
|
|
|
1534
1543
|
async def futures_renew_listen_key(self) -> dict:
|
|
1535
1544
|
"""Обновление ключа прослушивания для подключения к пользовательскому вебсокету.
|
|
@@ -1538,7 +1547,7 @@ class Client(BaseClient):
|
|
|
1538
1547
|
"""
|
|
1539
1548
|
url = self._BASE_FUTURES_URL + "/fapi/v1/listenKey"
|
|
1540
1549
|
|
|
1541
|
-
return await super()._make_request("PUT", url, headers=self._get_headers())
|
|
1550
|
+
return await super()._make_request("PUT", url, headers=self._get_headers("PUT"))
|
|
1542
1551
|
|
|
1543
1552
|
async def futures_close_listen_key(self) -> dict:
|
|
1544
1553
|
"""Закрытие ключа прослушивания для подключения к пользовательскому вебсокету.
|
|
@@ -1547,4 +1556,4 @@ class Client(BaseClient):
|
|
|
1547
1556
|
"""
|
|
1548
1557
|
url = self._BASE_FUTURES_URL + "/fapi/v1/listenKey"
|
|
1549
1558
|
|
|
1550
|
-
return await super()._make_request("DELETE", url, headers=self._get_headers())
|
|
1559
|
+
return await super()._make_request("DELETE", url, headers=self._get_headers("DELETE"))
|
|
@@ -14,7 +14,7 @@ unicex/_base/client.py,sha256=asIIQLZlRwwmUDvxveSv7aCvth54iiSRJdz19bxGorI,8904
|
|
|
14
14
|
unicex/_base/websocket.py,sha256=haSV3dSgkT352n8knpLm_iI4ZlUGWWKFCB3k5Ua2esU,12542
|
|
15
15
|
unicex/binance/__init__.py,sha256=sDk4ZjakRdpFMaMSpOCfqjf6ZPfAS9tlrt4WlDHtDkw,932
|
|
16
16
|
unicex/binance/adapter.py,sha256=JbUFyjnDAFtyuYYrh90YeOvQOZQ6faim0nWS6U0NxXw,8799
|
|
17
|
-
unicex/binance/client.py,sha256=
|
|
17
|
+
unicex/binance/client.py,sha256=MBTqIghKbSCr0DZ0aL_XZPyrIhLV3fMHERB7mbIk2Ks,61410
|
|
18
18
|
unicex/binance/exchange_info.py,sha256=LNDkgBC5HB3JxtIBi39puqDg6LIVWqIWjT-6akDxtMs,2437
|
|
19
19
|
unicex/binance/uni_client.py,sha256=W4yxiU0kkJKPJjimhv4KAWreuEBwt7GgrWXefcw5BEA,8365
|
|
20
20
|
unicex/binance/uni_websocket_manager.py,sha256=HYHs6PYOTxBqN31AuOzbzs6o4oLBsZPMccqbjJiMu_4,8696
|
|
@@ -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.10.dist-info/licenses/LICENSE,sha256=lNNK4Vqak9cXm6qVJLhbqS7iR_BMj6k7fd7XQ6l1k54,1507
|
|
90
|
+
unicex-0.13.10.dist-info/METADATA,sha256=BJmp2kdi-Jf54wKGBjPxov_LPmkryBjm7LT8rCj7NkY,11753
|
|
91
|
+
unicex-0.13.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
92
|
+
unicex-0.13.10.dist-info/top_level.txt,sha256=_7rar-0OENIg4KRy6cgjWiebFYAJhjKEcMggAocGWG4,7
|
|
93
|
+
unicex-0.13.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|