Credit Cost
1 per coin per minute
Processing
Realtime
- GoldRush-native.
l4BookUpdatesis not exposed onwss://api.hyperliquid.xyz/ws. Pointing a client at the public endpoint with this subscription type will fail. - Order-level (L4) diffs. Like
l4Book, every change is per individual order (user,oid,side,raw_book_diff) plus the order-lifecycleorder_statusesfor the block — not aggregated price levels. - Strictly block-ordered. Diffs are emitted synchronously in monotonic
block_heightorder. This is the difference froml4Book, whose per-block broadcast can deliver adjacent blocks out of order. Thel4Bookchannel is unchanged;l4BookUpdatesis the strictly-ordered, sequenced sibling. - Diff-only — no inline snapshot. This stream never sends a
Snapshotframe; every message is anUpdatesbatch. Seed your local book from the RESTl4BookSnapshotinfo method, then apply diffs on top — see Bootstrapping & gap detection. - Sequenced for gap detection. Each per-coin diff carries a monotonic
seqand theprev_seqit follows; each batch carries a serverepochand acursor. This lets a client detect a dropped message or a server reset and re-bootstrap deterministically. - Perps only. No spot or prediction-market assets.
coinis required — subscribe with a single symbol or an array of symbols; one asset per book.
l4BookUpdates bills a flat rate per subscribed coin per minute, with no BTC premium (unlike l4Book). A multi-coin array bills the sum across its coins.
Endpoint
string
required
Your GoldRush API key. Passed as a query parameter at connection time - no
Authorization header is used.Subscribe
Send this JSON message after the connection is established:string
required
Always
"subscribe".object
required
Example
Unsubscribe
Send the samesubscription body with method: "unsubscribe":
Unsubscribe matches subscriptions by exact body. A subscription created with
coin: ["BTC", "ETH"] is a different subscription from one created with coin: "BTC". To narrow a multi-coin set, unsubscribe the original coin array in full, then resubscribe with the smaller list.Streamed messages
Every message haschannel: "l4BookUpdates" and a data payload containing an Updates batch (this stream never emits a Snapshot). An Updates batch is emitted on each HyperCore block where the book for at least one subscribed coin changed. Each per-coin entry carries the block’s order_statuses (order lifecycle events) and book_diffs (per-order changes) for that coin, plus its own seq/prev_seq.
raw_book_diff descriptor is one of:
{ "new": { "sz": "<size>" } }— a newly resting order.{ "update": { "origSz": "<old>", "newSz": "<new>" } }— a resize (e.g. partial fill)."remove"— the order left the book (filled or cancelled).
Bootstrapping & gap detection
l4BookUpdates is diff-only, so you build the order-level book yourself by seeding from a snapshot and applying diffs in order — the same mechanism a reference L4 client uses:
- Subscribe to
l4BookUpdatesfor your coin(s) and start buffering the incomingUpdates. - Fetch a snapshot for each coin from the REST
l4BookSnapshotinfo method. Note itsheight,epoch, and per-coinseq. - Discard already-applied diffs. Drop any buffered batch whose
block_heightis ≤ the snapshot’sheight(the snapshot already includes those blocks). Equivalently, per coin, drop any diff whoseseq≤ the snapshot’sseq. - Verify the epoch. Every remaining diff’s
epochmust equal the snapshot’sepoch. A differentepochmeans the stream reset after your snapshot — re-fetch the snapshot and restart. - Apply in order. For each coin, the first diff you apply should have
prev_seq == snapshot.seq. For eachraw_book_diff, insert (new), resize (update), or delete (remove) the order byoid. - Ongoing gap detection. Per coin, each diff’s
prev_seqmust equal the lastseqyou applied for that coin. On a mismatch (a dropped message) or anepochchange (a server reset), re-bootstrap that coin from step 2.
Response fields
string
Always
"l4BookUpdates".object
Contains an
Updates batch.Related endpoints
l4Book
subscribe to GoldRush’s order-level Hyperliquid book - initial snapshot of every resting order plus per-block diffs with full metadata.
l4BookSnapshot
fetch a full order-level (L4) book snapshot for one coin, with height, epoch, and seq to bootstrap the l4BookUpdates stream.
l2BookDiff2
subscribe to a diff-only L2 order book stream with per-coin sequence numbers and a server epoch for gap detection.