hyperquant 0.67__tar.gz → 0.68__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.67 → hyperquant-0.68}/PKG-INFO +1 -1
- {hyperquant-0.67 → hyperquant-0.68}/pyproject.toml +1 -1
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/lbank.py +29 -4
- {hyperquant-0.67 → hyperquant-0.68}/tests/test_lbank.py +4 -4
- {hyperquant-0.67 → hyperquant-0.68}/uv.lock +1 -1
- {hyperquant-0.67 → hyperquant-0.68}/.gitignore +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/.python-version +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/README.md +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/apis.json +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/data/alpine_smoke.log +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/data/logs/notikit.log +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/data/logs/test_order_sync.log +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/data/records_swap.csv +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/data/records_swapc.csv +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/doc/edgex_act.md +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/doc/edgex_debug.md +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/doc/edgex_order.md +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/doc/edgex_ws.md +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/doc/lbank.md +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/pub.sh +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/requirements-dev.lock +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/requirements.lock +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/__init__.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/auth.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/edgex.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/hyperliquid.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/lib/edgex_sign.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/lib/hpstore.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/lib/hyper_types.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/lib/util.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/models/edgex.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/models/hyperliquid.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/models/lbank.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/models/ourbit.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/ourbit.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/ws.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/core.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/datavison/_util.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/datavison/binance.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/datavison/coinglass.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/datavison/okx.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/db.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/draw.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/logkit.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/notikit.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/tests/test_draw.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/tests/test_edgex.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/tests/test_ourbit.py +0 -0
- {hyperquant-0.67 → hyperquant-0.68}/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.68
|
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
|
@@ -9,6 +9,7 @@ from typing import Any, Iterable, Literal
|
|
9
9
|
import pybotters
|
10
10
|
|
11
11
|
from .models.lbank import LbankDataStore
|
12
|
+
from .lib.util import fmt_value
|
12
13
|
|
13
14
|
logger = logging.getLogger(__name__)
|
14
15
|
|
@@ -141,6 +142,24 @@ class Lbank:
|
|
141
142
|
return detail_entries[0].get("symbol")
|
142
143
|
return None
|
143
144
|
|
145
|
+
def _get_detail_entry(self, symbol: str) -> dict[str, Any]:
|
146
|
+
detail = self.store.detail.get({"symbol": symbol})
|
147
|
+
if not detail:
|
148
|
+
raise ValueError(f"Unknown LBank instrument: {symbol}")
|
149
|
+
return detail
|
150
|
+
|
151
|
+
@staticmethod
|
152
|
+
def _format_with_step(value: float, step: Any) -> str:
|
153
|
+
try:
|
154
|
+
step_float = float(step)
|
155
|
+
except (TypeError, ValueError): # pragma: no cover - defensive guard
|
156
|
+
step_float = 0.0
|
157
|
+
|
158
|
+
if step_float <= 0:
|
159
|
+
return str(value)
|
160
|
+
|
161
|
+
return fmt_value(value, step_float)
|
162
|
+
|
144
163
|
async def update_finish_order(
|
145
164
|
self,
|
146
165
|
*,
|
@@ -199,6 +218,14 @@ class Lbank:
|
|
199
218
|
offset_code = self._normalize_offset(offset_flag)
|
200
219
|
price_type_code, order_type_code = self._resolve_order_type(order_type)
|
201
220
|
|
221
|
+
detail_entry = self._get_detail_entry(symbol)
|
222
|
+
volume_str = self._format_with_step(volume, detail_entry.get("step_size"))
|
223
|
+
price_str: str | None = None
|
224
|
+
if price_type_code == "0":
|
225
|
+
if price is None:
|
226
|
+
raise ValueError("price is required for limit orders")
|
227
|
+
price_str = self._format_with_step(price, detail_entry.get("tick_size"))
|
228
|
+
|
202
229
|
payload: dict[str, Any] = {
|
203
230
|
# "ProductGroup": product_group,
|
204
231
|
"InstrumentID": symbol,
|
@@ -207,14 +234,12 @@ class Lbank:
|
|
207
234
|
"OffsetFlag": offset_code,
|
208
235
|
"OrderPriceType": price_type_code,
|
209
236
|
"OrderType": order_type_code,
|
210
|
-
"Volume":
|
237
|
+
"Volume": volume_str,
|
211
238
|
"orderProportion": order_proportion,
|
212
239
|
}
|
213
240
|
|
214
241
|
if price_type_code == "0":
|
215
|
-
|
216
|
-
raise ValueError("price is required for limit orders")
|
217
|
-
payload["Price"] = price
|
242
|
+
payload["Price"] = price_str
|
218
243
|
elif price is not None:
|
219
244
|
logger.warning("Price is ignored for market orders")
|
220
245
|
|
@@ -116,11 +116,11 @@ async def test_place():
|
|
116
116
|
async with pybotters.Client(apis='./apis.json') as client:
|
117
117
|
async with Lbank(client) as lb:
|
118
118
|
order = await lb.place_order(
|
119
|
-
"
|
119
|
+
"0GUSDT",
|
120
120
|
direction="buy",
|
121
121
|
order_type='limit_gtc',
|
122
|
-
price=
|
123
|
-
volume=
|
122
|
+
price=3.5342,
|
123
|
+
volume=4.176760504552669,
|
124
124
|
)
|
125
125
|
print(order)
|
126
126
|
|
@@ -251,4 +251,4 @@ async def test_order_sync_polling():
|
|
251
251
|
print(result)
|
252
252
|
|
253
253
|
if __name__ == "__main__":
|
254
|
-
asyncio.run(
|
254
|
+
asyncio.run(test_place())
|
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
|