> ## 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.

# Build with the Hyperliquid L4 Order Book 

*Published May 15, 2026*

![Build with the Hyperliquid L4 Order Book ](https://www.datocms-assets.com/86369/1780000651-02_build_with_the_hyperliquid_l4_order_book.jpg)

The GoldRush Hyperliquid WebSocket API now exposes a GoldRush-exclusive `l4Book` channel at `wss://hypercore.goldrushdata.com/ws` — an **order-level** view of the Hyperliquid book with no equivalent on the public Hyperliquid feed. A new [recipe page](/goldrush-hyperliquid/websocket-api/l4-book) shows how to maintain local book state, attribute flow by wallet, and reconstruct aggregated views from per-order detail.

## Why it's different from `l2Book`

* **Per-order visibility** - every entry is an individual order keyed by `oid`, carrying `user`, `cloid`, `tif`, `orderType`, and trigger metadata. `l2Book` only exposes `{px, sz, n}` aggregated per price level.
* **Snapshot then per-block diffs** - one full `Snapshot` of every resting order on subscribe, then `Updates` messages each block carrying `order_statuses` (lifecycle events) and `book_diffs` (per-order changes). Apply diffs against a local `Map<oid, Order>`.
* **GoldRush-native** - not exposed on `wss://api.hyperliquid.xyz/ws`. The `user` attribution and per-order metadata are surfaced only on the GoldRush endpoint.

## What you can build

The recipe walks through patterns end-to-end with TypeScript and Python code:

* **Track individual orders by `oid`** - use the Hyperliquid order id as the primary key in local state; index on `cloid` to correlate fills back to a specific bot's instructions.
* **Per-user flow attribution** - group resting size by `user` to surface market-maker behavior, spot spoofing patterns, or build per-trader heatmaps. Pair with `clearinghouseState` for position and margin context.
* **Reconstruct aggregated price levels** - sum `sz` across orders sharing a `limitPx` on the same `side` to produce an `l2Book`-style view from L4 data.
* **Reconnect handling** - drop local state and re-seed from the next `Snapshot`; the snapshot is authoritative and supersedes anything held before the disconnect.

[Learn more](https://goldrush.dev/docs/goldrush-hyperliquid/websocket-api/l4-book)
