Documentation Index
Fetch the complete documentation index at: https://goldrush.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
Credit Cost
0.1 per coin per minute
Processing
Realtime
- GoldRush-native.
l2BookDiffis not exposed onwss://api.hyperliquid.xyz/ws. Pointing a client at the public endpoint with this subscription type will fail. - Snapshot, then diffs. The first message is always a
Snapshot; every message thereafter is anUpdates. Clients must seed local book state from the snapshot and apply diffs from there. On reconnect, drop local state and re-seed from the next snapshot. coinis optional. Omit it to stream the entire L2 order book across every asset on a single subscription.- When
coinis omitted, the optionalmarketTypesfilter selects which market families to include. It defaults to["perp"]only. - Pass
"marketTypes": ["spot"], or"marketTypes":["outcome"], or a mix (e.g."marketTypes": ["perp","spot"]), or use the wildcard"marketTypes": ["*"]to opt into spot, perps, outcome, and any future market types. - No 1000-subscription-per-IP cap - multiplex hundreds of
l2BookDiffsubscriptions on a single connection. - For OHLCV candles instead of raw book state, use the Streaming API OHLCV streams.
coin is omitted, a credit rate of 10 credits per minute subscribed is applied.
Endpoint
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:Always
"subscribe".Example
Pick the subscription shape that matches the coverage you want. Every subscription starts with oneSnapshot per coin in scope, then per-block Updates carrying only changed levels:
| Subscribe with | What you receive |
|---|---|
{"type":"l2BookDiff","coin":"HYPE"} | Snapshot + diffs for HYPE only |
{"type":"l2BookDiff","coin":["HYPE","BTC","ETH"]} | Snapshot + diffs for a fixed list of coins |
{"type":"l2BookDiff"} | Snapshot + diffs for every perp coin (default: marketTypes: ["perp"]) |
{"type":"l2BookDiff","marketTypes":["spot"]} | Snapshot + diffs for every spot coin |
{"type":"l2BookDiff","marketTypes":["outcome"]} | Snapshot + diffs for every HIP-4 outcome market |
{"type":"l2BookDiff","marketTypes":["perp","spot"]} | Snapshot + diffs for perps + spot |
{"type":"l2BookDiff","marketTypes":["*"]} | Snapshot + diffs for every coin (perp + spot + outcome, plus future types) |
Unsubscribe
Send the samesubscription body with method: "unsubscribe":
Streamed messages
Every message haschannel: "l2BookDiff". The data payload contains exactly one of two variants: a Snapshot (emitted once per subscribed coin, immediately after subscribe) or an Updates (emitted on each subsequent HyperCore block where the book for at least one subscribed coin changed).
Initial snapshot
After subscribe, the server emits oneSnapshot message per coin currently in scope. For a single-coin subscription that is one message; for a list or wildcard subscription that is one message per asset. Each entry in levels[0] (bids) and levels[1] (asks) is an aggregated price level, sorted best-first.
Incremental updates
Subsequent messages carry only the levels that changed since the previous block, grouped by coin. A level entry withsz: "0" and n: 0 means the level at that price has been removed; any other entry replaces the current state at that px with the new {sz, n}.
Response fields
Always
"l2BookDiff".Contains exactly one of
Snapshot or Updates.