Orders, bid, ask and spread
The bid is the highest price a buyer offers right now, the ask the lowest price a seller accepts. The gap between them, the spread, is a cost you pay on every trade. A market order trades at once at whatever price is available; a limit order fixes your price but may never be filled.
What it is
Every share or bond on an exchange has an order book: a list of buyers waiting to buy and sellers waiting to sell, with their prices and amounts.
- The bid is the best price a buyer is offering. You can sell at the bid at once.
- The ask (or offer) is the best price a seller is asking. You can buy at the ask at once.
- The spread is ask minus bid. The middle of the two is the mid price.
You choose how you trade:
- A market order says "trade now at the best price available". It fills, but the price can be worse than you expected.
- A limit order says "only at this price or better". You control the price, but it may never fill.
- A stop order waits until the price reaches a level, then becomes a market order. A stop-loss is meant to limit losses, but in a fast fall it can fill far below the stop price.
Market makers stand ready to buy at the bid and sell at the ask all day. The spread is their pay for that service and for the risk of holding stock.
The intuition
Think of a currency exchange booth at an airport. It buys euros from you at 1.05 and sells them at 1.10. If you change money there and back, you lose the gap even though the euro didn't move. That gap is the spread.
Popular shares have many buyers and sellers competing, so the spread is tiny. Small, rarely traded shares have few, so the spread is wide, and every trade costs more.
The math
Where
- \(q_k, p_k\)
- Number of shares filled, and price, at each level of the order book
In words: The spread in percent is the cost of buying and selling straight away. A large market order eats through several price levels, so its average price is worse than the best ask.
An example
Fernway's order book right now:
| Bids (buyers) | Shares | Asks (sellers) | Shares |
|---|---|---|---|
| $17.98 | 5,000 | $18.02 | 4,000 |
| $17.97 | 8,000 | $18.03 | 6,000 |
| $17.95 | 12,000 | $18.05 | 10,000 |
The spread is $18.02 − $17.98 = 4 cents, or 0.22% of the $18.00 mid price. A market order to buy 8,000 shares takes all 4,000 at $18.02 and 4,000 at $18.03, an average of $18.025: 0.14% above the mid. A limit order to buy at $18.00 costs nothing extra, but only fills if a seller comes down to $18.00.
In Python
Walk through the order book like a market order does, and measure the cost against the mid price.
asks = [(18.02, 4000), (18.03, 6000), (18.05, 10000)] # (price, shares) bid, ask = 17.98, 18.02 mid = (bid + ask) / 2 print("spread %:", round((ask - bid) / mid * 100, 2)) def market_buy(book, qty): cost, left = 0, qty for price, size in book: take = min(size, left) cost += take * price left -= take if left == 0: break return cost / qty avg = market_buy(asks, 8000) print("average price:", round(avg, 3), "| above mid %:", round((avg / mid - 1) * 100, 2))
In the real world
On 6 May 2010 the Dow Jones index of large US shares fell almost 1,000 points, about 9%, within minutes, then recovered most of it. In the chaos real buyers vanished from many order books, and some market orders were filled against placeholder quotes far from any sensible price. Shares of the consultancy Accenture fell from about $40 to one cent. Anyone with a market order or a stop-loss got whatever price was left. A limit order would have refused to trade.
Think about it
You want to buy shares in a small company whose spread is 2%. You expect to sell again in a month. What does the spread cost you, and how could you lower that cost?
Show a model answer
Buying at the ask and selling at the bid costs about the full spread, 2%, even if the share price doesn't move. In a month that is a lot: it equals a year of interest on a savings account. You can lower it in several ways: use limit orders near the mid price, trade in busy hours, or choose a more liquid share or fund. Holding longer also spreads the cost over more time.
Reading the result
Check the spread before you trade. Below 0.1% is normal for large companies; above 1% means every round trip costs you real money. For big orders, also check how many shares sit at the best prices.
Good signs
- Limit orders for anything that isn't very liquid
- Trading when markets are open and busy, not in the first or last minutes
- Counting the spread as a cost, next to fees and commissions
Watch out
- Market orders in thinly traded shares or in a fast-moving market
- Treating a stop-loss as a guaranteed exit price
- Trading so often that spreads eat the return
Remember
- Buy at the ask, sell at the bid.
- The spread is a cost on every round trip.
- Market order: certain to fill, uncertain price.
- Limit order: certain price, uncertain to fill.
Check yourself
Question 1 of 2The bid is $49.90 and the ask is $50.10. You place a small market order to buy. What price do you pay?
A market buy order takes the best ask, $50.10.
Question 2 of 2Which order guarantees the price but not that it will be filled?
A limit order only trades at your price or better, so it may never trade at all.
Read more
- Bodie, Kane & Marcus, Investments: chapter on how securities are traded
Spotted a mistake or have a wish?
Tell us in a line or two. The page name is sent along automatically.