Sub topic 7
Slippage: why you may not get the quoted price
This chapter assumes you can read a quote (bid, ask, spread) and know how a market order and a limit order differ. It also assumes you are comfortable with simple arithmetic on prices and quantities. This is educational material, not investment advice.
What slippage is
Slippage is the difference between the price you expected when you submitted an order and the average price at which it actually filled. Suppose you see an ask of 50.02, buy, and fill at an average of 50.055. The slippage is 0.035 per share.
Slippage is not a fee. No one charges it to you. It comes from how the market works: prices are made of many small offers, and they move while your order travels.
You always measure slippage against a reference price. Pick the reference before you trade, because the number changes with the choice:
- The best ask (for a buy) or best bid (for a sell) shows the cost of market depth and timing. This is the most common reference.
- The midpoint (halfway between bid and ask) also includes the cost of crossing the spread.
- The last price is the least reliable reference. It may be old, and it may have traded on either side of the spread.
Where slippage comes from
Two separate mechanisms produce slippage, and they need different fixes.
- Depth. The best ask shows only a limited number of shares. If your order is larger, the rest fills at the next price levels up the book.
- Movement. The market can change between the moment you looked at the quote and the moment your order arrives. The delay can be a fraction of a second in a fast stock. It can be much longer if your quote was stale or delayed.
Measuring slippage from depth
The code below walks a buy order up a list of asks and reports the slippage against the best ask and against the midpoint. It runs as shown.
def walk_asks(asks, qty):
"""Fill a market buy of qty shares against (price, size) asks."""
filled, cost = 0, 0.0
for price, size in sorted(asks):
take = min(size, qty - filled)
filled += take
cost += take * price
if filled == qty:
break
return filled, cost
def slippage(asks, qty, bid):
best_ask = min(price for price, _ in asks)
filled, cost = walk_asks(asks, qty)
avg = cost / filled
mid = (bid + best_ask) / 2
return {
"avg_price": round(avg, 4),
"vs_ask_per_share": round(avg - best_ask, 4),
"vs_ask_total": round(cost - filled * best_ask, 2),
"vs_ask_bps": round((avg - best_ask) / best_ask * 10_000, 1),
"vs_mid_per_share": round(avg - mid, 4),
}
bid = 49.98
deep_book = [(50.02, 100), (50.05, 200), (50.10, 500)]
thin_book = [(50.02, 100), (50.30, 100), (50.80, 200)]
print(slippage(deep_book, 400, bid))
print(slippage(thin_book, 400, bid))A basis point (bps) is one hundredth of a percent, so 100 bps is 1%. Basis points let you compare trades of different sizes and prices.
For the deep book, 400 shares fill at an average of 50.055. That is 0.035 per share above the best ask, 14.00 in total, or 7.0 bps. The best ask had only 100 shares, so most of the order filled at higher prices.
For the thin book, the same 400 shares fill at an average of 50.48. That is 0.46 per share above the best ask, 184.00 in total, or 92.0 bps. The quote was identical, but the cost was thirteen times higher, because there were few shares offered near the top.
Measuring slippage from movement
Movement slippage cannot be computed from a snapshot of the book. You observe it afterward by comparing your fill with the quote you saw when you decided to trade. Typical causes:
- Fast markets. News, earnings releases, and the opening and closing minutes move prices quickly.
- Stale or delayed quotes. Some free data feeds are delayed by 15 minutes. A "quoted price" from such a feed may be far from the current market.
- Wide, jumpy spreads. In thin stocks, the bid and ask can both shift several cents between two refreshes of your screen.
Movement slippage can help you. If the ask drops before your buy arrives, you fill cheaper than you expected. This is called positive slippage or price improvement. Over many trades, though, market orders in a market that is moving against you tend to cost more than they save.
Which stocks and situations make it worse
| Situation | Why slippage grows | What to do |
|---|---|---|
| Thinly traded stock | Few shares at each price level | Use a limit order and smaller size |
| Large order compared with displayed size | The order walks several levels | Split the order or use a limit |
| Market open and close | Prices and spreads move fast | Wait several minutes or use a limit |
| News or earnings release | Quotes change in jumps | Avoid market orders around the event |
| Extended hours | Few participants and wide spreads | Use limit orders only |
How a limit order controls slippage
A limit order sets a worst acceptable price. A buy limit at 50.05 can never fill above 50.05, so depth slippage and movement slippage beyond that cap are impossible. Running the first example from this tutorial with a limit of 50.05 against the deep book fills only 300 shares at an average of 50.04. The remaining 100 shares do not fill.
That is the trade you make. A market order gives up price certainty to get a fill. A limit order gives up fill certainty to get a price. Slippage is the cost of the first choice, and a missed or partial fill is the cost of the second. Neither is always better. If you must be in or out of a position now, accepting some slippage can be reasonable. If you are not in a hurry, a limit price is cheap protection.
Common errors
- Treating the last price as the price you will pay. The last trade may have been at the bid, the ask, or an old price. A market buy pays at least the current ask.
- Checking only the best ask. Look at the size shown there and compare it with your quantity. If your order is larger, expect depth slippage.
- Using a delayed quote. Confirm that your platform shows real-time data before you rely on a displayed price.
- Placing market orders near the open. The first minutes after the open often have wide spreads and rapid changes.
- Confusing slippage with fees. Commissions and regulatory fees are listed on your confirmation. Slippage appears only as a gap between your expected price and your fill price.
- Ignoring sells. Slippage applies in the other direction too. A market sell walks down the bids and fills below the best bid when the order is large.
A short routine to limit slippage
- Check that the quote is real-time and note the bid, ask, and spread.
- Compare your quantity with the size at the best bid or ask.
- Estimate the worst plausible fill using the book, as the code above does.
- If that estimate is more than you accept, reduce the size or use a limit order.
- After the fill, record the difference between your fill price and the quote you saw. A history of your own fills shows what slippage costs you in the stocks you actually trade.
Exercise
A stock shows bid 20.00 and ask 20.04. The asks are 100 shares at 20.04, 100 shares at 20.10, and 300 shares at 20.20. You send a market buy for 300 shares. (a) What is the average fill price? (b) What is the slippage per share and in total against the best ask? (c) If you had used a buy limit at 20.10 instead, how many shares would fill and at what average price?
Show answer
(a) The fills are 100 at 20.04 (2004.00), 100 at 20.10 (2010.00), and 100 at 20.20 (2020.00). The total cost is 6034.00, so the average is 6034.00 / 300 = 20.1133 (about 20.113). (b) Against the best ask of 20.04, slippage is 20.1133 - 20.04 = 0.0733 per share, which is 6034.00 - 300 x 20.04 = 6034.00 - 6012.00 = 22.00 in total. (c) A limit at 20.10 fills only the 100 shares at 20.04 and the 100 shares at 20.10, so 200 shares fill at an average of (2004.00 + 2010.00) / 200 = 20.07. The remaining 100 shares stay unfilled.
Exercise
Name the two causes of slippage described in this chapter, and say which one a limit order removes above its limit price and why.
Show answer
The two causes are depth (the order walks through several price levels because the best level is too small) and movement (the quote changes between your decision and the fill). A limit order removes both beyond its limit price, because the order cannot execute at any price worse than the limit. The cost is that part or all of the order may not fill.