Perps L2
l2:perps
Full 20-level depth snapshot. Subscribe to a single channel and use tier tag filtering to select your update frequency.
Channel: l2:perps:{instrument}
Example: l2:perps:BTC_USDC-PERPETUAL
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 |
Tag Filtering
Each publication carries a tier tag. Filter by tier to select your update frequency.
| Tag value | Frequency | Use case |
|---|---|---|
| no filter | Every 100ms (all tiers) | HFT / algo trading |
100 | Every 100ms | Same as no filter, explicit tier match |
250 | Every 250ms | Active trading |
500 | Every 500ms | Dashboards / casual |
Subscribe — Protobuf SDK
All updates (100ms — HFT)
No tag filter — receives every publication.
import { Centrifuge } from "centrifuge/build/protobuf";
const client = new Centrifuge("wss://staging.kyan.sh/stream/websocket?format=protobuf");
const sub = client.newSubscription("l2:perps:BTC_USDC-PERPETUAL", { since: {} });
sub.on("publication", (ctx) => {
const data = ctx.data instanceof Uint8Array
? JSON.parse(new TextDecoder().decode(ctx.data))
: ctx.data;
const { timestamp, bids, asks } = data;
});
sub.subscribe();
client.connect();Filtered: 250ms updates
const sub = client.newSubscription("l2:perps:BTC_USDC-PERPETUAL", {
since: {},
tagsFilter: { key: "tier", cmp: "eq", val: "250" }
});Filtered: 500ms updates
const sub = client.newSubscription("l2:perps:BTC_USDC-PERPETUAL", {
since: {},
tagsFilter: { key: "tier", cmp: "eq", val: "500" }
});Recovery
Subscribe with since: {} to receive the last known snapshot on subscribe. On reconnect, the SDK automatically recovers.
Related channels
Channels providing related data.
| Channel | Why |
|---|---|
| Index Price | Spot price for the underlying pair. Basis at each level = level price - index. |
| Funding Rate | Funding rate for the instrument. Derived from the basis (perp price - index). |
| Perps BBO | Top-of-book summary extracted from this depth data. |
| L2 Grouped | Price-bucketed aggregation of the same orderbook. |
| Options BBO | Options market IV and skew data for the same underlying. |
| Order Lifecycle | Your order state, fills, and cancellations. |
| Trades (Perps) | Public trade tape showing executions against this book. |
Updated about 2 months ago
