l2Book

Get L2 orderbook snapshot with aggregated price levels.

Overview

The l2Book endpoint returns L2 orderbook snapshots — aggregated price levels with total size and order count at each level. Supports optional price aggregation via significant figures and mantissa parameters.

Key details:

  • Depth-20 snapshots (top 20 bids and asks)

  • Refreshed once per second

  • Supports price aggregation (nSigFigs, mantissa)

  • Returns zstd-compressed msgpack

Request

Endpoint: POST /info

Single coin:

{
    "type": "l2Book",
    "coin": "ETH"
}

Multiple coins:

{
    "type": "l2Book",
    "coins": ["ETH", "BTC", "SOL"]
}

With aggregation:

Parameters:

Parameter
Type
Required
Description

coin

string

No*

Single coin to fetch. Outcome markets ("#2870" etc.) are accepted.

coins

string[]

No*

Multiple coins to fetch. Outcome markets are accepted.

nSigFigs

number

No

Aggregate price levels to N significant figures (2-5).

mantissa

number

No

Snap to mantissa step (2 or 5). Only valid when nSigFigs=5.

* Either coin or coins must be provided. This endpoint has no all-markets / firehose mode — use l2BookDiffSnapshot for that.

Response

Headers:

  • Content-Type: application/octet-stream

  • Content-Encoding: zstd

Format: Zstd-compressed msgpack L2BookSnapshot:

For multiple coins, each snapshot is returned as a separate zstd-compressed msgpack blob.

Field reference

Field
Type
Description

coin

string

Market symbol

time

number

Block timestamp (milliseconds since epoch)

levels

array

Tuple of [bids, asks]. Bids descending, asks ascending.

levels[][].px

string

Price as decimal string

levels[][].sz

string

Total size at this price level

levels[][].n

number

Number of orders at this level

height

number

Block height of this snapshot

Common errors

  • 400: Missing or invalid coin/coins parameter

  • 400: Invalid nSigFigs (must be 2-5) or mantissa (must be 2 or 5 with nSigFigs=5)

  • 403: Permission denied - check API key

  • 404: No snapshot available yet

  • 429: Rate limit exceeded

Last updated