Prediction Hunt/ API
WebSockets / Channels / Orderbook

Orderbook

WS·orderbook·Pro Tier+·KalshiPolymarketOpinion

Order book updates for subscribed markets (and markets resolved from group ids). Works for any market we ingest — matched and single-platform alike. Live pub/sub payloads may include full book arrays from the updater; snapshot messages after subscribe may use a compact top-of-book shape.

Overview

Use case: Maintain a live ladder or best bid/ask per market.

Requirements

  • Pro or Enterprise API key.
  • Subscribe with market_ids and/or group_ids.
  • No wildcard.

Send

FieldTypeRequiredNotes
actionstringyesMust be "subscribe" for this section.
channelstringyesMust be "orderbook".
market_idsstring[]optionalMarket scope; can be combined with group_ids.
group_idsnumber[]optionalGroup scope; expands to markets linked to each group.
wildcardbehaviornot availableAt least one supported id list should be provided.

Receive

Data messages use the standard envelope: channel, type, ts, data. Types for this channel include: orderbook_update.

After subscribe, the server sends cached snapshots in the same channel envelope. Merge snapshots first, then apply incremental updates in order. Shapes can differ slightly between snapshot hydration and live pub/sub — key off market_id and type. Markets we know about but haven't cached yet stay subscribed silently; UNKNOWN_ID fires only for ids we've never ingested.

Data fields (inside data)

FieldTypeDescription
typestringorderbook_update.
market_idstringPlatform market id.
sourcestringVenue identifier.
yes / noobjectSnapshot-style messages may nest bid/ask under yes and no.
bids / asksarray?Full book arrays may appear on live updates from the engine.