hyperquant 0.75__tar.gz → 0.77__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 (48) hide show
  1. {hyperquant-0.75 → hyperquant-0.77}/PKG-INFO +1 -1
  2. {hyperquant-0.75 → hyperquant-0.77}/apis.json +1 -1
  3. {hyperquant-0.75 → hyperquant-0.77}/pyproject.toml +1 -1
  4. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/broker/models/lbank.py +11 -5
  5. {hyperquant-0.75 → hyperquant-0.77}/tests/test_lbank.py +31 -9
  6. {hyperquant-0.75 → hyperquant-0.77}/uv.lock +1 -1
  7. {hyperquant-0.75 → hyperquant-0.77}/.gitignore +0 -0
  8. {hyperquant-0.75 → hyperquant-0.77}/.python-version +0 -0
  9. {hyperquant-0.75 → hyperquant-0.77}/README.md +0 -0
  10. {hyperquant-0.75 → hyperquant-0.77}/data/alpine_smoke.log +0 -0
  11. {hyperquant-0.75 → hyperquant-0.77}/data/logs/notikit.log +0 -0
  12. {hyperquant-0.75 → hyperquant-0.77}/data/logs/test_order_sync.log +0 -0
  13. {hyperquant-0.75 → hyperquant-0.77}/data/records_swap.csv +0 -0
  14. {hyperquant-0.75 → hyperquant-0.77}/data/records_swapc.csv +0 -0
  15. {hyperquant-0.75 → hyperquant-0.77}/doc/lbank.md +0 -0
  16. {hyperquant-0.75 → hyperquant-0.77}/pub.sh +0 -0
  17. {hyperquant-0.75 → hyperquant-0.77}/requirements-dev.lock +0 -0
  18. {hyperquant-0.75 → hyperquant-0.77}/requirements.lock +0 -0
  19. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/__init__.py +0 -0
  20. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/broker/auth.py +0 -0
  21. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/broker/bitget.py +0 -0
  22. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/broker/edgex.py +0 -0
  23. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/broker/hyperliquid.py +0 -0
  24. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/broker/lbank.py +0 -0
  25. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/broker/lib/edgex_sign.py +0 -0
  26. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/broker/lib/hpstore.py +0 -0
  27. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/broker/lib/hyper_types.py +0 -0
  28. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/broker/lib/util.py +0 -0
  29. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/broker/models/bitget.py +0 -0
  30. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/broker/models/edgex.py +0 -0
  31. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/broker/models/hyperliquid.py +0 -0
  32. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/broker/models/ourbit.py +0 -0
  33. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/broker/ourbit.py +0 -0
  34. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/broker/ws.py +0 -0
  35. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/core.py +0 -0
  36. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/datavison/_util.py +0 -0
  37. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/datavison/binance.py +0 -0
  38. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/datavison/coinglass.py +0 -0
  39. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/datavison/okx.py +0 -0
  40. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/db.py +0 -0
  41. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/draw.py +0 -0
  42. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/logkit.py +0 -0
  43. {hyperquant-0.75 → hyperquant-0.77}/src/hyperquant/notikit.py +0 -0
  44. {hyperquant-0.75 → hyperquant-0.77}/tests/test_bitget.py +0 -0
  45. {hyperquant-0.75 → hyperquant-0.77}/tests/test_draw.py +0 -0
  46. {hyperquant-0.75 → hyperquant-0.77}/tests/test_edgex.py +0 -0
  47. {hyperquant-0.75 → hyperquant-0.77}/tests/test_ourbit.py +0 -0
  48. {hyperquant-0.75 → hyperquant-0.77}/tests/tmp.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyperquant
3
- Version: 0.75
3
+ Version: 0.77
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
@@ -8,7 +8,7 @@
8
8
  "3MB7nAnnNPTxAnwdbjDPew-02b746d6a832346a46a97faf054b2909c1a0b58a35e04c3504923a99a5503c1c"
9
9
  ],
10
10
  "lbank": [
11
- "925a645e03c84c8e96b96008e98b75f7"
11
+ "36e99e63f77d4ab18137c23d30beda4e"
12
12
  ],
