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.
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
- The page opens with a 200-snapshot synthetic book. Load your own Level-2 CSV with Choose CSV.
- Use wide format: a timestamp column, then bid_px1, bid_sz1 … and ask_px1, ask_sz1 … for up to 20 levels per side.
- Press Play to step through the snapshots, set the speed, or drag the snapshot slider to jump to a moment.
- 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.
- 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.
Related tools
- 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.
Articles
- 7 min read Almgren-Chriss Optimal Execution: A Worked Example
Almgren-Chriss optimal execution on a 250k-share sell: the permanent and temporary impact decomposition, the mean-variance frontier, and a 19.40-bps cost.
- 11 min read Execution Simulation: Slippage and Impact
The math of market impact — why it scales as the square root of trade size, when linear impact dominates, and the fix that keeps backtests honest.
- 10 min read Execution Simulator: 50k Shares at 10% Participation
Engine returns 12.59 bps total cost ($2,833 on $2.25M notional) for a 50k-share buy at 10% participation. Splitting across days makes impact worse.
Workflows that use this tool
- 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";