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.
Files changed (49) hide show
  1. {hyperquant-0.67 → hyperquant-0.68}/PKG-INFO +1 -1
  2. {hyperquant-0.67 → hyperquant-0.68}/pyproject.toml +1 -1
  3. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/lbank.py +29 -4
  4. {hyperquant-0.67 → hyperquant-0.68}/tests/test_lbank.py +4 -4
  5. {hyperquant-0.67 → hyperquant-0.68}/uv.lock +1 -1
  6. {hyperquant-0.67 → hyperquant-0.68}/.gitignore +0 -0
  7. {hyperquant-0.67 → hyperquant-0.68}/.python-version +0 -0
  8. {hyperquant-0.67 → hyperquant-0.68}/README.md +0 -0
  9. {hyperquant-0.67 → hyperquant-0.68}/apis.json +0 -0
  10. {hyperquant-0.67 → hyperquant-0.68}/data/alpine_smoke.log +0 -0
  11. {hyperquant-0.67 → hyperquant-0.68}/data/logs/notikit.log +0 -0
  12. {hyperquant-0.67 → hyperquant-0.68}/data/logs/test_order_sync.log +0 -0
  13. {hyperquant-0.67 → hyperquant-0.68}/data/records_swap.csv +0 -0
  14. {hyperquant-0.67 → hyperquant-0.68}/data/records_swapc.csv +0 -0
  15. {hyperquant-0.67 → hyperquant-0.68}/doc/edgex_act.md +0 -0
  16. {hyperquant-0.67 → hyperquant-0.68}/doc/edgex_debug.md +0 -0
  17. {hyperquant-0.67 → hyperquant-0.68}/doc/edgex_order.md +0 -0
  18. {hyperquant-0.67 → hyperquant-0.68}/doc/edgex_ws.md +0 -0
  19. {hyperquant-0.67 → hyperquant-0.68}/doc/lbank.md +0 -0
  20. {hyperquant-0.67 → hyperquant-0.68}/pub.sh +0 -0
  21. {hyperquant-0.67 → hyperquant-0.68}/requirements-dev.lock +0 -0
  22. {hyperquant-0.67 → hyperquant-0.68}/requirements.lock +0 -0
  23. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/__init__.py +0 -0
  24. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/auth.py +0 -0
  25. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/edgex.py +0 -0
  26. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/hyperliquid.py +0 -0
  27. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/lib/edgex_sign.py +0 -0
  28. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/lib/hpstore.py +0 -0
  29. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/lib/hyper_types.py +0 -0
  30. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/lib/util.py +0 -0
  31. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/models/edgex.py +0 -0
  32. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/models/hyperliquid.py +0 -0
  33. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/models/lbank.py +0 -0
  34. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/models/ourbit.py +0 -0
  35. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/ourbit.py +0 -0
  36. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/broker/ws.py +0 -0
  37. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/core.py +0 -0
  38. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/datavison/_util.py +0 -0
  39. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/datavison/binance.py +0 -0
  40. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/datavison/coinglass.py +0 -0
  41. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/datavison/okx.py +0 -0
  42. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/db.py +0 -0
  43. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/draw.py +0 -0
  44. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/logkit.py +0 -0
  45. {hyperquant-0.67 → hyperquant-0.68}/src/hyperquant/notikit.py +0 -0
  46. {hyperquant-0.67 → hyperquant-0.68}/tests/test_draw.py +0 -0
  47. {hyperquant-0.67 → hyperquant-0.68}/tests/test_edgex.py +0 -0
  48. {hyperquant-0.67 → hyperquant-0.68}/tests/test_ourbit.py +0 -0
  49. {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.67
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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hyperquant"
3
- version = "0.67"
3
+ version = "0.68"
4
4
  description = "A minimal yet hyper-efficient backtesting framework for quantitative trading"
5
5
  authors = [
6
6
  { name = "MissinA", email = "1421329142@qq.com" }
@@ -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": str(volume),
237
+ "Volume": volume_str,
211
238
  "orderProportion": order_proportion,
212
239
  }
213
240
 
214
241
  if price_type_code == "0":
215
- if price is None:
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
- "SOLUSDT",
119
+ "0GUSDT",
120
120
  direction="buy",
121
121
  order_type='limit_gtc',
122
- price=180.0,
123
- volume=0.03,
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(test_order_sync_polling())
254
+ asyncio.run(test_place())
@@ -530,7 +530,7 @@ wheels = [
530
530
 
531
531
  [[package]]
532
532
  name = "hyperquant"
533
- version = "0.66"
533
+ version = "0.67"
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
File without changes
File without changes
File without changes
File without changes
File without changes