Sub topic 2
The spread: the cost of immediacy
This chapter assumes you can read a basic order book (bids on one side, asks on the other, each with a size), you know what a trading pair like BTC/USDT is, and you can follow short Python. It covers how to measure the spread, why it exists, and how to count it as a trading cost.
Best bid, best ask, and the spread
The best bid is the highest price any buyer currently has resting on the book. The best ask is the lowest price any seller currently has resting. The spread is the gap between them:
- spread = best ask − best bid
In a healthy book the best bid is always below the best ask. If they met, the matching engine would trade the two orders against each other immediately, so they could not both rest.
The midpoint (mid price) is the average of the two: (99.8 + 100.0) / 2 = 99.9. Charts and "last price" tickers often show something near the mid or the last trade. Neither price is guaranteed to be available to you.
Measuring the spread
An absolute spread of 0.2 means little on its own. It is huge for a 1.00 asset and trivial for a 65,000 asset. To compare markets, express the spread relative to the mid price, usually in basis points (bps). One basis point is 0.01%.
- relative spread = spread / mid
- spread in bps = spread / mid × 10,000
For the book above, 0.2 / 99.9 × 10,000 ≈ 20.02 bps. The same 0.2 gap on a price of 65,000 would be about 0.03 bps.
Why the spread exists
Nobody sets the spread directly. It emerges from the orders people choose to rest on the book. A market maker is a participant who continuously posts both bids and asks. Several costs push the maker to keep the two prices apart:
- Inventory risk. After a maker buys, they hold an asset whose price may fall before they can sell it.
- Adverse selection. Some counterparties know something the maker does not, such as news that has not reached the maker's quote yet. When the maker's quote is hit by such a trader, the price is about to move against them. A wider spread offsets those losses.
- Operating costs. Fees, infrastructure, and capital tied up on the exchange all need to be covered.
- Competition. Makers compete by tightening their quotes. In a busy market this pushes the spread toward the minimum the costs allow.
The spread as the price of immediacy
Suppose you want to buy now. A market order takes the best ask, so you pay 100.0 while the mid is 99.9. You paid 0.1 above the mid. That amount is the half-spread, and it is the price of not waiting.
If you instead place a limit buy at 99.8, you join the best bid. You may get the better price, but only if a seller comes to you. You might never fill, or the market might run away from you. This is the core trade-off: crossing the spread buys certainty and speed, and resting on the book buys price improvement at the risk of no fill.
A buy followed by an immediate sell with market orders is a round trip. Each leg crosses half the spread, so a round trip costs the full spread, plus fees on both legs. The price must move in your favor by at least that much before you break even.
best_bid, best_ask = 99.8, 100.0
TAKER_RATE = 0.0020 # illustrative 0.20% taker fee
spread = best_ask - best_bid
mid = (best_bid + best_ask) / 2
spread_bps = spread / mid * 10_000
half_spread_bps = (best_ask - mid) / mid * 10_000
# Buy 1 unit at the ask, then sell 1 unit at the bid, both as takers
paid = best_ask * 1.0 * (1 + TAKER_RATE)
received = best_bid * 1.0 * (1 - TAKER_RATE)
round_trip_cost = paid - received
print(f"mid={mid:.2f}") # mid=99.90
print(f"spread={spread:.2f} ({spread_bps:.2f} bps)") # spread=0.20 (20.02 bps)
print(f"half-spread={half_spread_bps:.2f} bps") # half-spread=10.01 bps
print(f"round trip cost={round_trip_cost:.4f}") # round trip cost=0.5996Of the 0.5996 lost per unit, 0.2 is the spread and about 0.3996 is fees. On a wide, active market the fees can dominate. On a very tight market the spread can be the smaller part.
What makes the spread wide or narrow
| Factor | Effect on the spread | Why |
|---|---|---|
| High trading volume | Narrower | Makers earn more by quoting tightly and trade often |
| Illiquid pair | Wider | Few makers, so each one needs more compensation per trade |
| High volatility | Wider | Quotes go stale faster, so adverse selection risk rises |
| News or sudden events | Wider, sometimes briefly empty | Makers pull quotes until the price settles |
| Low-activity hours | Often wider | Fewer participants are quoting |
| Large tick size relative to price | Floor on the spread | The spread cannot be smaller than one tick |
Major pairs such as BTC/USDT on large exchanges often have spreads of a tick or two. Small-cap tokens may have spreads of several percent. Check the spread of the specific pair before you trade, because the same strategy can cost very different amounts on different pairs.
Edge cases and gotchas
Tick size sets a minimum spread
The tick size is the smallest price increment the exchange allows. If a pair trades near 100 with a tick of 0.1, the narrowest possible spread is 0.1, or about 10 bps. A one-tick spread is as tight as the market can get. Further competition then shows up as more size at the best prices, not a narrower gap.
The spread says nothing about size
The best bid and best ask each have a quantity. If the best ask has only 2 units and you want 4, your order walks into the next level and your average price is worse than the quoted ask. The spread tells you the cost of a small trade. For a larger trade, you also need depth, which the slippage chapter covers.
Quotes can vanish
The displayed spread is a snapshot. During fast moves, makers cancel orders and the spread can jump between the moment you look and the moment your order arrives. A screen that shows a 0.02% spread does not promise you that price.
One side can be empty or very thin
On an illiquid pair, there may be no bids close to the ask, or the next level may be far away. The "spread" you see may be only the gap between two tiny orders. A market sell in that situation can fill far below the best bid.
Locked and crossed markets
When the best bid equals the best ask, the market is locked. When the best bid is above the best ask, it is crossed. A single exchange's matching engine normally prevents both states, because the orders would trade. You may see them when combining prices from several exchanges or reading stale data. Treat them as a data problem or a short-lived arbitrage opportunity, not a normal spread of zero or less. The function below rejects them rather than returning a misleading number.
def spread_bps(best_bid, best_ask):
"""Return the relative spread in basis points, or raise on bad data."""
if best_bid <= 0 or best_ask <= 0:
raise ValueError("prices must be positive")
if best_bid >= best_ask:
raise ValueError("locked or crossed book: check for stale data")
mid = (best_bid + best_ask) / 2
return (best_ask - best_bid) / mid * 10_000
print(round(spread_bps(64990.0, 65010.0), 2)) # 3.08Quoted versus effective spread
The quoted spread is what the book shows. The effective spread is what you actually paid: twice the distance between your fill price and the mid at the time you sent the order. For a small order that fills at the best ask, the two are equal. For a larger order that walks the book, the effective spread is larger. If you track your own trading costs, use the effective spread.
Practical habits
- Read both sides of the book and compute the spread in bps before choosing an order type.
- Compare the spread with your expected move. If you expect to capture 0.1% and the spread is 0.15%, a market-order round trip is a losing plan.
- Use a limit order when you can wait and the spread is wide. Use a market order when speed matters more than the half-spread.
- Re-check the book right before sending an order on volatile or illiquid pairs.
Exercise
On BTC/USDT, the best bid is 64,990.00 and the best ask is 65,010.00. Find the mid price, the spread in basis points, and the cost per BTC of buying and then selling immediately with market orders, ignoring fees.
Show answer
The mid is (64,990 + 65,010) / 2 = 65,000. The spread is 65,010 − 64,990 = 20 USDT. In basis points, 20 / 65,000 × 10,000 ≈ 3.08 bps. A round trip buys at 65,010 and sells at 64,990, so it loses 20 USDT per BTC, the full spread. Each leg costs half of that, 10 USDT.
Exercise
A trader sees a spread of 0.1 on a coin priced near 100, and the exchange tick size is 0.1. The trader hopes the spread will narrow to 0.05 if they wait. Will it?
Show answer
No. The spread cannot be smaller than one tick, and here one tick is 0.1. The spread is already at its minimum of about 10 bps. More competition can add size at the best bid and ask, but it cannot shrink the gap.