Skip to main content
AI Fin Hub

Playground

Order Book Replay Visualizer

Drop a Level-2 snapshot CSV and replay the order book snapshot by snapshot. Animated depth bars, best bid/ask, spread and imbalance.

Runs in your browser. Nothing you enter is uploaded, and no account or API key is needed.

Education, not investment advice. Past performance does not predict future results. How we check our numbers.

Load a Level-2 snapshot CSV

Wide format: one row per timestamp, columns for timestamp, bid_pxN/bid_szN, ask_pxN/ask_szN. Up to 20 levels per side supported. Everything runs in your browser — nothing is uploaded.

What this tool visualizes

Every snapshot in your CSV is rendered as two depth bars — green for bids (below mid), rose for asks (above mid). Bar length is proportional to size at that level. The dashed line is the mid.

The timestamp and quoted spread (absolute + basis points) update as you replay. Load the demo to see the shape; then bring your own L2 export from any of the vendors in the TCO calculator.

How to use it

  1. The page opens with a 200-snapshot synthetic book. Load your own Level-2 CSV with Choose CSV.
  2. Use wide format: a timestamp column, then bid_px1, bid_sz1 … and ask_px1, ask_sz1 … for up to 20 levels per side.
  3. Press Play to step through the snapshots, set the speed, or drag the snapshot slider to jump to a moment.
  4. Read the quoted spread in basis points, the mid, the top-of-book imbalance and the size resting within 10 bps of mid for the current snapshot.
  5. Watch the depth bars through the replay to see where liquidity thins before you size an order.

Questions people ask

Where does the historical order book come from?

From you: the tool reads a CSV of Level-2 snapshots exported from your data vendor, one row per timestamp with a price and size for each level. It does not decode ITCH or PITCH message feeds or rebuild the book from individual messages. A synthetic demo book loads by default.

Can I replay any symbol?

Any symbol whose snapshots you can export in the CSV layout, up to 20 levels per side. The tool does not know the venue; coverage and accuracy are whatever your export contains.

What's the time resolution?

Whatever your snapshots have: the replay steps one snapshot at a time at 1 to 30 snapshots per second of playback, and timestamps in seconds or milliseconds are both read.

Does it model exchange-specific protocols?

No. It displays the snapshots as given. Queue position, priority rules, hidden liquidity and fills are not simulated; for an estimate of what an order would cost, use the Execution Simulator.

How big a dataset can I replay?

Everything runs in your browser, so the limit is the CSV your machine can parse comfortably, typically tens of thousands of snapshots. Nothing is uploaded.

  • Playgrounds Pair Trading Cointegration Tester

    Paste two price series. Engle-Granger cointegration test: OLS hedge ratio, Augmented Dickey-Fuller on residuals, Ornstein-Uhlenbeck half-life, z-score.

  • Calculators Portfolio Correlation Matrix

    Paste a multi-asset returns CSV. See the Pearson correlation heatmap, condition number, average absolute correlation, and eigenvalue concentration.

All articles
  • Workflow Explore market structure

    Inspect order books, options payoffs, and cross-venue arb in a sandbox before going live.

Use it from code

The same calculation as a JavaScript module you can import. It runs where you import it, with no request, key or rate limit.

import { compute } from "https://aifinhub.io/engines/order-book-replay.js";

Input and output contract and the guide for agents.