Sub topic 3
Liquidity, Depth, and Slippage
Assume you know the basic structure of an exchange order book and can read simple Python. This chapter focuses on how available orders affect execution price in spot and derivatives markets.
Liquidity and market depth
Liquidity is the ability to buy or sell an asset quickly without moving its price much. A liquid market has many willing buyers and sellers near the current price. A less liquid market has fewer orders, wider price gaps, and greater price impact.
Market depth is the amount of buy and sell volume available at different prices. On an order book:
- Bids are buy orders below the current market.
- Asks are sell orders above the current market.
- Each price level contains a quantity available to trade.
- The best bid and best ask are the closest prices currently offered.
The difference between the best ask and best bid is the spread. The spread is an immediate trading cost when you cross from one side of the book to the other.
| Property | Liquid market | Illiquid market |
|---|---|---|
| Orders near current price | Many | Few |
| Spread | Usually narrow | Often wide |
| Large-order impact | Lower | Higher |
| Execution certainty | Usually higher | Lower |
Why market orders create slippage
A market order accepts the best available prices until its full quantity is filled. If the order is larger than the volume at the best price, it consumes the next price levels.
Slippage is the difference between the expected execution price and the actual average execution price. It can result from:
- Insufficient depth for the order size
- A rapidly changing market
- Other traders moving orders before your trade executes
- A wide spread
- Different liquidity between venues or contract types
For a buy order, execution normally moves upward through the asks. For a sell order, it moves downward through the bids.
Measuring execution impact
Suppose a trader buys 0.7 BTC:
- 0.2 BTC at 60,000
- 0.3 BTC at 60,050
- 0.2 BTC at 60,150
The weighted average execution price is:
\[ \frac{(0.2 \times 60{,}000) + (0.3 \times 60{,}050) + (0.2 \times 60{,}150)}{0.7} = 60{,}064.29 \]
Compared with the best ask of 60,000, the price impact is about 0.107%.
levels = [(0.2, 60000), (0.3, 60050), (0.2, 60150)]
quantity = sum(amount for amount, price in levels)
cost = sum(amount * price for amount, price in levels)
average_price = cost / quantity
best_ask = levels[0][1]
slippage_percent = (average_price / best_ask - 1) * 100
print(f"Average price: {average_price:.2f}")
print(f"Slippage: {slippage_percent:.3f}%")Reducing slippage
Use a limit order when price control matters. A limit order specifies the worst price you will accept, although it may execute only partially or not at all. Splitting a large order into smaller pieces can reduce visible market impact, but the market may move while the order is being completed.
For leveraged derivatives, depth matters twice: it affects the entry or exit price, and it can make liquidation more likely during a fast move. Always inspect the relevant contract's order book rather than assuming that a highly traded spot market has equal liquidity.
Exercise
An order buys 1 BTC at 60,000 and 1 BTC at 60,200. What is the average execution price, and what is the slippage relative to a 60,000 best ask?
Show answer
The average price is 60,100. Slippage is (60,100 / 60,000 - 1) × 100, or about 0.167%.