From 5566894e849383b8ba4f7a01d43e7ee8eb847f0d Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Mon, 25 May 2026 07:48:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20WS=20=E8=AE=A2=E9=98=85?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=EF=BC=9Atype=3Dsubscribe=20channel=3Dmarket?= =?UTF-8?q?=20=E5=AF=B9=E9=BD=90=E5=AE=98=E6=96=B9=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/data_collection/polymarket_ws_cache.py | 9 +++------ tests/test_polymarket_ws_cache.py | 8 ++++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/data_collection/polymarket_ws_cache.py b/src/data_collection/polymarket_ws_cache.py index 25b66d7d..8f5babcb 100644 --- a/src/data_collection/polymarket_ws_cache.py +++ b/src/data_collection/polymarket_ws_cache.py @@ -262,14 +262,11 @@ class PolymarketWsQuoteCache: batch = [asset_id for asset_id in asset_ids if asset_id] if not batch: return - payload = { + payload: Dict[str, Any] = { + "type": "subscribe", + "channel": "market", "assets_ids": batch, - "custom_feature_enabled": True, } - if initial: - payload["type"] = "market" - else: - payload["operation"] = "subscribe" await ws.send(json.dumps(payload)) def _handle_message(self, raw: Any) -> None: diff --git a/tests/test_polymarket_ws_cache.py b/tests/test_polymarket_ws_cache.py index bacddcb1..a08aadb3 100644 --- a/tests/test_polymarket_ws_cache.py +++ b/tests/test_polymarket_ws_cache.py @@ -113,12 +113,12 @@ def test_ws_cache_subscription_payloads_match_market_channel_shape(): asyncio.run(cache._send_subscription(ws, ["asset-2"], initial=False)) assert ws.messages[0] == { - "type": "market", + "type": "subscribe", + "channel": "market", "assets_ids": ["asset-1"], - "custom_feature_enabled": True, } assert ws.messages[1] == { - "operation": "subscribe", + "type": "subscribe", + "channel": "market", "assets_ids": ["asset-2"], - "custom_feature_enabled": True, }