Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

l2BookDepth

Channell2BookDepthserver → client · type l2BookDepth

Maintain a local fixed-depth book from one snapshot plus deltas (lower bandwidth, you apply updates).

Subscribe
{
  "method": "subscribe",
  "type": "l2BookDepth",
  "subscription": {
    "type": "l2BookDepth",
    "coin": "4"
  }
}
Try it
WS wss://rpc.txflow-testnet.xyz/ws
Subscription parameters
coinstringrequired

Depth and price granularity are fixed server-side.

typestringrequired
"l2BookDepth"
Server message
channelstring
"l2BookDepth"
dataWsL2BookDepthData

Fixed-depth order book frame, snapshot or delta. prevSeq is always present: null for snapshot frames, the previous frame's seq for delta frames. levels[0] = bids, levels[1] = asks, following the same shape as WsL2BookData.levels. Bids are strictly descending, asks strictly ascending. For Snapshot frames, levels contain the full top-N book (levels with sz == "0" are never included). For Delta frames, levels contain only the price levels that changed this period; sz == "0" means that price level was removed.

coinstring

Trading pair symbol.

idinteger

Instrument id.

levelsWsBookLevel[][]
prevSeqintegernullable

Sequence number of the previous frame. null on snapshot frames.

seqinteger

Monotonically increasing sequence number of this frame.

timeinteger

Frame timestamp, milliseconds.

typestring

Frame type.

"snapshot""delta"
Message example
{
  "channel": "l2BookDepth",
  "data": {
    "coin": "4",
    "id": 0,
    "time": 1700000000000,
    "seq": 0,
    "prevSeq": 0,
    "type": "snapshot",
    "levels": [
      [
        {
          "px": "0",
          "sz": "0",
          "n": 0
        }
      ]
    ]
  }
}