Connection
Connect to the PredictIt WebSocket endpoint:Subscribing to markets
Once connected, send a JSON message to subscribe usingmarket_id:
Unsubscribing
Message types
Price messages
Full example
Important notes
- Authentication required via
api_keyquery parameter - Prices only — PredictIt does not provide orderbook depth or individual trade history
- PredictIt data is sourced via REST polling (60-second intervals)
- Only emits updates when market state changes (last trade price, best bid/ask)
- Use
market_id(PredictIt market identifier) to subscribe

