Polymarket WebSocket: Real-Time Price Streams and Channels (2026)
Polymarket’s WebSocket channels push live order-book updates, trades, and your own fills as they happen — no REST polling, no rate-limit burn, no lag between signal and execution. The standard bot pattern: subscribe to market channels for every book you trade, keep a user channel open for fills and position events, and on any disconnect resubscribe and reconcile against a REST snapshot before resuming.
Why stream instead of poll?
| Polling (REST) | Streaming (WebSocket) |
|---|---|
| Burns rate-limit budget | Zero polling cost |
| Snapshot latency = poll interval | Sub-second updates |
| Misses between-poll ticks | Full event history while connected |
| Simple failure model | Needs reconnect/reconcile logic |
For discovery and history, REST is right. For anything latency-sensitive — books, fills, perps marks — the stream is strictly better.
What channels exist?
Market channels (public, no auth):
- Book updates — level changes as they happen
- Price change events — best bid/ask movement
- Trades — public prints on the market
- Perps: mark price, funding rate, index updates
User channel (authenticated):
- Your order fills (including
liq: trueliquidation flags on perps) - Order status transitions
- Position and balance updates
What does a robust connection loop look like?
import websocket, json, time
def stream(token_ids, on_book):
url = "wss://ws-subscriptions-clob.polymarket.com/ws/market"
ws = websocket.create_connection(url)
ws.send(json.dumps({"assets_ids": token_ids, "type": "market"}))
while True:
try:
msg = json.loads(ws.recv())
for event in normalize(msg):
if event["type"] == "book":
on_book(event)
except (websocket.WebSocketConnectionClosedException, TimeoutError):
time.sleep(1)
ws = reconnect_and_resubscribe(token_ids) # then reconcile()
Three non-negotiables in production:
- Reconcile after reconnect — fetch a REST book snapshot and merge or replace local state; streams can drop events during the gap
- Heartbeat/timeout — detect dead connections fast; a silent socket is not a healthy socket
- Backpressure — process or queue messages; a bot that falls behind its own stream trades on stale state
How do perps streams differ?
Perps add channels that prediction markets don’t have: mark price updates,
funding-rate samples (the rolling 5-second premium), index price, and liquidation/
ADL events. The fills channel carries liq and adl flags — if your strategy
holds cross positions, an adl: true fill means you were force-reduced by someone
else’s liquidation, not by your own order.
What breaks most often?
- State drift after reconnects — no reconcile step; the bot trusts a stale local book
- Auth expiry on user channels — L2 credentials rotate; re-derive and resubscribe rather than retrying a dead session forever
- Single-socket overload — subscribing to thousands of markets on one socket; shard by category or activity
- Assuming delivery guarantees — streams are best-effort; money logic must confirm against REST (positions, balance) before acting
FAQ
Q: Does the Polymarket WebSocket require an API key? A: Market data channels are public. The user channel (your fills and orders) requires the same derived L2 credentials as authenticated REST calls.
Q: Can I rely on WebSocket messages alone for trading logic? A: For signal generation, yes. For state that moves money — balances, positions, open orders — confirm against REST snapshots; streams are best-effort delivery.
Q: How do I keep my book state accurate across reconnects? A: On reconnect, resubscribe and immediately fetch a REST book snapshot for each token, then apply stream deltas. Never resume trading on pre-disconnect state.
Q: What extra channels do perps streams have?
A: Mark price, funding samples and history, index price, and liquidation/ADL
events — including liq/adl flags on the fills channel.
Q: How many markets can one socket handle? A: Practically, shard: group markets by activity and use multiple connections rather than one mega-subscription; it bounds reconnect blast radius too.
Sources
Disclaimer
Not financial advice. Educational purposes only. Updated October 2026.