l4Book channel on wss://hypercore.goldrushdata.com/ws?key=<GOLDRUSH_API_KEY> is a GoldRush-exclusive stream - it has no equivalent on wss://api.hyperliquid.xyz/ws. After subscribing, the server sends a single Snapshot of every resting order, then per-block Updates carrying lifecycle events and per-order book changes. Each order arrives with its user, oid, cloid, tif, and trigger metadata, so you can reconstruct queue position and price-time priority, attribute flow to specific wallets, and run microstructure analytics that l2Book’s aggregated {px, sz, n} view hides. For the raw subscription shape see the l4Book reference; for the connection model see the WebSocket API overview.
What you get
- Per-order visibility. Every level in the snapshot is an individual order keyed by
oid, withuser,cloid,tif,orderType, and trigger metadata attached.l2Bookonly exposes{px, sz, n}per price level. - Snapshot + diff transport. One full
Snapshoton subscribe, then per-blockUpdatescontainingorder_statuses(lifecycle events) andbook_diffs(per-order changes). Apply diffs to local state. - Per-block cadence. Updates fire on each HyperCore block where the book for the subscribed
coinchanged. Thetimeandblock_heightfields anchor each message to a specific block. - GoldRush-exclusive. Not available on the public Hyperliquid WebSocket - this stream surfaces user attribution and per-order metadata the public feed never exposes.
- One coin per subscription. Unlike
l2Book,coinis required. To cover multiple assets, open onel4Booksubscription per asset on the same connection.
Pair address format
Hyperliquid markets use a deployer-prefix naming scheme. The exact string differs by surface, so pass the value each API expects - matching is case- and format-sensitive.| Where it’s used | Format | Examples |
|---|---|---|
WebSocket coin (l2Book, l2BookDiff, l4Book) - canonical perps | <symbol> | BTC, ETH, HYPE |
WebSocket coin - HIP-3 builder markets | <deployer>:<symbol> | xyz:GOLD, flx:OIL |
Streaming pair_addresses (ohlcvCandlesForPair) | <deployer>:<symbol>-<quote>, or <symbol>-<quote> for canonical pairs | xyz:GOLD-USDC, flx:OIL-USDH, BTC-USDC |
Streaming token_addresses (ohlcvCandlesForToken) | <symbol> (no prefix) | GOLD, OIL, BTC |
deployer- wallet address of the HIP-3 builder that deployed the market. Omitted for canonical Hyperliquid markets.symbol- market ticker (e.g.GOLD,OIL).quote- the margin / quote currency, usuallyUSDC(some HIP-3 markets useUSDH).
HIP-4 outcome markets use a separate
#<encoding> scheme (e.g. #1230), not the deployer-prefix - see HIP-4 Markets.perpDexs Info API type) is on the roadmap. Until it ships, call metaAndAssetCtxs - the name field on each universe entry is the canonical pair address.
Subscribe and maintain book state
The pattern below keeps aMap<oid, Order> per coin. The snapshot seeds the map; each Updates message applies book_diffs against it. Reconnects drop the map and re-seed from the next snapshot.
Patterns
Track individual orders by oid
oid is the Hyperliquid order id, stable for the lifetime of the order - use it as the primary key in your local map. cloid is the client-supplied id (may be null); index on it when you need to correlate fills back to a specific trading bot’s instructions.
Per-user flow attribution
Every order entry carriesuser. Group orders by wallet to surface market-maker behavior, identify spoofing patterns, or build a per-trader heatmap of resting size. Pair this with clearinghouseState for per-user position and margin context.
TypeScript
Reconstruct aggregated price levels
If a downstream consumer expects anl2Book-style aggregated view, sum sz across all orders sharing a limitPx on the same side. Going the other way isn’t possible - l2Book collapses the per-order detail you’d lose.
TypeScript
Handling reconnects
On reconnect, resend the samesubscribe payload. The first message back is always a fresh Snapshot - drop your local orders map and re-seed from it. Do not attempt to replay missed Updates - the snapshot is authoritative and supersedes anything you held before the disconnect.
TypeScript
Related
l4BookAPI reference - full subscription, snapshot, and update schema.l2Bookreference - aggregated price-level snapshots when per-order detail isn’t needed.- WebSocket API overview - endpoint URL, auth, and limits.
clearinghouseState- pair per-user resting orders with position and margin state.