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"]
  ]
}
FieldTypeDescription
timestampintegerUnix timestamp in milliseconds
bidsarrayBid levels, best (highest) first. Each: [price, amount, order_count]
asksarrayAsk levels, best (lowest) first. Each: [price, amount, order_count]

Level array elements:

IndexTypeDescription
0stringPrice
1stringAmount (notional USD)
2stringNumber 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();