hyperquant 0.79__tar.gz → 0.82__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.79 → hyperquant-0.82}/PKG-INFO +1 -1
  2. {hyperquant-0.79 → hyperquant-0.82}/apis.json +1 -1
  3. {hyperquant-0.79 → hyperquant-0.82}/pyproject.toml +1 -1
  4. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/broker/lbank.py +89 -0
  5. {hyperquant-0.79 → hyperquant-0.82}/tests/test_bitget.py +3 -2
  6. {hyperquant-0.79 → hyperquant-0.82}/tests/test_lbank.py +11 -2
  7. {hyperquant-0.79 → hyperquant-0.82}/uv.lock +1 -1
  8. {hyperquant-0.79 → hyperquant-0.82}/.gitignore +0 -0
  9. {hyperquant-0.79 → hyperquant-0.82}/.python-version +0 -0
  10. {hyperquant-0.79 → hyperquant-0.82}/README.md +0 -0
  11. {hyperquant-0.79 → hyperquant-0.82}/data/alpine_smoke.log +0 -0
  12. {hyperquant-0.79 → hyperquant-0.82}/data/logs/notikit.log +0 -0
  13. {hyperquant-0.79 → hyperquant-0.82}/data/logs/test_order_sync.log +0 -0
  14. {hyperquant-0.79 → hyperquant-0.82}/data/records_swap.csv +0 -0
  15. {hyperquant-0.79 → hyperquant-0.82}/data/records_swapc.csv +0 -0
  16. {hyperquant-0.79 → hyperquant-0.82}/doc/lbank.md +0 -0
  17. {hyperquant-0.79 → hyperquant-0.82}/pub.sh +0 -0
  18. {hyperquant-0.79 → hyperquant-0.82}/requirements-dev.lock +0 -0
  19. {hyperquant-0.79 → hyperquant-0.82}/requirements.lock +0 -0
  20. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/__init__.py +0 -0
  21. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/broker/auth.py +0 -0
  22. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/broker/bitget.py +0 -0
  23. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/broker/edgex.py +0 -0
  24. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/broker/hyperliquid.py +0 -0
  25. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/broker/lib/edgex_sign.py +0 -0
  26. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/broker/lib/hpstore.py +0 -0
  27. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/broker/lib/hyper_types.py +0 -0
  28. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/broker/lib/util.py +0 -0
  29. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/broker/models/bitget.py +0 -0
  30. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/broker/models/edgex.py +0 -0
  31. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/broker/models/hyperliquid.py +0 -0
  32. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/broker/models/lbank.py +0 -0
  33. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/broker/models/ourbit.py +0 -0
  34. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/broker/ourbit.py +0 -0
  35. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/broker/ws.py +0 -0
  36. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/core.py +0 -0
  37. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/datavison/_util.py +0 -0
  38. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/datavison/binance.py +0 -0
  39. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/datavison/coinglass.py +0 -0
  40. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/datavison/okx.py +0 -0
  41. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/db.py +0 -0
  42. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/draw.py +0 -0
  43. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/logkit.py +0 -0
  44. {hyperquant-0.79 → hyperquant-0.82}/src/hyperquant/notikit.py +0 -0
  45. {hyperquant-0.79 → hyperquant-0.82}/tests/test_draw.py +0 -0
  46. {hyperquant-0.79 → hyperquant-0.82}/tests/test_edgex.py +0 -0
  47. {hyperquant-0.79 → hyperquant-0.82}/tests/test_ourbit.py +0 -0
  48. {hyperquant-0.79 → hyperquant-0.82}/tests/tmp.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyperquant
3
- Version: 0.79
3
+ Version: 0.82
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
- "18d81d8ab5dd4d3196281161ec0dcbe6"
11
+ "67782715959c4b15b5fadab8c1cec62d"
12
12
  ],
