Orders & Execution
Order Book (L2)
The live ledger of resting buy and sell limit orders at each price level. Level-2 data shows the full depth, not just the best bid and ask.
The order book is where unexecuted limit orders wait. Each price level holds a queue of resting size; the best bid and best ask form the spread, and everything behind them is depth.
Level 1 data is just the touch: best bid, best ask, and their sizes. Level 2 (L2) is the full ladder, every visible price level with its resting quantity, often 50 levels a side.
Why depth matters
Depth determines what size can trade without moving the market. A 2 BTC market buy against 0.8 BTC at the ask walks up the ladder, filling progressively worse. In that sense the book is the slippage function. Reading depth is also how execution algorithms decide when and how fast to work an order.
L2 in backtesting
Most backtesters ignore the book entirely and fill at candle prices. AlphaProve stores reconstructed L2 history (50 levels a side) and, where coverage exists, simulates fills by walking that depth, so a strategy that trades size pays a size-dependent price, exactly as it would live. Where L2 coverage is missing, the engine falls back to candle-based fills with a slippage allowance.
On AlphaProve
The reconstructed ladder feeds the fill engine, not your strategy logic.
That depth is queried through DuckDB to price fills, but ctx hands your
code candles and indicators — never a live book — so you can't write a rule
that reads resting size at a level directly. The nearest orderflow signal
you do get is CVD built from each candle's buy/sell volume
split, which the builtin ob_cvd_divergence strategy pairs with
order-block levels.