Limit order book simulator and slippage calculator
Read the book, predict the fill, watch the shares trade. See what a market order really costs once it walks through several price levels, and practise working a larger order over time.
Loading market scenarios…
How to use it
Each level of the book shows a price and the quantity available there. Predict the average price of a market order before you send it. For example, if sellers offer 10 shares at $100.10 and 20 at $100.20, a market buy of 25 shares averages $100.16.
In the execution exercise you must buy or sell a target of up to 200 shares before a deadline. You can rest limit orders, replace them or wait. At the deadline, remaining shares trade at available prices and anything still unfilled incurs a $1 per share penalty. Costs are measured against the starting mid.
Bid, ask, market depth and slippage explained
The best bid is the highest displayed buying price and the best ask is the lowest displayed selling price. Their difference is the bid–ask spread; their average is the mid-price. Market depth records the quantity waiting at each price. A tight spread can coexist with shallow depth, so it does not guarantee a cheap fill for a large order.
A market buy consumes asks from the lowest price upwards; a market sell consumes bids from the highest price downwards. The average fill is quantity-weighted, often called the volume-weighted average execution price. State your reference when discussing slippage: the best quote and the starting mid give different cost comparisons. This simulator uses the starting mid for its execution task.
Market orders versus limit orders: an execution exercise
Start with a small market order and predict its average fill from the ladder. Increase the quantity and identify the level where the next shares will trade. You are measuring the immediate cost of walking the book, rather than assuming every share fills at the top quote.
Next work a target quantity with limit orders before the deadline. A resting buy limit controls the highest price you accept, but it may remain unfilled while the market moves. Compare that non-fill risk with paying the spread immediately. This market microstructure exercise helps explain liquidity and execution cost; simulated fills do not reproduce a live exchange queue.
Slippage in basis points, and why order size matters
Traders usually quote execution cost in basis points of a reference price. The 25-share buy that averaged $100.16 against a $100.00 starting mid cost 16 basis points, before fees. Quoting in basis points lets you compare a cost across stocks with very different prices.
Cost per share rises with size, because extra shares come from deeper and worse price levels. Studies of large institutional orders find that market impact grows roughly with the square root of order size relative to daily volume. Treat that square-root law as a rule of thumb for planning large trades rather than a prediction for any single order; the simulator shows the mechanism one price level at a time.
What it teaches
The quoted spread is only the start of trading cost. Larger orders consume depth and move the average price, and waiting trades price impact against the risk that the market moves away. The tool estimates execution quality, not future trading profit; fees and margin are omitted.
Formula and units
Average fill = Σ(priceᵢ × filled quantityᵢ) / total filled quantity. Buy cost against the starting mid = total spend − starting mid × shares bought.
A numerical check and the model’s limits
For the 25-share purchase above, the first 10 shares cost $1,001 and the next 15 cost $1,503. Total spend is $2,504, giving an average price of $100.16. Against a $100 starting mid, that is $4 of execution cost before fees. The best ask alone would understate the cost of buying the entire quantity. In the deadline task, compare an immediate market order with resting a limit order. Waiting can improve price but introduces non-fill risk. If the target remains incomplete, the deadline rules force remaining trades where possible and apply the stated penalty to residual shares. This is a controlled execution exercise, with simplified order flow and no representation of exchange queue priority in a live market.
Frequently asked questions
Why is my average fill worse than the best displayed price?
A market order consumes the quantity at each level. If the best level lacks enough shares, the remaining quantity trades at less favourable prices.
Does the exercise include trading fees?
No. It isolates depth, timing and execution cost against the starting mid. Fees, margin and real exchange mechanics can change realised costs.
What is the difference between a market order and a limit order?
A market order trades against available opposing orders and may consume several price levels. A limit order sets the worst acceptable price, but can remain unfilled. The simulator lets you practise the trade-off between immediate execution and waiting for a price.
Can the order book simulator calculate slippage?
It calculates the average fill across displayed depth and compares execution cost with the starting mid-price in the execution task. It uses simulated order flow rather than a live stock or crypto order book.
Learn the ideas behind it
Free reading
- Market orders vs limit orders: spread, slippage and the real cost of trading
- Market making with Python and public data