Skip to main content
Connect using a Market Data credential with stream.read from an organisation with an eligible paid plan. Sign the upgrade with HMAC; your organisation must also have access to the venue. Create an account or manage access in Console.

Subscribe

Use the venue’s outcome token ID, not its event or market ID. On Predict.fun this is the outcome’s onChainId. Install ws (npm install ws), set BRAVADO_API_KEY, BRAVADO_API_SECRET and BRAVADO_ASSET_ID, then run this as a Node.js .mjs file. Keep the secret server-side.
Node.js
Subscribe to multiple tokens with a streams array. Unsubscribe with {"op":"unsub","streams":["book:<OUTCOME_TOKEN_ID>"]}. The authenticated route limits an organisation to 200 distinct assets across its keys and connections. An already-subscribed asset does not add another distinct asset to that quota. Data delivery consumes WebSocket credits. The sample closes after 30 seconds to bound usage. Generate a fresh signature and resubscribe on every reconnect; use backoff rather than retrying authentication failures continuously. Node’s ws responds to protocol pings automatically. The legacy /stream/{venue}/market and /orderbook-feed/ws routes have a separate Terminal access contract. Use the authenticated routes above for Console integrations and usage attribution.

Read the messages

Book frames include channel: "book", venue, asset, type, seq, ts and, for snapshots and deltas, bids and asks.
  • Each price level is [price, size], with both values encoded as decimal strings.
  • Both snapshots and deltas contain complete sides, not level patches. Replace the previous sides on each frame.
  • Bids are descending; asks are ascending. A transient crossed book is possible during venue updates.
  • Sequence numbers are per venue and asset. A snapshot resets local book state; do not infer ordering across venues.
  • ts is Bravado’s timestamp in milliseconds. upstreamTs is the venue timestamp when available, otherwise null.
  • Status frames distinguish live and degraded. Check reason; a connection or status frame alone does not mean a fresh book has arrived.
Reconnect and resubscribe after a disconnection. Do not display a buffered book as fresh while the stream is degraded.

Coverage

These routes serve live order books. Predict.fun subscriptions require an indexed binary market and its outcome token IDs. The enriched trade feed is a separate Polymarket feed; book changes are not executions. For historical L2 or bulk extracts, see historical data and custom delivery.