hyperquant 0.98__tar.gz → 0.99__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.98 → hyperquant-0.99}/PKG-INFO +1 -1
- {hyperquant-0.98 → hyperquant-0.99}/apis.json +3 -3
- {hyperquant-0.98 → hyperquant-0.99}/pyproject.toml +1 -1
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/bitmart.py +27 -20
- {hyperquant-0.98 → hyperquant-0.99}/tests/test_bitmart.py +7 -4
- {hyperquant-0.98 → hyperquant-0.99}/uv.lock +1 -1
- {hyperquant-0.98 → hyperquant-0.99}/.gitignore +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/.python-version +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/README.md +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/data/alpine_smoke.log +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/data/logs/notikit.log +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/data/logs/test_order_sync.log +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/data/records_swap.csv +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/data/records_swapc.csv +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/doc/bitmart.md +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/doc/coinup.md +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/doc/lbank.md +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/pub.sh +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/requirements-dev.lock +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/requirements.lock +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/__init__.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/auth.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/bitget.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/coinup.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/coinw.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/edgex.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/hyperliquid.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/lbank.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/lib/edgex_sign.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/lib/hpstore.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/lib/hyper_types.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/lib/util.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/lighter.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/models/bitget.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/models/bitmart.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/models/coinup.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/models/coinw.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/models/edgex.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/models/hyperliquid.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/models/lbank.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/models/lighter.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/models/ourbit.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/ourbit.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/broker/ws.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/core.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/datavison/_util.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/datavison/binance.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/datavison/coinglass.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/datavison/okx.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/db.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/draw.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/logkit.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/src/hyperquant/notikit.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/tests/test_bitget.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/tests/test_coinup.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/tests/test_coinw.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/tests/test_draw.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/tests/test_edgex.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/tests/test_lbank.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/tests/test_lighter.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/tests/test_ourbit.py +0 -0
- {hyperquant-0.98 → hyperquant-0.99}/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.99
|
|
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 +24,8 @@
|
|
|
24
24
|
"41933ec0f5dace5eee47628ea2e2cb40a491f7fd20f983b385f8bdc5eea3d3ad4a47bd745f70fc2a"
|
|
25
25
|
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yncio
|
|
|
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
|
|
|
@@ -335,6 +335,7 @@ class Bitmart:
|
|
|
335
335
|
category: Literal[1,2,"limit","market"] = "limit",
|
|
336
336
|
price: float,
|
|
337
337
|
qty: float,
|
|
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",
|
|
@@ -361,25 +362,31 @@ class Bitmart:
|
|
|
361
362
|
raise ValueError(f"Market metadata unavailable for symbol: {symbol}")
|
|
362
363
|
|
|
363
364
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
365
|
+
if qty_contract is not None:
|
|
366
|
+
|
|
367
|
+
contract_size_str = detail.get("contract_size") or detail.get("vol_unit") or "1"
|
|
368
|
+
try:
|
|
369
|
+
contract_size_val = float(contract_size_str)
|
|
370
|
+
except (TypeError, ValueError):
|
|
371
|
+
contract_size_val = 1.0
|
|
372
|
+
if contract_size_val <= 0:
|
|
373
|
+
raise ValueError(f"Invalid contract_size for {symbol}: {contract_size_str}")
|
|
374
|
+
|
|
375
|
+
contracts_float = float(qty) / contract_size_val
|
|
376
|
+
contracts_int = int(round(contracts_float))
|
|
377
|
+
if contracts_int <= 0:
|
|
378
|
+
raise ValueError(
|
|
379
|
+
f"Volume too small for contract size ({contract_size_val}): volume={qty}"
|
|
380
|
+
)
|
|
381
|
+
if abs(contracts_float - contracts_int) > 1e-8:
|
|
382
|
+
raise ValueError(
|
|
383
|
+
f"Volume must be a multiple of contract_size ({contract_size_val}). "
|
|
384
|
+
f"Received volume={qty} -> {contracts_float} contracts."
|
|
385
|
+
)
|
|
386
|
+
else:
|
|
387
|
+
contracts_int = int(qty)
|
|
388
|
+
if contracts_int <= 0:
|
|
389
|
+
raise ValueError(f"Volume must be positive integer contracts: volume={qty}")
|
|
383
390
|
|
|
384
391
|
price_unit = detail.get("price_unit") or 1
|
|
385
392
|
try:
|
|
@@ -20,9 +20,12 @@ 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:
|
|
@@ -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(
|
|
156
|
+
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
|
|
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
|