L2 Grouped
l2:perps:grouped
Price-bucketed depth snapshot. Prices are floored to the nearest bucket boundary (e.g., 2495.37 at bucket 0.5 becomes 2495.0). Includes cumulative depth for depth chart rendering. Published every 250ms when the book has updates.
Channel: l2:perps:grouped:{bucket}:{instrument}
Example: l2:perps:grouped:0.5:ETH_USDC-PERPETUAL
Payload
{
"timestamp": 1704067200000,
"bids": [
["2495", "15000.5", "15000.5"],
["2494.5", "8200", "23200.5"]
],
"asks": [
["2495.5", "12000", "12000"],
["2496", "9500", "21500"]
]
}| Field | Type | Description |
|---|---|---|
timestamp | integer | Unix timestamp in milliseconds |
bids | array | Bid levels, best (highest) first. Each: [price, amount, cumulative] |
asks | array | Ask levels, best (lowest) first. Each: [price, amount, cumulative] |
Level array elements:
| Index | Type | Description |
|---|---|---|
| 0 | string | Bucket boundary price (floored) |
| 1 | string | Total amount at this bucket (notional USD) |
| 2 | string | Cumulative amount from best to this level |
Available Buckets
| Instrument | Buckets |
|---|---|
ETH_USDC-PERPETUAL | 0.1, 0.2, 0.5, 1, 10, 100 |
BTC_USDC-PERPETUAL | 1, 2, 5, 10, 100, 1000 |
sub.on("publication", (ctx) => {
const { timestamp, bids, asks } = ctx.data;
// Each level: [bucketPrice, amount, cumulativeAmount]
for (const [price, amount, cumulative] of bids) {
// price, amount, cumulative are all strings
}
});Recovery
Subscribe with since: {} to receive the last cached snapshot as the first publication, before any live updates. On reconnect, the SDK automatically recovers the latest snapshot.
Updated 1 day ago
