L2
l2:perps
Full 20-level depth snapshot at the subscribed frequency tier.
Channel: l2:perps:{freq}:{instrument}
Example: l2:perps:100:BTC_USDC-PERPETUAL
Frequencies: 100, 250, 500 (milliseconds)
Payload
{
"timestamp": 1704067200000,
"bids": [
["50000", "1000", "3"],
["49900", "500", "2"]
],
"asks": [
["50100", "800", "2"],
["50200", "400", "1"]
]
}| Field | Type | Description |
|---|---|---|
timestamp | integer | Unix timestamp in milliseconds |
bids | array | Bid levels, best (highest) first. Each: [price, amount, order_count] |
asks | array | Ask levels, best (lowest) first. Each: [price, amount, order_count] |
Level array elements:
| Index | Type | Description |
|---|---|---|
| 0 | string | Price |
| 1 | string | Amount (notional USD) |
| 2 | string | Number of orders at this level |
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.
const sub = client.newSubscription("l2:perps:100:BTC_USDC-PERPETUAL", { since: {} });
sub.on("publication", (ctx) => {
const { timestamp, bids, asks } = ctx.data;
});
sub.subscribe();Updated 1 day ago
