Order Book

A real-time, continuously updated list of all outstanding buy and sell orders for a financial instrument on an exchange. The order book shows the price and quantity at each level, revealing the supply and demand dynamics that determine where and how orders will fill.

The order book is a real-time record of all pending buy and sell limit orders for a financial instrument on an exchange. It is organized by price level, with buy orders (bids) on one side and sell orders (asks) on the other. The order book provides a transparent view of supply and demand at each price point and determines how orders are matched and filled.

Order book structure

The bid side lists all pending buy orders, sorted from highest price to lowest. The ask side lists all pending sell orders, sorted from lowest price to highest. The highest bid and lowest ask are called the best bid and best offer (BBO), and the difference between them is the bid-ask spread.

Each price level shows the aggregate quantity of all orders at that price. For example, the best bid might show 5,000 shares at $100.00, meaning there are orders totaling 5,000 shares waiting to buy at that price. The next level might show 3,000 shares at $99.99. This depth information reveals how much volume can be traded before the price moves to the next level.

How the order book affects execution

When a market buy order arrives, it fills against the best ask (lowest sell price) first. If the order quantity exceeds the available shares at the best ask, it moves to the next ask level, and so on. This process, called walking the book, means that larger orders tend to receive worse average fill prices because they consume liquidity across multiple price levels.

The depth of the order book determines the price impact of an order. A deep order book with large quantities at each level can absorb large orders with minimal price movement. A thin order book with small quantities at each level will see significant price movement from even modest-sized orders.

Order book dynamics

The order book is not static. Orders are continuously added, modified, and canceled. In modern electronic markets, a significant portion of displayed orders are canceled before being filled. Some participants use algorithms to rapidly add and remove orders, creating a dynamic liquidity landscape that changes from millisecond to millisecond.

Understanding order book dynamics is particularly important for execution algorithms. Strategies like TWAP (Time-Weighted Average Price) and VWAP (Volume-Weighted Average Price) spread orders over time to minimize market impact by working with the order book rather than against it.

Order book in backtesting

Full order book data (Level 2 or Level 3 market data) provides the most realistic foundation for backtesting execution. However, this data is expensive and storage-intensive. Many backtesting platforms approximate order book dynamics using trade and quote (TAQ) data, which records the best bid and ask at each moment along with individual trades. Tick-level data provides a practical middle ground between aggregated bar data and full order book reconstruction.

Practical example

A trader wants to buy 10,000 shares of a stock. The order book shows: 2,000 shares offered at $50.00, 3,000 at $50.01, 4,000 at $50.02, and 5,000 at $50.03. A market order for 10,000 shares would fill 2,000 at $50.00, 3,000 at $50.01, 4,000 at $50.02, and 1,000 at $50.03, for an average fill of $50.014. The market impact of the order is $0.014 per share.

How Tektii helps

Tektii uses tick-level market data to model order book dynamics during backtesting. Orders fill against the actual prices and volumes that existed at each point in time, accounting for the bid-ask spread and available liquidity. This prevents the unrealistic assumption that any order size can fill at the last traded price, giving traders accurate execution cost estimates for their strategies.

See order book in action

Test your trading strategies with professional backtesting tools and real market data.

Start for free