13
13
  "bitget":[
14
14
  "bg_03e0445d9282f248d22842cfe6f30192",
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hyperquant"
3
- version = "0.75"
3
+ version = "0.77"
4
4
  description = "A minimal yet hyper-efficient backtesting framework for quantitative trading"
5
5
  authors = [
6
6
  { name = "MissinA", email = "1421329142@qq.com" }
@@ -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
- direction_code = str(entry.get("PosiDirection")) if entry.get("PosiDirection") is not None else None
279
- side = self._POS_DIRECTION_MAP.get(direction_code, direction_code)
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,
@@ -294,6 +298,7 @@ class Position(DataStore):
294
298
  "realized_pnl": entry.get("CloseProfit"),
295
299
  "update_time": entry.get("UpdateTime"),
296
300
  "insert_time": entry.get("InsertTime"),
301
+ "begin_time": entry.get("BeginTime")
297
302
  }
298
303
 
299
304
  def _onresponse(self, data: dict[str, Any] | None) -> None:
@@ -488,7 +493,8 @@ class LbankDataStore(DataStoreCollection):
488
493
  "unrealized_pnl": <未实现盈亏>,
489
494
  "realized_pnl": <已实现盈亏>,
490
495
  "update_time": <更新时间>,
491
- "insert_time": <插入时间>
496
+ "insert_time": <插入时间>,
497
+ "begin_time": <持仓开始时间>
492
498
  },
493
499
  ...
494
500
  ]
@@ -169,6 +169,7 @@ async def order_sync_polling(
169
169
  )
170
170
 
171
171
  latency = int(time.time() * 1000) - started
172
+ print(resp)
172
173
 
173
174
  order_id = resp.get("orderSysID")
174
175
  # print(f"下单延迟 {latency} ms, 订单号: {order_id}")
@@ -181,12 +182,14 @@ async def order_sync_polling(
181
182
  if not position_id:
182
183
  raise RuntimeError(f"place_order 返回缺少 position_id: {resp}")
183
184
 
184
- if 'volumeRemain' in resp and float(resp['volumeRemain']) == 0:
185
+ trade_resp = None
186
+
187
+ if 'volumeRemain' in resp and float(resp['volumeRemain']) == 0 and float(resp.get('turnover', 0)) != 0:
185
188
  return {
186
189
  "order_id": order_id,
187
190
  "trade_count": 1,
188
191
  "volume": volume,
189
- "avg_price": float(resp.get('openPrice', 0)),
192
+ "avg_price": float(resp.get('tradePrice', 0)),
190
193
  "turnover": float(resp.get('turnover', 0)),
191
194
  "fee": float(resp.get('fee', 0)),
192
195
  "position_id": position_id,
@@ -195,7 +198,11 @@ async def order_sync_polling(
195
198
  "trade_time": resp.get('updateTime'),
196
199
  }
197
200
 
198
- trade_resp = None
201
+ if 'ioc' in norm_type:
202
+ return {
203
+ "order_id": order_id,
204
+ "trade_count": 0
205
+ }
199
206
 
200
207
  async def _poll_orders(timeout_sec: float) -> dict | None:
201
208
  nonlocal trade_resp
@@ -237,27 +244,42 @@ async def test_order_sync_polling():
237
244
  await lb.sub_orderbook(["SOLUSDT"], limit=1)
238
245
  await lb.store.book.wait()
239
246
  bid0 = float(lb.store.book.find({"s": "SOLUSDT", 'S': 'b'})[0]['p'])
240
- bid0 = bid0 - 0.01
247
+ # bid0 = bid0 - 0.01
248
+ bid0 = bid0 + 1
241
249
  # bid0 = bid0 - 1
242
250
  print(bid0)
243
251
 
244
- result = await order_sync_polling(
252
+ snapshot = await order_sync_polling(
245
253
  lb,
246
254
  symbol="SOLUSDT",
247
- direction="buy",
248
- order_type="limit_GTC",
255
+ direction="sell",
256
+ order_type="market",
249
257
  price=bid0,
250
258
  volume=0.03,
251
259
  window_sec=3.0,
252
260
  grace_sec=1,
253
261
  poll_interval=1
254
262
  )
255
- print(result)
263
+ print(snapshot)
264
+
265
+ # position_id = snapshot.get("position_id")
266
+ # if not position_id:
267
+ # print('没有 position_id')
268
+
269
+ # position = None
270
+ # for _ in range(5):
271
+ # await lb.update("position")
272
+ # position = lb.store.position.get({"position_id": position_id})
273
+ # if position:
274
+ # break
275
+ # await asyncio.sleep(0.1)
276
+
277
+ # print(position)
256
278
 
257
279
  async def test_query_order():
258
280
  async with pybotters.Client(apis='./apis.json') as client:
259
281
  async with Lbank(client) as lb:
260
- res = await lb.query_order("1000633284579483")
282
+ res = await lb.query_order("1000633355403954")
261
283
  print(res)
262
284
 
263
285
  if __name__ == "__main__":
@@ -530,7 +530,7 @@ wheels = [
530
530
 
531
531
  [[package]]
532
532
  name = "hyperquant"
533
- version = "0.74"
533
+ version = "0.76"
534
534
  source = { editable = "." }
535
535
  dependencies = [
536
536
  { name = "aiohttp" },
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