allMids
Stream mid prices for every market, updated every block. Requires add-on permission.
Every live data message includes both routing identifiers with the same value:
{"type": "allMids", "channel": "allMids"}Other payload fields are omitted above. Existing clients may continue routing on either field.
Stream mid prices ((best_bid + best_ask) / 2) for every market in a single subscription, updated every block (~70ms). Hyperliquid-compatible: clients that read data.mids work unchanged.
To minimize bandwidth, allMids sends only the coins whose mid changed on each block (a delta). The first message after subscribing is a full snapshot (isSnapshot: true); after that you receive changed-only deltas. The per-subscription seq is gap-free, so a seq jump signals a dropped message — reconnect to receive a fresh snapshot and resync. Apply each message by merging its mids into your local map.
For top-of-book bid/ask sizes use bbo; for full depth use l2Book; for mark/oracle/open-interest use allActiveAssetCtx.
Subscribe
{
"method": "subscribe",
"subscription": {
"type": "allMids"
}
}With filters:
{
"method": "subscribe",
"subscription": {
"type": "allMids",
"dex": "xyz",
"marketTypes": ["perp", "spot", "outcome"]
}
}Parameters:
dex
string
No
Filter by DEX prefix. "main" returns native coins (BTC, ETH, …); other values (e.g. "xyz") return only coins with that prefix (xyz:SP500). Omit for all DEXes.
marketTypes
string[]
No
Restrict to specific market types. Each entry is "perp", "spot", "outcome", or the wildcard "*" (alone) for "every type the server currently tracks". Omitting the field defaults to ["perp"] — spot and outcome markets do not appear unless you opt in. The default never grows; pass ["*"] to auto-opt-in to future types.
A second allMids subscribe with a different filter replaces the previous one rather than coexisting with it.
Unsubscribe
Update data format
When isSnapshot is true, mids is the complete set for your filter (sent once on subscribe). When false, mids contains only the coins that changed in that block. In both cases, merge mids into your local map.
Field reference
mids
object
Map of coin symbol → mid price (decimal string)
time
number
Block timestamp (milliseconds since epoch)
blockHeight
number
Block height this update was computed at
isSnapshot
boolean
true = full map (sent once on subscribe); false = changed-only delta
Examples
Common errors
Rate limit exceeded - allMids requires add-on permission— your API key is missing the allMids add-on.Connection timeout— respond topingmessages withpong.Invalid API key
Last updated