Skip to main content
This page covers subscribing to price and orderbook updates with subscribe_market_prices, and the newPriceData and orderbookUpdate payloads that subscription delivers.

Subscribing to market data

Subscribe to price and orderbook updates by emitting subscribe_market_prices:
Subscriptions replace previous ones. If you want both AMM prices and CLOB orderbook, send both marketAddresses and marketSlugs together in a single call.

Initial snapshot

Right after the system acknowledgement, the server emits one orderbookUpdate per CLOB slug in your subscription with the full current book. This happens on every subscribe_market_prices call, including a re-subscribe over a live connection, and it covers every slug in the new set, not only the ones you added. A market with no resting orders still gets its snapshot: bids and asks are empty arrays and midpoint is 0.5. The snapshot carries the same orderbook object as GET /markets/{slug}/orderbook minus lastTradePrice, so you can seed local state from the socket alone. Two cases do not produce a snapshot:
  • A slug that does not resolve to a market. It is listed in the acknowledgement’s markets array and joined, but no book is sent.
  • A resolved market. It is dropped from markets and nothing is sent. If every requested slug is resolved you get an error event instead.
If a slug you expect is missing after the acknowledgement, fetch it over REST. A re-subscribe replaces the previous subscription, so there is a brief gap in live frames between the two calls. The snapshots that follow close it: replace your local copy of each book with its snapshot, and use version to discard any live frame that arrives with a lower value (see orderbookUpdate). AMM addresses receive an initial newPriceData the same way, with blockNumber set to 0, when a price is available.

Event payloads

newPriceData

Live update (updatedPrices is an array; there is no top-level marketAddress):
Initial snapshot (one per subscribed address after the system acknowledgement; blockNumber is 0 and updatedPrices is a single object):
yesPrice and noPrice are JSON numbers between 0 and 1. On live frames read the market from updatedPrices[i].marketAddress.
Looking for individual events? orderbookUpdate is market-wide state, not an event feed. For discrete events:
  • Your own orders, in real time — subscribe_order_events. One event per lifecycle change, authenticated, and it only ever carries your own orders.
  • Every mined trade in a market — Get Market Events. Public, newest first, paginated. Cached, so not real time, and mined trades only: no placements or cancellations.
There is no public WebSocket stream of every trade in a market. Market-wide over WebSocket is the coalesced book only.

orderbookUpdate

Emitted for CLOB markets when the book changes (new bids/asks, removals, or fills). orderbook carries the full updated book. Each side is a sorted array of price levels. Updates are coalesced: several changes in quick succession arrive as a single message, so on a busy market one frame can represent several fills. Each message is the resulting book, not a list of what changed, so replace your local copy with what arrives rather than diffing consecutive messages or counting frames as events.
Live frames may also carry a side field on each level.
price and size are JSON numbers; coerce defensively to preserve decimal precision. size is in raw 6-decimal units on the initial snapshot and on every later frame, so divide by 1e6 to get shares; price is not scaled. For a one-shot snapshot, use GET /markets/{slug}/orderbook, which returns the same shape and units, except that REST sends minSize and maxSpread as decimal strings. Accept either form. You also receive this message once per CLOB slug immediately after subscribe_market_prices, carrying the current book (see Initial snapshot).
  • WebSocket overview: connection details, handshake authentication, and the full event reference