hyperquant 0.77__py3-none-any.whl → 0.79__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.
hyperquant/broker/bitget.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import asyncio
|
|
3
4
|
import logging
|
|
5
|
+
import uuid
|
|
4
6
|
from typing import Any, Literal
|
|
5
7
|
|
|
6
8
|
import pybotters
|
|
@@ -31,7 +33,9 @@ class Bitget:
|
|
|
31
33
|
self.ws_url = ws_url or "wss://ws.bitget.com/v2/ws/public"
|
|
32
34
|
self.ws_url_private = ws_url or "wss://ws.bitget.com/v2/ws/private"
|
|
33
35
|
|
|
34
|
-
self.
|
|
36
|
+
self.ws_app = None
|
|
37
|
+
self.has_sub_personal = False
|
|
38
|
+
|
|
35
39
|
|
|
36
40
|
async def __aenter__(self) -> "Bitget":
|
|
37
41
|
await self.update("detail")
|
|
@@ -53,11 +57,13 @@ class Bitget:
|
|
|
53
57
|
{"instType": "USDT-FUTURES", "channel": "account", "coin": "default"},
|
|
54
58
|
],
|
|
55
59
|
}
|
|
56
|
-
self.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
self.ws_app = await self._ensure_private_ws()
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
await self.ws_app.current_ws.send_json(sub_msg)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
self.has_sub_personal = True
|
|
61
67
|
|
|
62
68
|
async def update(
|
|
63
69
|
self,
|
|
@@ -108,13 +114,17 @@ class Bitget:
|
|
|
108
114
|
margin_coin: str = "USDT",
|
|
109
115
|
reduce_only: bool | None = None,
|
|
110
116
|
offset_flag: Literal["open", "close", "0", "1"] | None = None,
|
|
111
|
-
client_order_id: str | None = None
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
117
|
+
client_order_id: str | None = None
|
|
118
|
+
) -> dict[str, Any] | None:
|
|
119
|
+
"""
|
|
120
|
+
请求成功返回示例:
|
|
121
|
+
|
|
122
|
+
.. code:: json
|
|
115
123
|
|
|
116
|
-
|
|
117
|
-
|
|
124
|
+
{
|
|
125
|
+
"clientOid": "121211212122",
|
|
126
|
+
"orderId": "121211212122"
|
|
127
|
+
}
|
|
118
128
|
"""
|
|
119
129
|
|
|
120
130
|
side = self._normalize_direction(direction)
|
|
@@ -159,9 +169,6 @@ class Bitget:
|
|
|
159
169
|
if client_order_id:
|
|
160
170
|
payload["clientOid"] = client_order_id
|
|
161
171
|
|
|
162
|
-
if extra_params:
|
|
163
|
-
payload.update(extra_params)
|
|
164
|
-
|
|
165
172
|
res = await self.client.post(
|
|
166
173
|
f"{self.rest_api}/api/v2/mix/order/place-order",
|
|
167
174
|
data=payload,
|
|
@@ -195,7 +202,7 @@ class Bitget:
|
|
|
195
202
|
|
|
196
203
|
res = await self.client.post(
|
|
197
204
|
f"{self.rest_api}/api/v2/mix/order/cancel-order",
|
|
198
|
-
|
|
205
|
+
data=payload,
|
|
199
206
|
)
|
|
200
207
|
data = await res.json()
|
|
201
208
|
return self._ensure_ok("cancel_order", data)
|
|
@@ -223,6 +230,19 @@ class Bitget:
|
|
|
223
230
|
)
|
|
224
231
|
return detail
|
|
225
232
|
|
|
233
|
+
async def _ensure_private_ws(self):
|
|
234
|
+
wsqueue = pybotters.WebSocketQueue()
|
|
235
|
+
ws_app = self.client.ws_connect(
|
|
236
|
+
self.ws_url_private,
|
|
237
|
+
hdlr_json=self.store.onmessage,
|
|
238
|
+
)
|
|
239
|
+
# async for msg in wsqueue:
|
|
240
|
+
# print(msg)
|
|
241
|
+
|
|
242
|
+
await ws_app._event.wait()
|
|
243
|
+
await ws_app.current_ws._wait_authtask()
|
|
244
|
+
return ws_app
|
|
245
|
+
|
|
226
246
|
@staticmethod
|
|
227
247
|
def _format_with_step(value: float, step: Any) -> str:
|
|
228
248
|
if step in (None, 0, "0"):
|
hyperquant/broker/lbank.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hyperquant
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.79
|
|
4
4
|
Summary: A minimal yet hyper-efficient backtesting framework for quantitative trading
|
|
5
5
|
Project-URL: Homepage, https://github.com/yourusername/hyperquant
|
|
6
6
|
Project-URL: Issues, https://github.com/yourusername/hyperquant/issues
|
|
@@ -5,10 +5,10 @@ hyperquant/draw.py,sha256=up_lQ3pHeVLoNOyh9vPjgNwjD0M-6_IetSGviQUgjhY,54624
|
|
|
5
5
|
hyperquant/logkit.py,sha256=nUo7nx5eONvK39GOhWwS41zNRL756P2J7-5xGzwXnTY,8462
|
|
6
6
|
hyperquant/notikit.py,sha256=x5yAZ_tAvLQRXcRbcg-VabCaN45LUhvlTZnUqkIqfAA,3596
|
|
7
7
|
hyperquant/broker/auth.py,sha256=Wst7mTBuUS2BQ5hZd0a8FNNs5Uc01ac9WzJpseTuyAY,7673
|
|
8
|
-
hyperquant/broker/bitget.py,sha256=
|
|
8
|
+
hyperquant/broker/bitget.py,sha256=X_S0LKZ7FZAEb6oEMr1vdGP1fondzK74BhmNTpRDSEA,9488
|
|
9
9
|
hyperquant/broker/edgex.py,sha256=TqUO2KRPLN_UaxvtLL6HnA9dAQXC1sGxOfqTHd6W5k8,18378
|
|
10
10
|
hyperquant/broker/hyperliquid.py,sha256=7MxbI9OyIBcImDelPJu-8Nd53WXjxPB5TwE6gsjHbto,23252
|
|
11
|
-
hyperquant/broker/lbank.py,sha256=
|
|
11
|
+
hyperquant/broker/lbank.py,sha256=CccyPGx8_nTb6Yze3L5KXbN0dqfeKc2PxIiG04vGcR4,18995
|
|
12
12
|
hyperquant/broker/ourbit.py,sha256=NUcDSIttf-HGWzoW1uBTrGLPHlkuemMjYCm91MigTno,18228
|
|
13
13
|
hyperquant/broker/ws.py,sha256=9Zu5JSLj-ylYEVmFmRwvZDDnVYKwb37cLHfZzA0AZGc,2200
|
|
14
14
|
hyperquant/broker/lib/edgex_sign.py,sha256=lLUCmY8HHRLfLKyGrlTJYaBlSHPsIMWg3EZnQJKcmyk,95785
|
|
@@ -24,6 +24,6 @@ hyperquant/datavison/_util.py,sha256=92qk4vO856RqycO0YqEIHJlEg-W9XKapDVqAMxe6rbw
|
|
|
24
24
|
hyperquant/datavison/binance.py,sha256=3yNKTqvt_vUQcxzeX4ocMsI5k6Q6gLZrvgXxAEad6Kc,5001
|
|
25
25
|
hyperquant/datavison/coinglass.py,sha256=PEjdjISP9QUKD_xzXNzhJ9WFDTlkBrRQlVL-5pxD5mo,10482
|
|
26
26
|
hyperquant/datavison/okx.py,sha256=yg8WrdQ7wgWHNAInIgsWPM47N3Wkfr253169IPAycAY,6898
|
|
27
|
-
hyperquant-0.
|
|
28
|
-
hyperquant-0.
|
|
29
|
-
hyperquant-0.
|
|
27
|
+
hyperquant-0.79.dist-info/METADATA,sha256=PoQXFu9nGxdB7ypx4uMaHI4JKyZ5CvhVto5nbKAKG3s,4317
|
|
28
|
+
hyperquant-0.79.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
29
|
+
hyperquant-0.79.dist-info/RECORD,,
|
|
File without changes
|