hyperquant 0.55__tar.gz → 0.56__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 (41) hide show
  1. {hyperquant-0.55 → hyperquant-0.56}/PKG-INFO +1 -1
  2. {hyperquant-0.55 → hyperquant-0.56}/pyproject.toml +1 -1
  3. {hyperquant-0.55 → hyperquant-0.56}/src/hyperquant/broker/models/ourbit.py +1 -0
  4. {hyperquant-0.55 → hyperquant-0.56}/src/hyperquant/broker/ourbit.py +1 -0
  5. {hyperquant-0.55 → hyperquant-0.56}/tests/test_ourbit.py +1 -1
  6. {hyperquant-0.55 → hyperquant-0.56}/uv.lock +1 -1
  7. hyperquant-0.55/tests/test_order_sync.py +0 -82
  8. {hyperquant-0.55 → hyperquant-0.56}/.gitignore +0 -0
  9. {hyperquant-0.55 → hyperquant-0.56}/.python-version +0 -0
  10. {hyperquant-0.55 → hyperquant-0.56}/README.md +0 -0
  11. {hyperquant-0.55 → hyperquant-0.56}/apis.json +0 -0
  12. {hyperquant-0.55 → hyperquant-0.56}/backtest_tmp.py +0 -0
  13. {hyperquant-0.55 → hyperquant-0.56}/data/alpine_smoke.log +0 -0
  14. {hyperquant-0.55 → hyperquant-0.56}/data/logs/notikit.log +0 -0
  15. {hyperquant-0.55 → hyperquant-0.56}/data/logs/test_order_sync.log +0 -0
  16. {hyperquant-0.55 → hyperquant-0.56}/deals.json +0 -0
  17. {hyperquant-0.55 → hyperquant-0.56}/pnl_chart.html +0 -0
  18. {hyperquant-0.55 → hyperquant-0.56}/pub.sh +0 -0
  19. {hyperquant-0.55 → hyperquant-0.56}/requirements-dev.lock +0 -0
  20. {hyperquant-0.55 → hyperquant-0.56}/requirements.lock +0 -0
  21. {hyperquant-0.55 → hyperquant-0.56}/src/hyperquant/__init__.py +0 -0
  22. {hyperquant-0.55 → hyperquant-0.56}/src/hyperquant/broker/auth.py +0 -0
  23. {hyperquant-0.55 → hyperquant-0.56}/src/hyperquant/broker/hyperliquid.py +0 -0
  24. {hyperquant-0.55 → hyperquant-0.56}/src/hyperquant/broker/lib/hpstore.py +0 -0
  25. {hyperquant-0.55 → hyperquant-0.56}/src/hyperquant/broker/lib/hyper_types.py +0 -0
  26. {hyperquant-0.55 → hyperquant-0.56}/src/hyperquant/broker/models/hyperliquid.py +0 -0
  27. {hyperquant-0.55 → hyperquant-0.56}/src/hyperquant/broker/ws.py +0 -0
  28. {hyperquant-0.55 → hyperquant-0.56}/src/hyperquant/core.py +0 -0
  29. {hyperquant-0.55 → hyperquant-0.56}/src/hyperquant/datavison/_util.py +0 -0
  30. {hyperquant-0.55 → hyperquant-0.56}/src/hyperquant/datavison/binance.py +0 -0
  31. {hyperquant-0.55 → hyperquant-0.56}/src/hyperquant/datavison/coinglass.py +0 -0
  32. {hyperquant-0.55 → hyperquant-0.56}/src/hyperquant/datavison/okx.py +0 -0
  33. {hyperquant-0.55 → hyperquant-0.56}/src/hyperquant/db.py +0 -0
  34. {hyperquant-0.55 → hyperquant-0.56}/src/hyperquant/draw.py +0 -0
  35. {hyperquant-0.55 → hyperquant-0.56}/src/hyperquant/logkit.py +0 -0
  36. {hyperquant-0.55 → hyperquant-0.56}/src/hyperquant/notikit.py +0 -0
  37. {hyperquant-0.55 → hyperquant-0.56}/tests/test.py +0 -0
  38. {hyperquant-0.55 → hyperquant-0.56}/tests/test_draw.py +0 -0
  39. {hyperquant-0.55 → hyperquant-0.56}/tests/test_lbank.py +0 -0
  40. {hyperquant-0.55 → hyperquant-0.56}/tests/test_store.py +0 -0
  41. {hyperquant-0.55 → hyperquant-0.56}/tests/tmp.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyperquant
3
- Version: 0.55
3
+ Version: 0.56
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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hyperquant"
3
- version = "0.55"
3
+ version = "0.56"
4
4
  description = "A minimal yet hyper-efficient backtesting framework for quantitative trading"
