BBO (Best Bid/Offer) - Top of Book
Stream the best bid and best ask for any Hyperliquid trading pair. BBO gives you the top-of-book price with minimal bandwidth — ideal for price tracking, execution triggers, and spread monitoring.
How It Works
There is no dedicated BBO method or channel. To get best-bid/best-ask data, you subscribe to l2Book with nLevels=1. This returns exactly one bid and one ask level — functionally identical to a BBO feed. Everything on this page uses the standard l2Book subscription; the only difference from a full order book is setting nLevels to 1.
Stream the best bid and best ask for any trading pair with minimal bandwidth — ideal for price tracking, execution triggers, and spread monitoring. The nLevels parameter is a Dwellir-specific optimisation not available on the public Hyperliquid API.
Code Examples Repository
Clone our complete examples: github.com/dwellir-public/hyperliquid-orderbook-server-code-examples
How to Subscribe
Send a subscription message to the WebSocket endpoint:
{
"method": "subscribe",
"subscription": {
"type": "l2Book",
"coin": "BTC",
"nSigFigs": 5,
"nLevels": 1
}
}Subscription Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
type | string | Yes | - | Must be "l2Book" |
coin | string | Yes | - | Trading pair symbol (e.g., "BTC", "ETH", "xyz:MSTR", "@150") |
nSigFigs | number | No | 5 | Price precision: use 5 for full granularity (recommended for BBO) |
nLevels | number | No | 20 | Set to 1 to receive only the best bid and best ask |
HIP3 Markets
For HIP3 (permissionless perpetuals) markets, use the full coin label format with the xyz: prefix. For example, use "xyz:MSTR" for the MicroStrategy perpetual, not just "MSTR". Standard perpetuals like BTC and ETH do not require a prefix.
Spot Markets
For spot markets, use the @{index} format where the index is the spot asset index. For example, use "@150" for a specific spot market.
Why nSigFigs=5 for BBO
nSigFigs=5 gives full price precision with no rounding or aggregation. This matches what the public Hyperliquid bbo channel returns natively. Lower values aggregate prices and may not reflect the true best level.
| nSigFigs | BTC Example | Effect |
|---|---|---|
| 5 | $106,217 | Most granular - individual price points |
| 4 | $106,200 | Moderate aggregation |
| 3 | $106,000 | Coarse aggregation |
| 2 | $110,000 | Very coarse - major levels only |
For BBO use cases, always use nSigFigs=5 to ensure you receive the true best bid and ask.
The first websocket message after subscribing is a subscriptionResponse; subsequent messages carry the l2Book payloads.
Response Field Reference
| Field | Type | Description |
|---|---|---|
channel | string | Always "l2Book" for this subscription type |
data.coin | string | Trading pair symbol |
data.time | number | Unix timestamp in milliseconds |
data.levels | array | Two-element array: [bids, asks] — each containing exactly one level object |
levels[0] | array | Best bid (highest buy price) |
levels[1] | array | Best ask (lowest sell price) |
Level Object Fields
| Field | Type | Description |
|---|---|---|
px | string | Price level |
sz | string | Total size at this price level |
n | number | Number of orders aggregated at this level |
Dwellir BBO vs Public Hyperliquid BBO
The public Hyperliquid API has a dedicated bbo WebSocket channel, but our approach uses l2Book with nLevels=1 which produces equivalent results.
The public API does not support nLevels on l2Book — it always returns all 20 levels. nLevels is a Dwellir-specific parameter.
We tested l2Book(nLevels=1, nSigFigs=5) against the public bbo channel and confirmed 100% price match across BTC, ETH, and SOL.
| Source | bid_px | ask_px | Format |
|---|---|---|---|
Dwellir l2Book(nLevels=1) | "85.426" | "85.427" | Same |
Public Hyperliquid bbo | "85.426" | "85.427" | Same |
Public Hyperliquid l2Book (top) | "85.426" | "85.427" | Same |
Size Differences
Sizes (sz) may differ slightly between any two connections due to update timing — this is expected and applies to any two independent WebSocket connections.
Use Cases
Price Feeds & Tickers
Display live mid-price or last price with minimal data overhead.
Spread Monitoring
Track bid-ask spread in real-time for market quality assessment.
Execution Triggers
Fire orders when the best bid or ask crosses a threshold.
Multi-Coin Dashboards
Subscribe to BBO for many coins simultaneously with low bandwidth (1 level per coin vs 20).
Latency-Sensitive Strategies
Smaller payloads = faster parsing. BBO messages are ~10x smaller than full 20-level book updates.
Subscription Management
Switching Between BBO and Full Depth
# Subscribe to BBO
await websocket.send(json.dumps({
"method": "subscribe",
"subscription": {"type": "l2Book", "coin": "BTC", "nSigFigs": 5, "nLevels": 1}
}))
# Later, switch to full depth (20 levels)
await websocket.send(json.dumps({
"method": "unsubscribe",
"subscription": {"type": "l2Book", "coin": "BTC", "nLevels": 1}
}))
await websocket.send(json.dumps({
"method": "subscribe",
"subscription": {"type": "l2Book", "coin": "BTC", "nSigFigs": 5, "nLevels": 20}
}))Get Access
Ready to integrate real-time Hyperliquid BBO data?
- Volume Calculator - Estimate monthly message volume
- Contact Sales - Get your WebSocket credentials
- Dashboard - Manage your subscription
Stream institutional-grade Hyperliquid order book data with Dwellir's ultra-low latency infrastructure.
L2 Order Book
Stream aggregated Level 2 order book data from Hyperliquid. Real-time bid/ask levels with configurable depth and price aggregation.
L4 Order Book
Stream Level 4 order book data from Hyperliquid with individual order visibility. Access user addresses, order IDs, timestamps, and full order parameters.