MM Flow

mmflow Charts

Orderbook snapshot replay

Replay sparse Hyperliquid L2 snapshots from archive coverage or current-window point fallback. Phase 13 is snapshot playback, not L2 delta reconstruction.

Sparse snapshots

Archive coverage means snapshots were checked or stored for a range. It does not mean every orderbook state can be reconstructed.

Current fallback only

Live Hyperliquid l2Book fallback can write one point snapshot when the requested range intersects the current two-minute window.

Heatmap-ready

historyOrderbookSnapshotsToHeatmapInput converts normalized snapshots into the stable OrderBookHeatmapLayer input shape.

History orderbook snapshots API

Use from and to as inclusive unix millisecond timestamps. Depth is normalized before archive lookup, so depth-50 and depth-200 coverage are tracked separately.

REST response
GET /api/v1/history/orderbook-snapshots?symbol=BTC&venue=hl&from=1730000000000&to=1730003600000&depth=50&limit=100

{
  "data": {
    "symbol": "BTC",
    "venue": "hl",
    "from": 1730000000000,
    "to": 1730003600000,
    "depth": 50,
    "limit": 100,
    "snapshots": [
      {
        "version": 1,
        "id": "orderbook:hl:BTC:1730003600000:d50:65000:65010",
        "ts": 1730003600000,
        "symbol": "BTC",
        "venue": "hl",
        "bids": [{ "price": 65000, "size": 2, "notionalUsd": 130000 }],
        "asks": [{ "price": 65010, "size": 1, "notionalUsd": 65010 }],
        "depth": 50,
        "mid": 65005,
        "spreadBps": 1.54,
        "source": "hyperliquid:l2Book",
        "sourceQuality": "snapshot"
      }
    ]
  },
  "meta": {
    "fetchedAt": 1730003601000,
    "source": "mmflow:history-orderbook-snapshots",
    "historySource": "mixed",
    "partial": true,
    "warnings": [
      "Orderbook replay coverage is sparse; returned snapshots do not reconstruct continuous book state."
    ],
    "archive": {
      "available": true,
      "returnedSnapshots": 1,
      "coveredFrom": 1730003600000,
      "coveredTo": 1730003600000,
      "missingRanges": [],
      "wroteThrough": true
    }
  }
}

SDK and chart integration

The simple SDK helper returns normalized snapshots. Use the response helper for archive/source metadata and sparse coverage warnings.

SDK usage
import {
  historyOrderbookSnapshotsToHeatmapInput,
} from "@mmflow/charts";
import { fetchHistoryOrderbookSnapshotsResponse } from "@mmflow/sdk";

const response = await fetchHistoryOrderbookSnapshotsResponse({
  symbol: "BTC",
  venue: "hl",
  from,
  to,
  depth: 50,
});

const heatmapSnapshots = historyOrderbookSnapshotsToHeatmapInput(
  response.data.snapshots,
);
const source = response.meta.historySource;

Try it in the playground

Enable replay, choose historical or synthetic source, and turn on orderbook snapshots. Candle, trade, and footprint replay continue if orderbook snapshots are unavailable.

Current limitations

Phase 13 supports bounded sparse orderbook snapshots. It does not provide historical L2 deltas, tick-perfect book state, order simulation, full orderbook warehouse storage, ClickHouse/Redpanda infrastructure, backtesting, auth, billing, or trading execution. History status follows the same current-window rule: live L2 can prove only current point snapshots, and old cold ranges remain unavailable unless explicit archive coverage exists.