5
5
  authors = [
6
6
  { name = "MissinA", email = "1421329142@qq.com" }
@@ -134,6 +134,7 @@ class Orders(DataStore):
134
134
  def _fmt(self, order:dict):
135
135
  return {
136
136
  "order_id": order.get("orderId"),
137
+ "position_id": order.get("positionId"),
137
138
  "symbol": order.get("symbol"),
138
139
  "price": order.get("price"),
139
140
  "vol": order.get("vol"),
@@ -177,6 +177,7 @@ class OurbitSwap:
177
177
  # '226474723700166962'
178
178
  # 'ts' =
179
179
  # 1758034181833
180
+ print(res.data)
180
181
  ret_c = self.ret_content(res)
181
182
  # 只返回 orderId
182
183
  return ret_c["orderId"]
@@ -173,7 +173,7 @@ async def test_order_sync_swap():
173
173
  # await ob.sub_orderbook(["SOL_USDT"]) # 订单簿频道
174
174
  # # 示例:市价
175
175
  # now= time.time()
176
- result = await order_sync( ob, symbol="SOL_USDT", side="buy", order_type="limit_IOC", usdt_amount=8, price=200, window_sec=3)
176
+ result = await order_sync( ob, symbol="SOL_USDT", side="buy", order_type="market", usdt_amount=8, price=200, window_sec=3)
177
177
  print(result)
178
178
 
179
179
 
@@ -530,7 +530,7 @@ wheels = [
530
530
 
531
531
  [[package]]
532
532
  name = "hyperquant"
533
- version = "0.54"
533
+ version = "0.55"
534
534
  source = { editable = "." }
535
535
  dependencies = [
536
536
  { name = "aiohttp" },
@@ -1,82 +0,0 @@
1
- import asyncio
2
- import time
3
- from hyperquant.broker.ourbit import OurbitSpot
4
- import pybotters
5
- from hyperquant.logkit import get_logger
6
-
7
- logger = get_logger('test_order_sync', './data/logs/test_order_sync.log', show_time=True)
8
-
9
-
10
- # 等待指定 oid 的最终 delete,超时抛 TimeoutError
11
- async def wait_delete(stream: pybotters.StoreStream, oid: str, seconds: float):
12
- async with asyncio.timeout(seconds):
13
- while True:
14
- change = await stream.__anext__()
15
- if change.operation == "delete" and change.data.get("order_id") == oid:
16
- return change.data # 内含 state / avg_price / deal_quantity 等累计字段
17
-
18
-
19
- async def order_sync(
20
- ob: OurbitSpot,
21
- symbol: str = "SOL_USDT",
22
- side: str = "buy",
23
- order_type: str = "market", # "market" / "limit"
24
- usdt_amount: float | None = None, # 市价可填
25
- quantity: float | None = None, # 市价可填
26
- price: float | None = None, # 限价必填
27
- window_sec: float = 2.0, # 主等待窗口(限价可设为 5.0)
28
- grace_sec: float = 2, # 撤单后宽限
29
- ):
30
- with ob.store.orders.watch() as stream:
31
- # 下单(只保留最简两种入参形态)
32
- try:
33
- oid = await ob.place_order(
34
- symbol,
35
- side,
36
- order_type=order_type,
37
- usdt_amount=usdt_amount,
38
- quantity=quantity,
39
- price=price,
40
- )
41
- except Exception as e:
42
- return {"symbol": symbol, "state": "error", "error": str(e)}
43
-
44
- # 步骤1:主窗口内等待这单的最终 delete
45
- try:
46
- return await wait_delete(stream, oid, window_sec)
47
- except TimeoutError:
48
- # 步骤2:到点撤单(市价通常用不到;限价才有意义)
49
- for i in range(3):
50
- try:
51
- await ob.cancel_order(oid)
52
- break
53
- except Exception:
54
- pass
55
- await asyncio.sleep(0.1)
56
- # 固定宽限内再等“迟到”的最终 delete
57
- try:
58
- return await wait_delete(stream, oid, grace_sec)
59
- except TimeoutError:
60
- return {"order_id": oid, "symbol": symbol, "state": "timeout"}
61
-
62
-
63
- async def test_order_sync():
64
- async with pybotters.Client(
65
- apis={
66
- "ourbit": [
67
- "WEB3bf088f8b2f2fae07592fe1a6240e2d798100a9cb2a91f8fda1056b6865ab3ee"
68
- ]
69
- }
70
- ) as client:
71
- ob = OurbitSpot(client)
72
- await ob.__aenter__()
73
- await ob.sub_personal() # 私有频道
74
- ob.store.book.limit = 3
75
- await ob.sub_orderbook(["SOL_USDT"]) # 订单簿频道
76
- # # 示例:市价
77
- # now= time.time()
78
- result = await order_sync( ob, symbol="SOL_USDT", side="buy", order_type="market", usdt_amount=8, price=200, window_sec=2)
79
- print(result)
80
-
81
-
82
-
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