TheDocumentation Index
Fetch the complete documentation index at: https://goldrush.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
l2Book channel on wss://hypercore.goldrushdata.com/ws?key=<GOLDRUSH_API_KEY> is wire-equal to the public Hyperliquid feed but with coin made optional and the per-IP subscription cap removed. This recipe shows how to turn that stream into common trading and analytics building blocks. For the raw subscription shape see the l2Book reference; for the connection model see the WebSocket API overview.
What you get
- Complete snapshots, not diffs. Every
l2Bookmessage contains the currenttime,coin, and a full[bids, asks]tuple in best-first order, withpx/sz/nper level. Consume each message in isolation - no sequence numbers to track, no diff replay buffer, no REST snapshot to bootstrap. - Self-healing on packet loss. Drop a message, reconnect mid-session, or restart your process - the next message arrives with the full book state, so your in-memory view is correct on the very next tick.
- Upstream-compatible aggregation knobs.
nSigFigsaccepts2,3,4,5, ornull(full precision).mantissaaccepts1,2, or5, and is only valid whennSigFigsis5. - Wildcard coverage. Omit
cointo stream every asset’s book over a single subscription, instead of fanning out one subscription per asset.
Subscribe and hold book state
The pattern below keeps aMap<coin, snapshot> in memory. Each incoming message replaces the entry for its coin, so the map is always current and never needs reconciliation.
Patterns
Top-of-book tracker
Readbids[0] and asks[0] directly from each message. The spread is Number(asks[0].px) - Number(bids[0].px). No state required - every message is self-contained, so a single-line transformation gives you a live ticker.
Depth-weighted mid quote
Sumpx * sz across the first K levels on each side, then average. This produces a fair-value mid that’s robust to thin top-of-book liquidity, and is useful as a hedging or pricing reference.
TypeScript
Slippage / impact estimator
Walk levels on the relevant side until cumulativesz covers the requested notional. Return the size-weighted average fill price - the difference vs the top-of-book is your expected slippage.
TypeScript
Liquidity heatmap
On each message, append[time, coin, side, px, sz] rows to your time-series store (Clickhouse, TimescaleDB, Parquet). Because every message is a complete snapshot of the top levels, the heatmap rebuilds correctly from any contiguous slice of history - you don’t need a separate “initial book” record to seed the visualisation.
Handling reconnects
Reconnect logic is a one-liner: open a new socket and resend the samesubscribe payload. The first message after subscribe is a full book snapshot, so your books map is correct on the next tick - there’s nothing to replay, nothing to buffer, and no sequence numbers to reconcile against a separately-fetched REST snapshot.
TypeScript
Related
l2BookAPI reference - full subscription and message schema.- WebSocket API overview - endpoint URL, auth, and limits.
clearinghouseState- pair the live book with per-account position and margin state.- OHLCV pairs stream - candles instead of raw book state.