> ## Documentation Index
> Fetch the complete documentation index at: https://docs.0xarchive.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Hyperliquid WebSocket Streaming API

> Stream Hyperliquid order books, trades, and L4 order events live over WebSocket, or replay archived windows on the same socket at up to 300x speed.

0xArchive runs one WebSocket surface for Hyperliquid with two modes: subscribe to live channels, or replay an exact historical window in original sequence on the same socket, with the same channel names and the same message shapes. A backtest and a live client run identical code paths, and replay speed scales by plan from 10x to 300x, from 500x on Enterprise.

```javascript theme={"theme":"github-dark"}
ws.send(JSON.stringify({ op: "subscribe", channel: "orderbook", symbol: "BTC" }));
```

<CardGroup cols={2}>
  <Card title="Connect" icon="plug" href="/websocket/connection">
    Open the socket, authenticate, keep it alive, reconnect cleanly.
  </Card>

  <Card title="Channels" icon="radio" href="/websocket/channels">
    The full channel and symbol matrix by venue family.
  </Card>
</CardGroup>

## Stream The Hyperliquid Order Book

The `orderbook` channel streams aggregated (L2) depth updates for core perp symbols such as `BTC` and `ETH`. Spot, HIP-3, and HIP-4 use venue-prefixed channels (`spot_orderbook`, `hip3_orderbook`, `hip4_orderbook`) with their own symbol shapes; Lighter is a separate venue family with `lighter_orderbook` and an order-level `lighter_l3_orderbook`.

## L2 Book Streaming And L4 Book Streaming

Pick the depth by the downstream job, not by habit:

| Need                       | Channel     | What arrives                                                             |
| -------------------------- | ----------- | ------------------------------------------------------------------------ |
| Aggregated depth (L2 book) | `orderbook` | Price levels with size, live or replayed                                 |
| Order-level book (L4)      | `l4_diffs`  | Per-order book changes for local-state maintenance                       |
| Order events               | `l4_orders` | Placements, fills, cancels, and status changes, including trigger orders |
| Fill stream                | `trades`    | Executions as they happen                                                |

L2 and L4 channels are available on every tier, including Free. For stateful L4 workflows, [WebSocket L4 order book](/websocket/l4-orderbook) covers snapshots, diffs, gaps, and rebuilds.

## Replay History On The Same Socket

Replay sends historical data over the WebSocket at a controlled speed, in original sequence. The command names the channel, symbol, window, and speed:

```javascript theme={"theme":"github-dark"}
ws.send(JSON.stringify({
  op: "replay",
  channel: "orderbook",
  symbol: "BTC",
  start: 1681516800000,
  end: 1681603200000,
  speed: 10
}));
```

The server answers with `replay_started`, a `replay_snapshot` baseline, ordered `historical_data` messages, and `replay_completed` at the end of the window. `gap_detected` marks missing intervals so the client can stop or rebuild instead of silently corrupting local state. Controls are `replay.pause`, `replay.resume`, `replay.seek`, and `replay.stop`. Full command and event shapes live in [WebSocket replay](/websocket/replay) and the [message schema](/websocket/schema).

## Replay Speed And Subscriptions By Plan

| Plan       | Max replay speed | Max subscriptions |
| ---------- | ---------------- | ----------------- |
| Free       | 10x              | 10                |
| Build      | 50x              | 500               |
| Pro        | 100x             | 3,000             |
| Scale      | 300x             | 20,000            |
| Enterprise | from 500x        | Unlimited         |

Every tier gets WebSocket access and every channel family. Higher tiers raise the caps; see [WebSocket tier limits](/websocket/tier-limits) for connection counts and bulk streaming.

## Low Latency You Can Measure

Latency intent deserves a number, not an adjective. `/v1/data-quality/latency` returns current API, WebSocket, and freshness latency measurements per venue family, so a latency-sensitive client can check the live figure before and during a job instead of trusting marketing copy. Pair it with `/v1/data-quality/status` for per-family `last_data_at` and `latency_ms`.

## History Behind The Stream

Live channels answer what is happening now; replay answers what happened, in order. Hyperliquid native L2 order books and trades reach back to April 2023. Order-level (L4) surfaces start March 2026. That archive is what replay draws from, so a strategy can be tested against years of event cadence with the same handler code that will run live. For reproducible runs, store the replay window, speed, gap events, and output state as [WebSocket backtesting](/websocket/backtesting) describes.

## When To Use This Surface

Use WebSocket when sequence matters: local books, monitors, strategy harnesses, incident review, and backtests that react to event cadence. Use REST when one snapshot or one bounded historical window answers the question; it is simpler to retry and audit. If the job is a bounded data pull that later becomes a stream, start with [Replay and reconstruction](/core-concepts/replay-and-reconstruction) to pick the primitive before writing client code.

## Next Step

Open [WebSocket connection](/websocket/connection) to get a socket up, pick channels in [WebSocket channels](/websocket/channels), then run one bounded replay from [WebSocket replay](/websocket/replay). For research workflows, continue to [WebSocket backtesting](/websocket/backtesting) and [Point-in-time backtesting](/guides/point-in-time-backtesting).
