WebSocket APITopics
Trading status
Receive
Server
Subscribe with predictTradingStatus/{marketId}. The latest status is sent on subscribe.
header
x-api-key<api-key>The API key in the handshake's x-api-key header. Use this where you can.
const socket = new WebSocket("wss://ws.predict.fun/ws?apiKey=YOUR_API_KEY");socket.addEventListener("message", (event) => { console.log(event.data);});application/json
- payload
type*stringtopic*stringThe topic string the subscription was made with.
data*open
{ "type": "M", "topic": "predictTradingStatus/123", "data": { "kind": "tradingStatusUpdate", "tsMs": 1736696400000, "marketId": 123, "tradingStatus": "OPEN" }}Top of book
Subscribe with predictTopOfBook/{marketId}. Each message holds the best bid, the best ask and the last settled order, taken from the market's order book. A message is sent only when one of them changes, including the quantity at the best price. The latest value is sent on subscribe.
Market status
Subscribe with predictMarketStatus/{marketId}. The latest status is sent on subscribe.