> For the complete documentation index, see [llms.txt](https://docs.coinmarketman.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coinmarketman.com/order-book-data.md).

# Order Book Data

Stream the live Hyperliquid order book, from the best bid and ask down to every individual resting order.

Order Book Data streams live Hyperliquid market data over WebSocket: best bid and offer, aggregated price levels (L2), and every resting order (L4). It is built for market makers, trading software, quant research, and analytics platforms that need a live view of liquidity.

Typical use cases:

* **Depth dashboards:** live depth, spreads, and imbalances.
* **Market making and execution:** the best bid and ask in real time.
* **Order flow analysis:** individual orders and the wallet behind each one (L4).
* **Local book replicas:** rebuild the book from a snapshot and a stream of updates.

### **What you can stream**

<table data-search="false"><thead><tr><th width="190.6927490234375">Stream</th><th width="194.125">Channel</th><th>What you receive</th></tr></thead><tbody><tr><td>Best bid/offer</td><td><code>bbo:&#x3C;coin></code></td><td>Best bid and best ask with price, total size, and order count. Published when the BBO changes.</td></tr><tr><td>Mid price</td><td><code>mids:&#x3C;coin></code></td><td>Mid price for one market. Published when the mid changes.</td></tr><tr><td>All mid prices</td><td><code>allmids:stream</code></td><td>The mid price of every market. One message right after you subscribe, then a complete replacement map whenever at least one mid changes.</td></tr><tr><td>Trades</td><td><code>trades:&#x3C;coin></code></td><td>Trade batches for one market, with the aggressor side and both counterparties. Only trades after you subscribe.</td></tr><tr><td>Full L2 book</td><td><code>l2book:&#x3C;coin></code></td><td>A complete snapshot of the book on every block. Each message replaces the previous one.</td></tr><tr><td>L2 snapshot + diffs</td><td><code>l2bookdiff:&#x3C;coin></code></td><td>One complete snapshot, then only the price levels that changed. A later snapshot replaces your local state.</td></tr><tr><td>L4 order book</td><td><code>l4book:&#x3C;coin></code></td><td>A snapshot of every resting order, then order-level updates.</td></tr></tbody></table>

`<coin>` is part of the channel name. Each subscription covers one market, except `allmids:stream`.

### Which one to use

* **Top of book** (`bbo`, `mids`, `allmids`): you only need the current price.
* **L2** (`l2book`, `l2bookdiff`): you need depth per price level. `l2book` is simpler, since every message replaces the last. `l2bookdiff` sends only changed levels, but you must apply every diff.
* **L4** (`l4book`): you need every resting order, its wallet, and its place in the queue.

### **How Order Book Data differs from Fills and Orders**

<table data-search="false"><thead><tr><th>Topic</th><th>Fills, Account Events, TWAPs (rooms:*)</th><th>Orders (orders:feed)</th><th>Order Book Data</th></tr></thead><tbody><tr><td>Filtering</td><td>Tag filter in <code>tf</code></td><td>Filter in <code>data</code></td><td>No filters. The market is part of the channel name.</td></tr><tr><td>L2 depth and aggregation</td><td>Not applicable</td><td>Not applicable</td><td>Selectors in the subscribe <code>data</code> (L2 channels only)</td></tr><tr><td>Replay</td><td>Yes, short window</td><td>No</td><td>No</td></tr><tr><td>Added metadata</td><td><code>id</code>, <code>blockNumber</code>, <code>blockTime</code>, <code>localTime</code>, <code>sentTime</code></td><td>Same</td><td>No <code>id</code>, <code>blockNumber</code>, <code>blockTime</code>, <code>localTime</code>, or <code>sentTime</code>. Most channels carry time. L2 diffs and L4 also carry height.</td></tr><tr><td>Ordering and deduplication</td><td>By <code>id</code></td><td>By <code>id</code></td><td><code>height</code> for L2 diffs and L4, <code>coin</code> and <code>tid</code> for trades.</td></tr><tr><td>After a disconnect</td><td>Replay, or REST history for larger gaps</td><td>REST history, then live</td><td>Resubscribe. <code>allmids</code>, <code>l2book</code>, <code>l2bookdiff</code>, and <code>l4book</code> start again with a snapshot. <code>bbo</code>, <code>mids</code>, and <code>trades</code> resume with the next live publication.</td></tr></tbody></table>

### **Order Book Data and Order Data snapshots**

Order Data provides 5-minute snapshots of all open orders through the REST API, with a rolling 30-day window and exports back to January 19, 2026. Order Book Data streams individual markets live.

* Use **Order Data** for exchange-wide and historical analysis of open orders.
* Use **Order Book Data** when you need to follow the book of a market as it changes.

At the same block, L4 contains the same resting orders as an Order Data snapshot, minus untriggered stop and take profit orders.

### **Supported markets**

Use the canonical, case-sensitive market name, for example `BTC`, `xyz:GOLD`, or `@107` for a spot market. Spot markets are available on every channel. Market names that contain reserved characters must be encoded. See [Getting Started](https://docs.coinmarketman.com/order-book-data/getting-started.md).

### **Plan limits and availability**

Surge, Flow, and Stream include WebSocket access and Order Book Data. Free and Pulse do not, and connecting is rejected with error `1080` (`WS_NOT_ENTITLED`). On Enterprise, WebSocket access is set up per contract. Which channels each plan includes is listed under Stream availability per plan.

Access starts as soon as your plan is active. Connect with the API key from your dashboard. You do not need to contact us.

### **Limits per plan**

| Plan       | Concurrent connections | Active subscriptions | Client messages per minute | Order book streams |
| ---------- | ---------------------- | -------------------- | -------------------------- | ------------------ |
| Pulse      | X                      | X                    | X                          | X                  |
| Surge      | 10                     | 100                  | 300                        | 5                  |
| Flow       | 50                     | 1,000                | 1,500                      | 25                 |
| Stream     | 250                    | 10,000               | 6,000                      | 100                |
| Enterprise | Custom                 | Custom               | Custom                     | Custom             |

* Client messages per minute: subscribe requests across your account. Bursts up to your subscription limit are allowed, so you can resubscribe to everything after a reconnect. Over the limit you get `1087`, which tells you how many seconds to wait. After 600 rejected messages in a minute, the connection is closed with `4586`.
* New connections are limited to twice your connection limit per minute (`1088`).

#### How limits are counted

**One order book stream is one market on one channel, on one connection.** For example, `l2book:BTC` is one stream. `l2book:BTC`, `l2bookdiff:BTC`, and `l4book:BTC` are three streams. The same market on two connections counts as two streams. `nSigFigs`, `mantissa`, and `nLevels` do not affect the count.

<table data-search="false"><thead><tr><th>Channel</th><th>Counts as an order book stream</th><th>Counts as a subscription</th></tr></thead><tbody><tr><td><code>bbo</code></td><td>Yes</td><td>Yes</td></tr><tr><td><code>l2book</code></td><td>Yes</td><td>Yes</td></tr><tr><td><code>l2bookdiff</code></td><td>Yes</td><td>Yes</td></tr><tr><td><code>l4book</code></td><td>Yes</td><td>Yes</td></tr><tr><td><code>mids</code></td><td>No</td><td>Yes</td></tr><tr><td><code>trades</code></td><td>No</td><td>Yes</td></tr><tr><td><code>allmids</code></td><td>No</td><td>Yes</td></tr><tr><td><code>rooms:fills</code>, <code>rooms:misc_events</code>, <code>rooms:twaps</code></td><td>No</td><td>Yes, one each</td></tr><tr><td><code>orders:feed</code></td><td>No</td><td>Yes, one per address in the filter. An address filter is required.</td></tr></tbody></table>

* A second connection counts toward the connection limit, including one opened only to use a different L2 setting for a market you already follow. Its subscriptions also count.
* Closed connections and subscriptions are released within about 2.5 minutes, not immediately. If you reconnect right after closing, the old connection can still be counted for a short time.
* When a limit is exceeded, the connection or subscription is rejected with an error. Limit errors are temporary: once a slot is free, the same request succeeds. See [Errors](https://docs.coinmarketman.com/order-book-data/getting-started.md#errors).

### **Stream availability per plan**

<table data-search="false"><thead><tr><th>Channel</th><th>Surge</th><th>Flow</th><th>Stream</th><th>Enterprise</th></tr></thead><tbody><tr><td><code>bbo</code></td><td>Yes</td><td>Yes</td><td>Yes</td><td>Per contract</td></tr><tr><td><code>l2book</code></td><td>Yes</td><td>Yes</td><td>Yes</td><td>Per contract</td></tr><tr><td><code>l2bookdiff</code></td><td>Yes</td><td>Yes</td><td>Yes</td><td>Per contract</td></tr><tr><td><code>l4book</code></td><td>No</td><td>No</td><td>Yes</td><td>Per contract</td></tr><tr><td><code>mids</code></td><td>Yes</td><td>Yes</td><td>Yes</td><td>Per contract</td></tr><tr><td><code>trades</code></td><td>Yes</td><td>Yes</td><td>Yes</td><td>Per contract</td></tr><tr><td><code>allmids</code></td><td>No by default</td><td>No by default</td><td>No by default</td><td>Per contract</td></tr><tr><td>Fills, Account Events, TWAPs</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Per contract</td></tr><tr><td>Orders</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Per contract</td></tr></tbody></table>

* **Yes:** Included in your plan.
* **No:** Not included. Subscribing is rejected with `1084`.
* **No by default:** Available on request. Until enabled, subscribing is rejected with `1084`.
* **Per contract:** Set in your Enterprise agreement.

Fills, Account Events, and TWAPs are always enabled together. To request a channel, contact us in our [Telegram group](https://t.me/HyperTrackerio), on [Discord](https://discord.gg/FaXVPH6YVN), or at <support@coinmarketman.com>.

{% hint style="info" %}
A connection can subscribe to a given channel only once. To use two different L2 selector sets on the same channel, open a second connection.
{% endhint %}

For current plan prices and request limits, see [Rate Limits & Pricing](https://docs.coinmarketman.com/endpoints/rate-limits-and-pricing).

**Get started**

1. **Get access.** Choose Surge, Flow, or Stream. Access starts as soon as your plan is active.
2. **Authenticate once per connection.** Use the API key from your dashboard, the same key as for the REST API. See [Authentication](https://docs.coinmarketman.com/websocket-streams/authentication.md).
3. **Subscribe.** Pick a channel from the table above. Subscription details, error codes, and complete client examples are in [Getting Started](https://docs.coinmarketman.com/order-book-data/getting-started.md).

{% tabs %}
{% tab title="JavaScript" %}
{% code expandable="true" %}

```
// npm install centrifuge
import { Centrifuge } from 'centrifuge';

const client = new Centrifuge('wss://jp-ws.hypertracker.io/connection/websocket', {
  websocket: globalThis.WebSocket,
  data: { token: API_KEY },
});
client.on('disconnected', (ctx) => console.error(ctx.code, ctx.reason));

const sub = client.newSubscription('bbo:BTC');
sub.on('publication', (ctx) => console.log(ctx.data.channel, ctx.data.data));
sub.on('error', (ctx) => console.error(ctx.error?.message ?? ctx.error));
sub.subscribe();
client.connect();
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code expandable="true" %}

```
# pip install centrifuge-python
import asyncio
import os

from centrifuge import Client, SubscriptionEventHandler

API_KEY = os.environ["API_KEY"]


class SubHandler(SubscriptionEventHandler):
    async def on_publication(self, ctx):
        envelope = ctx.pub.data
        print(envelope["channel"], envelope["data"])

    async def on_error(self, ctx):
        print("subscription error:", ctx.error)


async def main():
    client = Client(
        "wss://jp-ws.hypertracker.io/connection/websocket",
        data={"token": API_KEY},
    )
    sub = client.new_subscription("bbo:BTC", events=SubHandler())
    await client.connect()
    await sub.subscribe()
    await asyncio.Event().wait()


asyncio.run(main())
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### **Explore Order Book Data**

| Page                                                                                 | Contents                                                                        |
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------- |
| [Getting Started](https://docs.coinmarketman.com/order-book-data/getting-started.md) | Connection, message format, subscribing, error codes, recovery, client examples |
| [Market Streams](https://docs.coinmarketman.com/order-book-data/market-streams.md)   | BBO, mid prices, all mids, trades                                               |
| [L2 Order Book](https://docs.coinmarketman.com/order-book-data/l2-order-book.md)     | Full L2 snapshots, L2 snapshot and diffs, selectors, book reconstruction        |
| [L4 Order Book](https://docs.coinmarketman.com/order-book-data/l4-order-book.md)     | Order-level snapshots and updates, large snapshot assembly                      |

#### **Enterprise Solutions**

Need higher limits, dedicated infrastructure, or an SLA? We scope enterprise setups directly with your team.

**Email:** <support@coinmarketman.com>\
**Telegram:** <https://t.me/HyperTrackerio>\
**Discord:** <https://discord.gg/FaXVPH6YVN> \
**X:** <https://x.com/HyperTracker>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.coinmarketman.com/order-book-data.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
