hyperquant 0.98__tar.gz → 1.0__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 (62) hide show
  1. {hyperquant-0.98 → hyperquant-1.0}/PKG-INFO +1 -1
  2. {hyperquant-0.98 → hyperquant-1.0}/apis.json +3 -3
  3. {hyperquant-0.98 → hyperquant-1.0}/pyproject.toml +1 -1
  4. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/bitmart.py +25 -21
  5. {hyperquant-0.98 → hyperquant-1.0}/tests/test_bitmart.py +16 -13
  6. {hyperquant-0.98 → hyperquant-1.0}/uv.lock +1 -1
  7. {hyperquant-0.98 → hyperquant-1.0}/.gitignore +0 -0
  8. {hyperquant-0.98 → hyperquant-1.0}/.python-version +0 -0
  9. {hyperquant-0.98 → hyperquant-1.0}/README.md +0 -0
  10. {hyperquant-0.98 → hyperquant-1.0}/data/alpine_smoke.log +0 -0
  11. {hyperquant-0.98 → hyperquant-1.0}/data/logs/notikit.log +0 -0
  12. {hyperquant-0.98 → hyperquant-1.0}/data/logs/test_order_sync.log +0 -0
  13. {hyperquant-0.98 → hyperquant-1.0}/data/records_swap.csv +0 -0
  14. {hyperquant-0.98 → hyperquant-1.0}/data/records_swapc.csv +0 -0
  15. {hyperquant-0.98 → hyperquant-1.0}/doc/bitmart.md +0 -0
  16. {hyperquant-0.98 → hyperquant-1.0}/doc/coinup.md +0 -0
  17. {hyperquant-0.98 → hyperquant-1.0}/doc/lbank.md +0 -0
  18. {hyperquant-0.98 → hyperquant-1.0}/pub.sh +0 -0
  19. {hyperquant-0.98 → hyperquant-1.0}/requirements-dev.lock +0 -0
  20. {hyperquant-0.98 → hyperquant-1.0}/requirements.lock +0 -0
  21. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/__init__.py +0 -0
  22. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/auth.py +0 -0
  23. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/bitget.py +0 -0
  24. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/coinup.py +0 -0
  25. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/coinw.py +0 -0
  26. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/edgex.py +0 -0
  27. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/hyperliquid.py +0 -0
  28. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/lbank.py +0 -0
  29. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/lib/edgex_sign.py +0 -0
  30. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/lib/hpstore.py +0 -0
  31. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/lib/hyper_types.py +0 -0
  32. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/lib/util.py +0 -0
  33. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/lighter.py +0 -0
  34. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/models/bitget.py +0 -0
  35. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/models/bitmart.py +0 -0
  36. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/models/coinup.py +0 -0
  37. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/models/coinw.py +0 -0
  38. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/models/edgex.py +0 -0
  39. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/models/hyperliquid.py +0 -0
  40. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/models/lbank.py +0 -0
  41. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/models/lighter.py +0 -0
  42. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/models/ourbit.py +0 -0
  43. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/ourbit.py +0 -0
  44. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/broker/ws.py +0 -0
  45. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/core.py +0 -0
  46. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/datavison/_util.py +0 -0
  47. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/datavison/binance.py +0 -0
  48. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/datavison/coinglass.py +0 -0
  49. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/datavison/okx.py +0 -0
  50. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/db.py +0 -0
  51. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/draw.py +0 -0
  52. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/logkit.py +0 -0
  53. {hyperquant-0.98 → hyperquant-1.0}/src/hyperquant/notikit.py +0 -0
  54. {hyperquant-0.98 → hyperquant-1.0}/tests/test_bitget.py +0 -0
  55. {hyperquant-0.98 → hyperquant-1.0}/tests/test_coinup.py +0 -0
  56. {hyperquant-0.98 → hyperquant-1.0}/tests/test_coinw.py +0 -0
  57. {hyperquant-0.98 → hyperquant-1.0}/tests/test_draw.py +0 -0
  58. {hyperquant-0.98 → hyperquant-1.0}/tests/test_edgex.py +0 -0
  59. {hyperquant-0.98 → hyperquant-1.0}/tests/test_lbank.py +0 -0
  60. {hyperquant-0.98 → hyperquant-1.0}/tests/test_lighter.py +0 -0
  61. {hyperquant-0.98 → hyperquant-1.0}/tests/test_ourbit.py +0 -0
  62. {hyperquant-0.98 → hyperquant-1.0}/tests/tmp.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyperquant
