hyperquant 1.41__tar.gz → 1.42__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-1.41 → hyperquant-1.42}/PKG-INFO +1 -1
- {hyperquant-1.41 → hyperquant-1.42}/pyproject.toml +1 -1
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/models/polymarket.py +41 -33
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/polymarket.py +10 -3
- {hyperquant-1.41 → hyperquant-1.42}/uv.lock +1 -1
- {hyperquant-1.41 → hyperquant-1.42}/.gitignore +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/README.md +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/requirements-dev.lock +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/requirements.lock +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/__init__.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/auth.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/bitget.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/bitmart.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/coinw.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/deepcoin.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/edgex.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/hyperliquid.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/lbank.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/lib/edgex_sign.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/lib/hpstore.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/lib/hyper_types.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/lib/util.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/lighter.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/models/apexpro.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/models/bitget.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/models/bitmart.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/models/coinw.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/models/deepcoin.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/models/edgex.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/models/hyperliquid.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/models/lbank.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/models/lighter.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/models/ourbit.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/ourbit.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/broker/ws.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/core.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/datavison/_util.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/datavison/binance.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/datavison/coinglass.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/datavison/okx.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/db.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/draw.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/logkit.py +0 -0
- {hyperquant-1.41 → hyperquant-1.42}/src/hyperquant/notikit.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hyperquant
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.42
|
|
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
|
|
@@ -225,17 +225,22 @@ class MyTrade(DataStore):
|
|
|
225
225
|
class Trade(DataStore):
|
|
226
226
|
"""User trades keyed by trade id."""
|
|
227
227
|
|
|
228
|
-
_KEYS = ["
|
|
228
|
+
_KEYS = ["hash"]
|
|
229
229
|
_MAXLEN = 500
|
|
230
230
|
|
|
231
|
-
|
|
232
231
|
def _on_message(self, msg: dict[str, Any]) -> None:
|
|
233
232
|
payload = msg or {}
|
|
234
233
|
if payload:
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
234
|
+
if payload.get("event_type") == "last_trade_price":
|
|
235
|
+
transaction_hash = payload.get("transaction_hash")
|
|
236
|
+
if transaction_hash:
|
|
237
|
+
payload.update({"hash": transaction_hash})
|
|
238
|
+
payload.pop("transaction_hash", None)
|
|
239
|
+
else:
|
|
240
|
+
if payload.get("transactionHash"):
|
|
241
|
+
payload.update({"hash": payload.get("transactionHash")})
|
|
242
|
+
payload.pop("transactionHash", None)
|
|
243
|
+
|
|
239
244
|
self._insert([payload])
|
|
240
245
|
|
|
241
246
|
class Book(DataStore):
|
|
@@ -861,33 +866,25 @@ class PolymarketDataStore(DataStoreCollection):
|
|
|
861
866
|
_key asset
|
|
862
867
|
MATCHED进行快速捕捉
|
|
863
868
|
.. code:: json
|
|
864
|
-
|
|
865
|
-
"
|
|
866
|
-
"
|
|
867
|
-
"
|
|
868
|
-
"
|
|
869
|
-
"
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
}
|
|
878
|
-
],
|
|
879
|
-
"market": "0xbd31dc8a20211944f6b70f31557f1001557b59905b7738480ca09bd4532f84af",
|
|
880
|
-
"matchtime": "1672290701",
|
|
881
|
-
"outcome": "YES",
|
|
882
|
-
"owner": "9180014b-33c8-9240-a14b-bdca11c0a465",
|
|
883
|
-
"price": "0.57",
|
|
869
|
+
{
|
|
870
|
+
"asset": "12819879685513143002408869746992985182419696851931617234615358342350852997413",
|
|
871
|
+
"bio": "",
|
|
872
|
+
"conditionId": "0xea609d2c6bc2cb20e328be7c89f258b84b35bbe119b44e0a2cfc5f15e6642b3b",
|
|
873
|
+
"eventSlug": "btc-updown-15m-1763865000",
|
|
874
|
+
"icon": "https://polymarket-upload.s3.us-east-2.amazonaws.com/BTC+fullsize.png",
|
|
875
|
+
"name": "infusion",
|
|
876
|
+
"outcome": "Up",
|
|
877
|
+
"outcomeIndex": 0,
|
|
878
|
+
"price": 0.7,
|
|
879
|
+
"profileImage": "",
|
|
880
|
+
"proxyWallet": "0x2C060830B6F6B43174b1Cf8B4475db07703c1543",
|
|
881
|
+
"pseudonym": "Frizzy-Graduate",
|
|
884
882
|
"side": "BUY",
|
|
885
|
-
"size":
|
|
886
|
-
"
|
|
887
|
-
"
|
|
888
|
-
"
|
|
889
|
-
"
|
|
890
|
-
"type": "TRADE"
|
|
883
|
+
"size": 5,
|
|
884
|
+
"slug": "btc-updown-15m-1763865000",
|
|
885
|
+
"timestamp": 1763865085,
|
|
886
|
+
"title": "Bitcoin Up or Down - November 22, 9:30PM-9:45PM ET",
|
|
887
|
+
"hash": "0xddea11d695e811686f83379d9269accf1be581fbcb542809c6c67a3cc3002488"
|
|
891
888
|
}
|
|
892
889
|
"""
|
|
893
890
|
return self._get("trade")
|
|
@@ -912,7 +909,7 @@ class PolymarketDataStore(DataStoreCollection):
|
|
|
912
909
|
elif msg_type == "order":
|
|
913
910
|
self.orders._on_message(m)
|
|
914
911
|
elif msg_type == "trade":
|
|
915
|
-
self.
|
|
912
|
+
self.mytrade._on_message(m)
|
|
916
913
|
self.fill._on_trade(m)
|
|
917
914
|
self.position.on_trade(m)
|
|
918
915
|
elif msg_type == 'orders_matched':
|
|
@@ -934,3 +931,14 @@ class PolymarketDataStore(DataStoreCollection):
|
|
|
934
931
|
msg_type = str(raw_type).lower()
|
|
935
932
|
if msg_type in {"book", "price_change"}:
|
|
936
933
|
self.bbo._on_message(m)
|
|
934
|
+
|
|
935
|
+
def onmessage_for_last_trade(self, msg, ws = None):
|
|
936
|
+
# 判定msg是否为list
|
|
937
|
+
lst_msg = msg if isinstance(msg, list) else [msg]
|
|
938
|
+
for m in lst_msg:
|
|
939
|
+
raw_type = m.get("event_type") or m.get("type")
|
|
940
|
+
if not raw_type:
|
|
941
|
+
continue
|
|
942
|
+
msg_type = str(raw_type).lower()
|
|
943
|
+
if msg_type == "last_trade_price":
|
|
944
|
+
self.trade._on_message(m)
|
|
@@ -333,6 +333,7 @@ class Polymarket:
|
|
|
333
333
|
token_ids: Sequence[str] | str,
|
|
334
334
|
wsapp: pybotters.ws.WebSocketApp | None = None,
|
|
335
335
|
only_bbo: bool = False,
|
|
336
|
+
with_trades: bool = False
|
|
336
337
|
) -> pybotters.ws.WebSocketApp:
|
|
337
338
|
"""Subscribe to public order-book updates for the provided token ids."""
|
|
338
339
|
|
|
@@ -341,11 +342,14 @@ class Polymarket:
|
|
|
341
342
|
if wsapp:
|
|
342
343
|
await wsapp.current_ws.send_json(payload)
|
|
343
344
|
hdrl_json = self.store.onmessage_for_bbo if only_bbo else self.store.onmessage
|
|
345
|
+
hd_lst = [hdrl_json]
|
|
346
|
+
if with_trades:
|
|
347
|
+
hd_lst.append(self.store.onmessage_for_last_trade)
|
|
344
348
|
|
|
345
349
|
self._ws_public = self.client.ws_connect(
|
|
346
350
|
self.ws_public,
|
|
347
351
|
send_json=payload,
|
|
348
|
-
hdlr_json=
|
|
352
|
+
hdlr_json=hd_lst
|
|
349
353
|
)
|
|
350
354
|
await self._ws_public._event.wait()
|
|
351
355
|
return self._ws_public
|
|
@@ -388,7 +392,7 @@ class Polymarket:
|
|
|
388
392
|
return self._ws_personal
|
|
389
393
|
|
|
390
394
|
async def sub_trades(self, slug: str):
|
|
391
|
-
|
|
395
|
+
"""订阅activate trades"""
|
|
392
396
|
payload = {
|
|
393
397
|
"action": "subscribe",
|
|
394
398
|
"subscriptions": [
|
|
@@ -420,7 +424,10 @@ class Polymarket:
|
|
|
420
424
|
await wsapp._event.wait()
|
|
421
425
|
await wsapp.current_ws.send_json(payload)
|
|
422
426
|
return wsapp
|
|
423
|
-
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
|
|
424
431
|
# ------------------------------------------------------------------
|
|
425
432
|
# Public REST endpoints
|
|
426
433
|
|
|
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
|