hyperquant 1.39__tar.gz → 1.41__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 (44) hide show
  1. {hyperquant-1.39 → hyperquant-1.41}/PKG-INFO +1 -1
  2. {hyperquant-1.39 → hyperquant-1.41}/pyproject.toml +1 -1
  3. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/models/polymarket.py +11 -3
  4. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/polymarket.py +35 -9
  5. {hyperquant-1.39 → hyperquant-1.41}/uv.lock +1 -1
  6. {hyperquant-1.39 → hyperquant-1.41}/.gitignore +0 -0
  7. {hyperquant-1.39 → hyperquant-1.41}/README.md +0 -0
  8. {hyperquant-1.39 → hyperquant-1.41}/requirements-dev.lock +0 -0
  9. {hyperquant-1.39 → hyperquant-1.41}/requirements.lock +0 -0
  10. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/__init__.py +0 -0
  11. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/auth.py +0 -0
  12. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/bitget.py +0 -0
  13. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/bitmart.py +0 -0
  14. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/coinw.py +0 -0
  15. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/deepcoin.py +0 -0
  16. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/edgex.py +0 -0
  17. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/hyperliquid.py +0 -0
  18. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/lbank.py +0 -0
  19. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/lib/edgex_sign.py +0 -0
  20. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/lib/hpstore.py +0 -0
  21. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/lib/hyper_types.py +0 -0
  22. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/lib/util.py +0 -0
  23. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/lighter.py +0 -0
  24. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/models/apexpro.py +0 -0
  25. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/models/bitget.py +0 -0
  26. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/models/bitmart.py +0 -0
  27. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/models/coinw.py +0 -0
  28. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/models/deepcoin.py +0 -0
  29. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/models/edgex.py +0 -0
  30. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/models/hyperliquid.py +0 -0
  31. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/models/lbank.py +0 -0
  32. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/models/lighter.py +0 -0
  33. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/models/ourbit.py +0 -0
  34. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/ourbit.py +0 -0
  35. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/broker/ws.py +0 -0
  36. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/core.py +0 -0
  37. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/datavison/_util.py +0 -0
  38. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/datavison/binance.py +0 -0
  39. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/datavison/coinglass.py +0 -0
  40. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/datavison/okx.py +0 -0
  41. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/db.py +0 -0
  42. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/draw.py +0 -0
  43. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/logkit.py +0 -0
  44. {hyperquant-1.39 → hyperquant-1.41}/src/hyperquant/notikit.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyperquant
3
- Version: 1.39
3
+ Version: 1.41
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 = "1.39"
3
+ version = "1.41"
4
4
  description = "A minimal yet hyper-efficient backtesting framework for quantitative trading"
5
5
  authors = [
6
6
  { name = "MissinA", email = "1421329142@qq.com" }
@@ -18,7 +18,9 @@ class Position(DataStore):
18
18
  _KEYS = ["asset", "outcome"]
19
19
 
20
20
  def _on_response(self, msg: Item) -> None:
21
- self._update(msg)
21
+ if msg:
22
+ self._clear()
23
+ self._update(msg)
22
24
 
23
25
  def on_trade(self, trade: Item) -> None:
24
26
  status = str(trade.get("status") or "").upper()
@@ -223,7 +225,7 @@ class MyTrade(DataStore):
223
225
  class Trade(DataStore):
224
226
  """User trades keyed by trade id."""
225
227
 
226
- _KEYS = ["asset_id"]
228
+ _KEYS = ["transactionHash"]
227
229
  _MAXLEN = 500
228
230
 
229
231
 
@@ -914,7 +916,13 @@ class PolymarketDataStore(DataStoreCollection):
914
916
  self.fill._on_trade(m)
915
917
  self.position.on_trade(m)
916
918
  elif msg_type == 'orders_matched':
917
- self.trade._on_message(m)
919
+ payload = m.get("payload") or {}
920
+ if not payload:
921
+ continue
922
+ trade_msg = dict(payload)
923
+ if "asset_id" not in trade_msg and "asset" in trade_msg:
924
+ trade_msg["asset_id"] = trade_msg["asset"]
925
+ self.trade._on_message(trade_msg)
918
926
 
919
927
  def onmessage_for_bbo(self, msg: Any, ws: ClientWebSocketResponse | None = None) -> None:
920
928
  # 判定msg是否为list
@@ -156,7 +156,7 @@ class Polymarket:
156
156
  token_ids: Sequence[str] | str | None = None,
157
157
  limit: int | None = None,
158
158
  funder: str | None = None,
159
-
159
+ event_id: str | None = None
160
160
  ) -> None:
