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

# GoldRush-Exclusive: Hyperliquid L2 Order Book Diffs

*Published May 21, 2026*

![GoldRush-Exclusive: Hyperliquid L2 Order Book Diffs](https://www.datocms-assets.com/86369/1780000651-01_goldrush-exclusive_hyperliquid_l2_order_book_diffs.jpg)

The GoldRush Hyperliquid WebSocket API now exposes a GoldRush-exclusive `l2BookDiff` channel at `wss://hypercore.goldrushdata.com/ws` that provides an initial snapshot followed by per-block diffs of Hyperliquid’s aggregated L2 book, with no equivalent on the public Hyperliquid feed. A new [recipe](https://goldrush.dev/docs/goldrush-hyperliquid/websocket-api/l2-book-diff) page shows how to build cross-asset depth dashboards, market scanners, and arbitrage engines on one coin, a fixed list, or every Hyperliquid asset, with bandwidth proportional to what changed each block, not the size of the book.

## Why it's different from `l2Book`

* **Snapshot then per-block diffs** - one full `Snapshot` per subscribed coin on `subscribe`, then `Updates` messages each block carrying only the price levels that moved. `l2Book` in contrast re-sends the full book on every tick.
* **Bandwidth proportional to change** - quiet markets cost almost nothing on the wire; only changed levels arrive instead of a full re-snapshot every tick. Pricing reflects this.
* **Multi-coin and wildcard on one subscription** - `coin` accepts a single asset, an array, or can be omitted. When omitted, `marketTypes` defaults to `["perp"]`; pass `["spot"]`, `["outcome"]`, a mix, or `["*"]` to opt into spot, outcome, and any future market types.
* **GoldRush-native** - not exposed on `wss://api.hyperliquid.xyz/ws`. Public Hyperliquid has no L2-diff transport at all.

## What you can build

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

* **Maintain a `Map<coin, Book>` from diffs** - apply each `book_diff` against per-side `Map<px, Level>` state: an entry with `sz: "0"` deletes the level, anything else replaces it. Same `{px, sz, n}` shape as `l2Book`, so existing aggregated-book types carry over and you only add a level-apply function.
* **Single coin, fixed list, or wildcard** - one handler, only the subscribe payload changes. List and wildcard subscriptions receive one `Snapshot` per live coin before diffs begin, so the books map fills in over the first few messages rather than all at once.
* **Reconstruct a top-of-book stream** - after each diff is applied, best bid is the highest `px` in `book.bids` and best ask the lowest in `book.asks`; cache and update only when an incoming diff touches or improves the current best.

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