13
13
  "bitget":[
14
14
  "bg_03e0445d9282f248d22842cfe6f30192",
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hyperquant"
3
- version = "0.79"
3
+ version = "0.82"
4
4
  description = "A minimal yet hyper-efficient backtesting framework for quantitative trading"
5
5
  authors = [
6
6
  { name = "MissinA", email = "1421329142@qq.com" }
@@ -495,6 +495,95 @@ class Lbank:
495
495
  if not isinstance(data, dict) or data.get("code") != 200:
496
496
  raise RuntimeError(f"{operation} failed: {data}")
497
497
  return data.get("data") or {}
498
+
499
+ # https://uuapi.rerrkvifj.com/cfd/agg/v1/sendQryAll
500
+ # {
501
+ # "productGroup": "SwapU",
502
+ # "instrumentID": "BTCUSDT",
503
+ # "asset": "USDT"
504
+ # }
505
+
506
+ async def query_all(self, symbol:str):
507
+ """查询资产信息
508
+
509
+ .. code:: json
510
+
511
+ {
512
+ "fundingRateTimestamp": 28800,
513
+ "isMarketAcount": 0,
514
+ "longMaxVolume": 10000000000000000,
515
+ "role": 2,
516
+ "openingTime": 1609545600000,
517
+ "isCrossMargin": 1,
518
+ "longLeverage": 25,
519
+ "shortLastVolume": 10000000000000000,
520
+ "longLastVolume": 10000000000000000,
521
+ "onTime": 1609459200000,
522
+ "shortMaintenanceMarginRate": "0.0025",
523
+ "state": 3,
524
+ "markedPrice": "111031.3",
525
+ "assetBalance": {
526
+ "reserveAvailable": "0.0",
527
+ "balance": "22.79163408",
528
+ "frozenMargin": "0.0",
529
+ "reserveMode": "0",
530
+ "totalCloseProfit": "-15.982736",
531
+ "available": "22.79163408",
532
+ "crossMargin": "0.0",
533
+ "reserve": "0.0",
534
+ "frozenFee": "0.0",
535
+ "marginAble": "0.0",
536
+ "realAvailable": "22.79163408"
537
+ },
538
+ "longMaxLeverage": 200,
539
+ "shortMaintenanceMarginQuickAmount": "0",
540
+ "shortLastAmount": "10798590",
541
+ "unrealProfitCalType": "2",
542
+ "longLastAmount": "10798590",
543
+ "shortMaxVolume": 10000000000000000,
544
+ "shortLeverage": 25,
545
+ "calMarkedPrice": "111031.3",
546
+ "longMaintenanceMarginRate": "0.0025",
547
+ "wsToken": "fa1d5e0ad94ede6efab6ced66ea5367cfe68c81173863424dc6e8d846d7e723b",
548
+ "shortMaxLeverage": 200,
549
+ "nextFundingRateTimestamp": 1760976000000,
550
+ "longMaintenanceMarginQuickAmount": "0",
551
+ "forbidTrade": false,
552
+ "defaultPositionType": "2",
553
+ "lastPrice": "111027.9",
554
+ "fundingRate": "0.00003598"
555
+ }
556
+
557
+ """
558
+
559
+ payload = {
560
+ "productGroup": "SwapU",
561
+ "instrumentID": symbol,
562
+ "asset": "USDT"
563
+ }
564
+ res = await self.client.post(
565
+ f"{self.front_api}/cfd/agg/v1/sendQryAll",
566
+ json=payload,
567
+ headers=self._rest_headers,
568
+ )
569
+ data = await res.json()
570
+ return self._ensure_ok("query_all", data)
571
+
572
+
573
+ async def set_position_mode(self, mode: Literal["hedge", "oneway"] = "oneway") -> dict[str, Any]:
574
+ """设置持仓模式到单向持仓或对冲持仓"""
575
+
576
+ mode_code = "2" if mode == "oneway" else "1"
577
+ payload = {
578
+ "PositionType": mode_code,
579
+ }
580
+ res = await self.client.post(
581
+ f"{self.front_api}/cfd/action/v1.0/SendMemberAction",
582
+ json=payload,
583
+ headers=self._rest_headers,
584
+ )
585
+ data = await res.json()
586
+ return self._ensure_ok("set_position_mode", data)
498
587
 
499
588
  @staticmethod
500
589
  def _normalize_direction(direction: str) -> str:
@@ -65,12 +65,13 @@ async def test_order():
65
65
  await bg.__aenter__()
66
66
  ts = time.time() * 1000
67
67
  res = await bg.place_order(
68
- 'SOLUSDT',
68
+ 'LIGHTUSDT',
69
69
  direction='long',
70
70
  order_type='limit_gtc',
71
71
  volume=0.1,
72
72
  price=185
73
73
  )
74
+
74
75
  # print(res)
75
76
  print(f'订单延迟: {time.time() * 1000 - ts} ms')
76
77
 
@@ -189,4 +190,4 @@ async def test_order_sync_polling():
189
190
 
190
191
 
191
192
  if __name__ == "__main__":
192
- asyncio.run(test_order_sync_polling())
193
+ asyncio.run(test_order())
@@ -124,7 +124,7 @@ async def test_place():
124
124
  order = await lb.place_order(
125
125
  "YGGUSDT",
126
126
  direction="buy",
127
- order_type='limit_ioc',
127
+ order_type='market',
128
128
  price=0.165,
129
129
  volume=40,
130
130
  )
@@ -132,6 +132,10 @@ async def test_place():
132
132
  print(f'下单延迟 {int(time.time() * 1000) - start} ms')
133
133
 
134
134
 
135
+ async def test_query_all():
136
+ async with pybotters.Client(apis='./apis.json') as client:
137
+ async with Lbank(client) as lb:
138
+ print(await lb.query_all('BTCUSDT'))
135
139
 
136
140
  async def test_cancel():
137
141
  async with pybotters.Client(apis='./apis.json') as client:
@@ -139,6 +143,11 @@ async def test_cancel():
139
143
  res = await lb.cancel_order("1000624020664540")
140
144
  print(res)
141
145
 
146
+ async def test_oneway_mode():
147
+ async with pybotters.Client(apis='./apis.json') as client:
148
+ async with Lbank(client) as lb:
149
+ await lb.set_position_mode('oneway')
150
+
142
151
 
143
152
  async def order_sync_polling(
144
153
  broker: Lbank,
@@ -285,4 +294,4 @@ async def test_query_order():
285
294
  print(res)
286
295
 
287
296
  if __name__ == "__main__":
288
- asyncio.run(test_order_sync_polling())
297
+ asyncio.run(test_update())
@@ -662,7 +662,7 @@ wheels = [
662
662
 
663
663
  [[package]]
664
664
  name = "hyperquant"
665
- version = "0.78"
665
+ version = "0.81"
666
666
  source = { editable = "." }
667
667
  dependencies = [
668
668
  { 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