161
161
  """Refresh cached data using Polymarket REST endpoints."""
162
162
 
@@ -195,6 +195,9 @@ class Polymarket:
195
195
  if include_position or include_history_position:
196
196
  funder = funder or self.funder
197
197
  path = '/positions' if include_position else '/closed-positions'
198
+ params = {"user": funder, 'sizeThreshold': 0.1}
199
+ if event_id:
200
+ params.update({'eventId': event_id})
198
201
  tasks.append(
199
202
  (
200
203
  "position",
@@ -202,7 +205,7 @@ class Polymarket:
202
205
  self._rest(
203
206
  "GET",
204
207
  path,
205
- params={"user": funder},
208
+ params=params,
206
209
  host=DEFAULT_DATA_ENDPOINT
207
210
  )
208
211
  ),
@@ -392,25 +395,27 @@ class Polymarket:
392
395
  {
393
396
  "topic": "activity",
394
397
  "type": "orders_matched",
398
+ "filters": json.dumps({"event_slug": slug}, separators=(',', ':'))
395
399
  # "filters": "{\"event_slug\":\"btc-updown-15m-1762951500\"}"
396
- "filters": f'{{"event_slug":"{slug}"}}'
397
400
  }
398
401
  ]
399
402
  }
400
-
403
+ print(payload)
401
404
  def callback(msg, ws):
405
+ if not msg:
406
+ return
402
407
  try:
403
- # self.store.onmessage(msg, ws)
404
408
  data = json.loads(msg)
405
- self.store.onmessage(data, ws)
406
- except Exception:
407
- pass
409
+ except json.JSONDecodeError:
410
+ return
411
+
412
+ self.store.onmessage(data, ws)
408
413
 
409
414
 
410
415
  wsapp = self.client.ws_connect(
411
416
  RTS_DATA_ENDPOINT,
412
417
  hdlr_str=callback,
413
- heartbeat=30
418
+ heartbeat=5
414
419
  )
415
420
  await wsapp._event.wait()
416
421
  await wsapp.current_ws.send_json(payload)
@@ -1171,6 +1176,27 @@ class Polymarket:
1171
1176
  return await self._signed_request_via_session("DELETE", "/cancel-market-orders", body)
1172
1177
 
1173
1178
  async def get_order(self, order_id: str) -> Any:
1179
+ """
1180
+ {
1181
+ "id": "0x4c47db1458b36d535106cdb450f20a27f4ec6ba458b9a86dc4a69afb8a81215c",
1182
+ "status": "MATCHED",
1183
+ "owner": "d6dba4d1-b21d-4272-ab9a-5ef8e8bf23bb",
1184
+ "maker_address": "0x03C3B0236c5a01051381482E77f2210349073A1d",
1185
+ "market": "0x42dc093dfcdd9ba2962baab1bb5de6c7209b14ed5d3d1f7d19dec12c14cbb489",
1186
+ "asset_id": "16982568567216474731533472146787083736159238827774998324575366977332426392345",
1187
+ "side": "BUY",
1188
+ "original_size": "1.8518",
1189
+ "size_matched": "1.85185",
1190
+ "price": "0.54",
1191
+ "outcome": "Up",
1192
+ "expiration": "0",
1193
+ "order_type": "FOK",
1194
+ "associate_trades": [
1195
+ "e16c9c49-7f4e-492e-9cb0-8778e54ad38a"
1196
+ ],
1197
+ "created_at": 1763701801
1198
+ }
1199
+ """
1174
1200
  return await self._rest("GET", f"/data/order/{order_id}")
1175
1201
 
1176
1202
  async def get_orders(self, params: Mapping[str, Any] | None = None) -> list[Any]:
@@ -945,7 +945,7 @@ wheels = [
945
945
 
946
946
  [[package]]
947
947
  name = "hyperquant"
948
- version = "1.38"
948
+ version = "1.4"
949
949
  source = { editable = "." }
950
950
  dependencies = [
951
951
  { name = "aiohttp" },
File without changes
File without changes
File without changes