MarketLab Docs
ScriptingSources

Orderbook

Orderbook source configuration for Market Lab scripts.

Orderbook Source

The orderbook source provides live orderbook snapshots and historical snapshots from MMT heatmap data.

Manifest

export const script = {
  name: "orderbook-script",
  version: "1",
  sources: ["orderbook"],
  params: {}
}

Backtest

mlab script backtest ./scripts/orderbook-script.js \
  --provider mmt \
  --exchange bybitf \
  --symbol BTC/USDT \
  --from 1780307559000 \
  --to 1780311159000 \
  --source orderbook:timeframe=60 \
  --source orderbook:depth=100

Input shape:

input.mode === "window"
input.orderbook.books

Live Run

mlab script run ./scripts/orderbook-script.js \
  --provider mmt \
  --exchange bybitf \
  --symbol BTC/USDT \
  --source orderbook:depth=100

Live input shape:

input.mode === "stream"
input.source === "orderbook"
input.orderbook.snapshot

Config

KeyRequiredDescription
timeframeBacktest onlyHistorical bucket timeframe in seconds.
depthNoNumber of book levels to request. Defaults to 100.

MMT historical orderbook data is binned from flat_heatmap_hd, so it is useful for liquidity and execution-condition analysis, not exact raw order replay.

See Orderbook Data Type for the book fields.

On this page