3
- Version: 0.98
3
+ Version: 1.0
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
@@ -24,8 +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wIjoiQml0TWFydCIsImFsZyI6IkJNQVBJU0lYIn0sInBheWxvYWQiOnsiamlkIjoiMWRkNDM5ODkzNzU1NGUxOWFlZDY1MjJhZTMwMGZkODYiLCJ2ZXJzaW9uIjoiMjAyNTEwMzEiLCJleHBpcmVzQXQiOjE3NjE5OTE0MzYwNDcsImJtIjoiVXppdFJkZEdpdUNZek5KWSs5Q25xNkFjMlZWNmhiT0hhRzVwemdTSTE5cGRLS0JJN2FpUThGRXNaQkFyTDFVUmR5OGtFZnpCeEJiVnpELzF3Zm16NGRaOUtMU2tJVTVpa0tZaEU0SzJzOC91M1NTQmw5SVYxTjY1MURKL016NHJvdWpicm1hSk8rZU15THJDbnY3TnR1RFFPMnprRkZIcm9zRGZmM1Qvc0hodDZJa2N0UFJTdlU2ZCsrdWp6VG52Y2h1VzRDakhNTVVoQWFYOUhaMGVoTThvSnoxM2NCdHlUOVV2WXREUWd4enI5RjQvdmdYR2hDd1dESEpMNlYwU0lySG9MQkN0TXU4YWxKVy9CMitFLzVXM2JHdWxlZTk1RkhPcTh6YzRKakJXMnFxWHJ2R3RORXRWYnFFeGdJUnF5ak1ueENBNTZ5VjVPajgyQUV3OXVpM2VsaGNFZXYrSGtqUWoyeWpXYTZzR1Q3ZFloc0RRck9WU1g5Q0txelgxIn0sInNpZ25hdHVyZSI6IkRaM2hXREVBNWdXeXZ6RFdNSngzR2xhaUJBWDdiS1pCNk02bkJHaWE3WG0vOE1Vb3N1ZFhsMHp0OCs4TVM5c0szOSt1SG43VW5LalFrNGZPZ0NNU2d3PT0ifQ==",
28
+ "vKqWE9vsDKZQmt2su3DMjqorPOpn7eeNS",
29
+ "1c0886dd192a1dd0f23f71f7ab577a45"
30
30
  ]
31
31
  }
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hyperquant"
3
- version = "0.98"
3
+ version = "1.00"
4
4
  description = "A minimal yet hyper-efficient backtesting framework for quantitative trading"
