Skip to main content
WSS
/
v1
/
orderbook

Documentation Index

Fetch the complete documentation index at: https://docs.openpx.trade/llms.txt

Use this file to discover all available pages before exploring further.

Messages
Snapshot
type:object

Full orderbook snapshot. Caller should replace any cached book keyed by (market_id, asset_id). market_id is the parent market on every exchange; asset_id is the per-outcome identifier (Polymarket token, Kalshi ticker). Emitted on initial subscribe and after any BookInvalidated / Clear recovery path.

Delta
type:object

Incremental change to an existing book. Apply in-place, or discard if the caller has seen a matching Clear / BookInvalidated without a follow-up Snapshot yet.

Clear
type:object

Book invalidation on the same stream as Snapshot / Delta, so a consumer can say "seq N was Clear, drop anything with seq ≤ N, wait for the next Snapshot" without merging with the session stream. Mirrors SessionEvent::BookInvalidated, which stays as the connection-level signal for global observability.

Connected
type:object

Initial socket establishment.

Reconnected
type:object

Socket re-established after an observed outage. gap_ms is the wall-clock interval between the last received message and this event. Callers who maintain per-market books should discard them and wait for the next WsUpdate::Snapshot for each subscribed market.

Lagged
type:object

Outbound dispatch channel overflowed — a slow consumer missed deltas. Unlike tokio::sync::broadcast which silently skips ahead, openpx raises this explicitly and invalidates every affected book, because a missed delta corrupts book state in a way the caller cannot detect from the stream alone.

BookInvalidated
type:object

A specific market's book is no longer trustworthy. Caller should discard its cache for that market_id and wait for the next WsUpdate::Snapshot.

Error
type:object

A non-fatal error observed on the connection. The session continues; the caller is informed in case they want to log or alert.

Subscribe
type:object

Add to the active orderbook subscription set

Unsubscribe
type:object

Remove from the active orderbook subscription set