hyperquant 0.75__tar.gz → 0.76__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.
- {hyperquant-0.75 → hyperquant-0.76}/PKG-INFO +1 -1
- {hyperquant-0.75 → hyperquant-0.76}/pyproject.toml +1 -1
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/broker/models/lbank.py +8 -4
- {hyperquant-0.75 → hyperquant-0.76}/tests/test_lbank.py +27 -7
- {hyperquant-0.75 → hyperquant-0.76}/uv.lock +1 -1
- {hyperquant-0.75 → hyperquant-0.76}/.gitignore +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/.python-version +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/README.md +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/apis.json +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/data/alpine_smoke.log +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/data/logs/notikit.log +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/data/logs/test_order_sync.log +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/data/records_swap.csv +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/data/records_swapc.csv +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/doc/lbank.md +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/pub.sh +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/requirements-dev.lock +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/requirements.lock +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/__init__.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/broker/auth.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/broker/bitget.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/broker/edgex.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/broker/hyperliquid.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/broker/lbank.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/broker/lib/edgex_sign.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/broker/lib/hpstore.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/broker/lib/hyper_types.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/broker/lib/util.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/broker/models/bitget.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/broker/models/edgex.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/broker/models/hyperliquid.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/broker/models/ourbit.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/broker/ourbit.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/broker/ws.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/core.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/datavison/_util.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/datavison/binance.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/datavison/coinglass.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/datavison/okx.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/db.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/draw.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/logkit.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/src/hyperquant/notikit.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/tests/test_bitget.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/tests/test_draw.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/tests/test_edgex.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/tests/test_ourbit.py +0 -0
- {hyperquant-0.75 → hyperquant-0.76}/tests/tmp.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: hyperquant
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.76
|
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
|
@@ -274,10 +274,14 @@ class Position(DataStore):
|
|
274
274
|
bus_id = entry.get("BusinessNo")
|
275
275
|
if not position_id:
|
276
276
|
return None
|
277
|
-
|
278
|
-
|
279
|
-
side =
|
280
|
-
|
277
|
+
|
278
|
+
q = float(entry.get("Position", 0))
|
279
|
+
side = "net"
|
280
|
+
if q > 0:
|
281
|
+
side = "long"
|
282
|
+
elif q < 0:
|
283
|
+
side = "short"
|
284
|
+
|
281
285
|
return {
|
282
286
|
"position_id": position_id,
|
283
287
|
"bus_id": bus_id,
|
@@ -181,7 +181,9 @@ async def order_sync_polling(
|
|
181
181
|
if not position_id:
|
182
182
|
raise RuntimeError(f"place_order 返回缺少 position_id: {resp}")
|
183
183
|
|
184
|
-
|
184
|
+
trade_resp = None
|
185
|
+
|
186
|
+
if 'volumeRemain' in resp and float(resp['volumeRemain']) == 0 and float(resp.get('turnover', 0)) != 0:
|
185
187
|
return {
|
186
188
|
"order_id": order_id,
|
187
189
|
"trade_count": 1,
|
@@ -195,7 +197,11 @@ async def order_sync_polling(
|
|
195
197
|
"trade_time": resp.get('updateTime'),
|
196
198
|
}
|
197
199
|
|
198
|
-
|
200
|
+
if 'ioc' in norm_type:
|
201
|
+
return {
|
202
|
+
"order_id": order_id,
|
203
|
+
"trade_count": 0
|
204
|
+
}
|
199
205
|
|
200
206
|
async def _poll_orders(timeout_sec: float) -> dict | None:
|
201
207
|
nonlocal trade_resp
|
@@ -237,22 +243,36 @@ async def test_order_sync_polling():
|
|
237
243
|
await lb.sub_orderbook(["SOLUSDT"], limit=1)
|
238
244
|
await lb.store.book.wait()
|
239
245
|
bid0 = float(lb.store.book.find({"s": "SOLUSDT", 'S': 'b'})[0]['p'])
|
240
|
-
bid0 = bid0 - 0.01
|
246
|
+
# bid0 = bid0 - 0.01
|
247
|
+
bid0 = bid0 + 1
|
241
248
|
# bid0 = bid0 - 1
|
242
249
|
print(bid0)
|
243
250
|
|
244
|
-
|
251
|
+
snapshot = await order_sync_polling(
|
245
252
|
lb,
|
246
253
|
symbol="SOLUSDT",
|
247
254
|
direction="buy",
|
248
|
-
order_type="
|
255
|
+
order_type="market",
|
249
256
|
price=bid0,
|
250
257
|
volume=0.03,
|
251
258
|
window_sec=3.0,
|
252
259
|
grace_sec=1,
|
253
260
|
poll_interval=1
|
254
261
|
)
|
255
|
-
|
262
|
+
|
263
|
+
position_id = snapshot.get("position_id")
|
264
|
+
if not position_id:
|
265
|
+
print('没有 position_id')
|
266
|
+
|
267
|
+
position = None
|
268
|
+
for _ in range(5):
|
269
|
+
await lb.update("position")
|
270
|
+
position = lb.store.position.get({"position_id": position_id})
|
271
|
+
if position:
|
272
|
+
break
|
273
|
+
await asyncio.sleep(0.1)
|
274
|
+
|
275
|
+
print(position)
|
256
276
|
|
257
277
|
async def test_query_order():
|
258
278
|
async with pybotters.Client(apis='./apis.json') as client:
|
@@ -261,4 +281,4 @@ async def test_query_order():
|
|
261
281
|
print(res)
|
262
282
|
|
263
283
|
if __name__ == "__main__":
|
264
|
-
asyncio.run(
|
284
|
+
asyncio.run(test_update())
|
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
|