5
5
  authors = [
6
6
  { name = "MissinA", email = "1421329142@qq.com" }
@@ -4,7 +4,7 @@ import asyncio
4
4
  import json
5
5
  import random
6
6
  import time
7
- from typing import Any, Literal, Sequence
7
+ from typing import Any, Literal, Optional, Sequence
8
8
 
9
9
  import pybotters
10
10
 
@@ -334,7 +334,8 @@ class Bitmart:
334
334
  *,
335
335
  category: Literal[1,2,"limit","market"] = "limit",
336
336
  price: float,
337
- qty: float,
337
+ qty: Optional[float] = None,
338
+ qty_contract: Optional[int] = None,
338
339
  side: Literal[1, 2, 3, 4, "open_long", "close_short", "close_long", "open_short", "buy", "sell"] = "open_long",
339
340
  mode: Literal[1, 2, 3, 4, "gtc", "ioc", "fok", "maker_only", "maker-only", "post_only"] = "gtc",
340
341
  open_type: Literal[1, 2, "cross", "isolated"] = "isolated",
@@ -347,6 +348,8 @@ class Bitmart:
347
348
  """Submit an order via ``submitOrder``.
348
349
  返回值: order_id (int)
349
350
  """
351
+ if qty is None and qty_contract is None:
352
+ raise ValueError("Either qty or qty_contract must be provided.")
350
353
 
351
354
  contract_id = self.get_contract_id(symbol)
352
355
  if contract_id is None:
@@ -360,26 +363,27 @@ class Bitmart:
360
363
  if detail is None:
361
364
  raise ValueError(f"Market metadata unavailable for symbol: {symbol}")
362
365
 
366
+ if qty_contract is None:
363
367
 
364
- contract_size_str = detail.get("contract_size") or detail.get("vol_unit") or "1"
365
- try:
366
- contract_size_val = float(contract_size_str)
367
- except (TypeError, ValueError):
368
- contract_size_val = 1.0
369
- if contract_size_val <= 0:
370
- raise ValueError(f"Invalid contract_size for {symbol}: {contract_size_str}")
371
-
372
- contracts_float = float(qty) / contract_size_val
373
- contracts_int = int(round(contracts_float))
374
- if contracts_int <= 0:
375
- raise ValueError(
376
- f"Volume too small for contract size ({contract_size_val}): volume={qty}"
377
- )
378
- if abs(contracts_float - contracts_int) > 1e-8:
379
- raise ValueError(
380
- f"Volume must be a multiple of contract_size ({contract_size_val}). "
381
- f"Received volume={qty} -> {contracts_float} contracts."
382
- )
368
+ contract_size_str = detail.get("contract_size") or detail.get("vol_unit") or "1"
369
+ try:
370
+ contract_size_val = float(contract_size_str)
371
+ except (TypeError, ValueError):
372
+ contract_size_val = 1.0
373
+ if contract_size_val <= 0:
374
+ raise ValueError(f"Invalid contract_size for {symbol}: {contract_size_str}")
375
+
376
+ contracts_float = float(qty) / contract_size_val
377
+ contracts_int = int(round(contracts_float))
378
+ if contracts_int <= 0:
379
+ raise ValueError(
380
+ f"Volume too small for contract size ({contract_size_val}): volume={qty}"
381
+ )
382
+
383
+ else:
384
+ contracts_int = int(qty)
385
+ if contracts_int <= 0:
386
+ raise ValueError(f"Volume must be positive integer contracts: volume={qty}")
383
387
 
384
388
  price_unit = detail.get("price_unit") or 1
385
389
  try:
@@ -20,30 +20,33 @@ async def test_update():
20
20
  # await broker.update('ticker')
21
21
  # print(broker.store.ticker.find())
22
22
 
23
- await broker.update('history_orders')
24
- print(broker.store.orders.find())
25
- print(broker.store.orders.get({'order_id':3000237069605967}))
23
+ # await broker.update('history_orders')
24
+ # print(broker.store.orders.find())
25
+ # print(broker.store.orders.get({'order_id':3000237069605967}))
26
+ await broker.update('positions')
27
+ print(broker.store.positions.find())
28
+
26
29
 
27
30
  async def test_place():
28
31
  async with pybotters.Client(apis='./apis.json') as client:
29
32
  async with Bitmart(client=client) as broker:
30
-
33
+ # [2025-10-31 17:34:15] 🔵 准备建仓: VIRTUAL_USDT entry=short qty=20.498804 lag_px=1.4635 lead=binance
31
34
  oid = await broker.place_order(
32
- symbol='ONDOUSDT',
35
+ symbol='VIRTUALUSDT',
33
36
  side='sell',
34
37
  category='limit',
35
- price=0.7,
36
- qty=0.2,
38
+ price=1.4635,
39
+ qty=20.49880423641954,
37
40
  )
38
41
 
39
42
  print(f"Placed order ID: {oid}")
40
43
 
41
- resp = await broker.cancel_order(
42
- symbol='ONDOUSDT',
43
- order_ids=[oid],
44
- )
44
+ # resp = await broker.cancel_order(
45
+ # symbol='ONDOUSDT',
46
+ # order_ids=[oid],
47
+ # )
45
48
 
46
- print(f"Cancel response: {resp}")
49
+ # print(f"Cancel response: {resp}")
47
50
 
48
51
  @dataclass
49
52
  class OrderSyncResult:
@@ -150,4 +153,4 @@ async def test_sync_place():
150
153
  logger.info(f"Order Sync Result: {result}")
151
154
 
152
155
  if __name__ == "__main__":
153
- asyncio.run(test_sync_place())
156
+ asyncio.run(test_place())
@@ -921,7 +921,7 @@ wheels = [
921
921
 
922
922
  [[package]]
923
923
  name = "hyperquant"
924
- version = "0.97"
924
+ version = "0.99"
925
925
  source = { editable = "." }
926
926
  dependencies = [
927
927
  { 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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes