WebSocket APITopics

Order book

Receive
/ws
Server

Subscribe with predictOrderbook/{marketId}. Each message is the whole book. The latest book is sent on subscribe.

Authorization

headerx-api-key<api-key>

The API key in the handshake's x-api-key header. Use this where you can.

Code Sample
const socket = new WebSocket("wss://ws.predict.fun/ws?apiKey=YOUR_API_KEY");socket.addEventListener("message", (event) => {  console.log(event.data);});

Messages

application/json
  1. payload
type*string
topic*string

The topic string the subscription was made with.

data*
book
{  "type": "M",  "topic": "predictOrderbook/123",  "data": {    "version": 1,    "marketId": 123,    "updateTimestampMs": 1736696400000,    "orderCount": 42,    "asks": [      [        0.62,        1500      ],      [        0.63,        800      ]    ],    "bids": [      [        0.61,        2000      ],      [        0.6,        1200      ]    ],    "lastOrderSettled": {      "id": "987654321",      "price": "0.62",      "kind": "LIMIT",      "marketId": 123,      "side": "Ask",      "outcome": "Yes"    },    "settlementsPending": {      "asks": [        [          0.62,          310        ]      ],      "bids": []    }  }}