Order Book
Real-time futures order book: snapshot plus incremental updates, or grouped snapshots.
Use this stream to keep a local copy of a pair's order book. On the native price grid you get one snapshot followed by deltas; with a grouping step you get a full snapshot on every update.
Endpoint
wss://futures-marketdata-service.outpoll.com/ws/book/depthThe connection supports permessage-deflate compression; most WebSocket clients enable it automatically.
Authentication
No authentication required.
Message Envelope
Every data frame has the same fields. A delta is recognised by the presence of pu.
pi
string
Pair ID, as a string (for example "1")
a
array
Ask levels, [price, size], best (lowest) price first
b
array
Bid levels, [price, size], best (highest) price first
t
integer
Book time, epoch ms
u
integer
Update ID of this book state
pu
integer
Delta only: update ID of the state this delta applies to
Message Types
subscribe / unsubscribe
Client → Server
Start or stop a pair, set depth and grouping
Snapshot
Server → Client
Full book, trimmed to dp levels per side. No pu
Delta
Server → Client
Changed levels only. Has pu. Native grid only
Error
Server → Client
{"er", "msg"} — see Errors
ping / pong
Both
Plain-text keep-alive
Subscribe
With price grouping:
act
string
Yes
subscribe
pi / ps
integer / array
Yes
Pair ID, or list of pair IDs; dp and g apply to every pair in the frame
dp
integer
No
Levels per side, default 20. The native book holds a fixed number of levels per pair; a larger dp returns all of them
g
number
No
Price grouping step. Omit, or send 0, for the native tick grid
Server confirmation: there is no confirmation frame — the first frame after subscribing is the pair's snapshot.
all: true is not supported on this stream; subscribe by pair ID.
To change dp or g, send subscribe again for the same pair. The next frame is a fresh snapshot with the new settings.
Native Grid: Snapshot and Deltas
Without g, the book is on the pair's tick size.
Notes
Update IDs increase but are not consecutive — check
puagainst your lastu, neveruagainst lastu + 1.Deltas are not trimmed to
dp: they carry every changed level of the native book. Keep the full book locally and cut it todpwhen you display it.Levels inside a delta are addressed by price; their order in the array carries no meaning.
When nothing changed, no frame is sent.
If the server cannot deliver a delta to your connection, the next frame you receive is a new snapshot. Treat any frame without
puas a reset.
Grouped: Full Snapshots
With a positive g, levels are merged into price buckets of size g, and every frame is a full snapshot (no pu, no deltas). Replace your local book with each frame.
Ask prices are rounded up to the bucket, bid prices rounded down; sizes in one bucket are summed.
Each side has
dprows.Frames follow the same cadence as the native book.
How g is applied
g sent
Result
Absent, 0 or negative
Native grid with deltas
More than 8 decimal places, or more than 18 integer digits
Error invalid_group; the pair is served on the native grid
Smaller than or equal to the tick size
Tick size, as full snapshots
Not a multiple of the tick size
Rounded down to a multiple of the tick size
Larger than tick size × 1,000,000
Capped at tick size × 1,000,000
Example for a pair with tick size 0.1: g = 0.25 becomes 0.2, g = 0.01 becomes 0.1.
Snapshot Payload
pi
string
Pair ID
a
array
Asks [price, size], ascending by price
b
array
Bids [price, size], descending by price
t
integer
Book time, epoch ms
u
integer
Update ID
Delta Payload
pi
string
Pair ID
a
array
Changed asks [price, size]; size 0 = remove the level
b
array
Changed bids [price, size]; size 0 = remove the level
t
integer
Book time, epoch ms
u
integer
Update ID after applying this delta
pu
integer
Update ID this delta builds on
Python Example
Was this helpful?

