Beta
HyperCore APIs are in beta. Message fields, limits, and behavior may change, including breaking changes. To request access, contact [email protected].
Aggregated price levels for each market: a complete window of the top of the book, sent whenever it changes.
{
"method": "subscribe",
"subscriptionId": "l2_01",
"subscription": {
"type": "l2Book",
"coins": [
"BTC",
"ETH"
],
"nLevels": 20
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
coins | string[] | No | Markets to include, up to 200. Omit, or send [], for every market (one unfiltered subscription per stream per connection). Unknown coins stay subscribed and return empty data until the market exists. |
nSigFigs | integer | No | Group prices to 2–5 significant figures. Omit for exact prices. |
mantissa | integer | No | 1, 2, or 5. Only with nSigFigs: 5; default 1. |
nLevels | integer | No | Levels per side: 1, 10, 20 (default), or 50. |
{
"channel": "subscriptionResponse",
"subscriptionId": "l2_01",
"data": {
"type": "l2Book",
"coins": [
"BTC",
"ETH"
],
"nLevels": 20
}
}{
"seq": 1,
"channel": "l2Book",
"subscriptionId": "l2_01",
"data": {
"blockNumber": 1183759643,
"blockTime": 1791999593526,
"isSnapshot": true,
"books": [
{
"coin": "BTC",
"levels": [
[
{
"px": "81772.0",
"sz": "30.29109",
"n": 96
},
{
"px": "81770.0",
"sz": "4.7457",
"n": 9
}
],
[
{
"px": "81773.0",
"sz": "0.02692",
"n": 2
},
{
"px": "81774.0",
"sz": "1.2",
"n": 3
}
]
]
}
]
}
}| Field | Description |
|---|---|
data.isSnapshot | true on the first message after subscribing. |
data.books[] | One entry per market whose window changed in this block. The first message includes every subscribed market. |
data.books[].levels | [bids, asks]. Bids are sorted high to low, asks low to high. |
px, sz, n | Price, total size at the level, and number of orders. |
data.nSigFigs, data.mantissa | Present when you requested price grouping. |
Every entry is a complete window for its market, so you can replace your view of that market with it. Markets that didn't change aren't included.
For a live book with less data, use l2BookDiff.
{"method":"unsubscribe","subscriptionId":"l2_01"}Book streams have no replay. After a disconnect, or if seq skips, resubscribe; the first message is a fresh snapshot. If you receive a book_reset error, drop local state for the subscription and rebuild from the snapshot that follows. See replay and recovery.