Core Path · L1.1.06

How prices are formed

12 minMarketsMarket microstructure

By the end you will be able to

  1. 1Describe an order book, the bid-ask spread and how trading discovers a price.
  2. 2Calculate the spread, the mid price and the spread as a percentage of the mid.
  3. 3Tell a market order from a limit order, and work out the average price a market order pays.
  4. 4Explain how news reaches the price through orders.

Why it matters

Nobody sets the price of a share. There is no committee, no official, no algorithm in charge. Yet within a second of a company's news, its price has moved. The machine that does this is the order book.

Core explanation

A queue of buyers, a queue of sellers

Picture an auction where nobody has to shout. Every buyer writes down the most they will pay and how many shares they want. Every seller writes down the least they will accept. The exchange sorts these notes into two queues. That list is the order book.

  • Buyers' orders, the bids, are sorted from the highest price down. The top one is the best bid.
  • Sellers' orders, the asks or offers, are sorted from the lowest price up. The top one is the best ask.

The best bid is always below the best ask. If it were not, the two would simply trade. The gap between them is the bid-ask spread, and halfway between them is the mid price. In our example share, the best bid is €39.98 and the best ask €40.02: a spread of €0.04 and a mid of €40.00.

Two kinds of order. A limit order names a price: “buy 500 at €39.97 or less”. If no seller will meet it, it waits in the book. A market order names no price: “buy 500 now”. It takes the best ask, then the next, until it is filled.

Limit order

You choose the price, but you may not trade.

Adds shares to the book: it provides liquidity.

Market order

You trade at once, but you do not know the exact price.

Takes shares from the book: it uses liquidity.

The spread is what impatience costs. If you buy at the ask and immediately sell at the bid, you lose the spread. Market makers, met in L1.1.05, earn that spread for keeping orders on both sides. The number of shares waiting at each price is the book's depth: a large market order eats through several price levels, and pays more for each one.

Price discovery: how news gets into the price

Prices move because orders move. When news arrives, people cancel orders that now look wrong and send new ones. Trades follow. The price where buying and selling balance again is the market's new estimate of what the share is worth. This is price discovery. Step through a morning with bad news.

Step throughA profit warning hits the book

1 / 6

08:59

A calm book

Best bid €39.98, best ask €40.02. The spread is €0.04, or 0.10% of the mid. Thousands of shares wait on each side.

Opening and closing auctions

Most stock exchanges do not use the continuous book at the very start and end of the day. Instead they collect orders for a few minutes and then set a single price at which the most shares can trade. The closing auction price is the one used for many index and fund valuations.

The formal version

Write bb for the best bid and aa for the best ask. The spread in money is simply a−ba - b. But a €0.04 spread means something very different on a €4 share and a €400 share, so traders compare spreads as a percentage of the price. This is the first formula in the course with letters for prices, so let's build it slowly.

The second formula is the average price a market order pays when it uses several levels. It is a weighted average: each price counts in proportion to the shares bought there. If the order buys q1q_1 shares at price p1p_1, q2q_2 at p2p_2 and so on:

average price=total cash paidshares bought=q1p1+q2p2+…q1+q2+…\text{average price} = \frac{\text{total cash paid}}{\text{shares bought}} = \frac{q_1 p_1 + q_2 p_2 + \dots}{q_1 + q_2 + \dots}

Conventions

Prices are in euros per share with a tick size of €0.01. Fees and taxes are ignored. Percentages are of the mid price before the trade.

Try it

This is the same book as in the text. Try three things: a market buy of 1,000 shares (watch the best ask move up); a limit buy of 300 at €40.00 (watch the spread narrow); then a big market sell of 4,000 (watch how far down it reaches). Reset whenever you like.

Try itA live order book

Open the percentage calculator →

Best bid

€39.98

Best ask

€40.02

Spread

€0.04

Mid

€40.000

Spread % of mid

0.100%

Bid sizePrice (€)Ask size
spread €0.04

Showing 6 levels a side. Total resting: 5,700 bid, 5,100 offered. Click a price to use it as a limit.

Your last order

Nothing sent yet. Start with a market buy of 1,000 shares and watch the best ask move.

Trades printed

No trades yet.

Worked example

A market order for 1,500 shares

Starting from the book above, a fund sends a market order to buy 1,500 shares. Prices in euros; fees ignored. Try each step before revealing it.

Walking the book

Step 1 of 5
  1. 1

    Before the trade

    Spread: €40.02 − €39.98 = €0.04. Mid: (€40.02 + €39.98) ÷ 2 = €40.00. Spread as % of mid: 0.04 ÷ 40.00 × 100 = 0.10%.

Regulatory lens

Rules make the order book public and fair. In the EU and UK, MiFID II requires trading venues to publish current bids and offers and every trade, and sets minimum tick sizes for shares. In the US, Regulation NMS (2005) requires brokers to send orders to the venue showing the best displayed price, rather than trade through it.

Looking ahead: the bid-ask spread is a cost in valuations too. Prudent valuation rules for banks include an adjustment for the cost of closing out a position, which returns in later levels.

Sparks

SparkPrices in eighths
Until 2001, US share prices were quoted in fractions of a dollar: eighths, then sixteenths. The smallest possible spread was 6.25 cents. When exchanges switched to decimal prices in 2001, the tick fell to one cent and spreads on busy shares narrowed sharply.
SparkA spread can say more than a price
When a market is calm, spreads are tight. When traders are unsure, spreads widen before prices have moved much. Risk managers watch spreads as an early warning, because a widening spread means it has become more costly to get out.

Key takeaways

  • An order book lists buy orders (bids) from the highest price down and sell orders (asks) from the lowest up.
  • Spread = ask − bid; mid = (ask + bid) ÷ 2; spread % = spread ÷ mid × 100.
  • Limit orders name a price and wait; market orders trade at once and walk the book.
  • A large market order pays a weighted average of several prices and moves the price: price impact.
  • Prices move because orders move. Price discovery is the book absorbing news, order by order.

Reaction

Check what stuck

Question 1 · objective 2

A bond is quoted 99.50 bid and 100.50 ask. What is the bid-ask spread as a percentage of the mid price, to two decimal places?

%

Question 2 · objective 3

Using the starting order book in this lesson (asks: 400 at €40.02, 600 at €40.03, …), what average price does a market order to buy 1,000 shares pay, in €, to three decimal places?

€

Question 3 · objective 3

The best ask is €40.02. You send a limit order to buy 300 shares at €39.99. What happens?

Question 4 · objective 1

What is the bid?

Question 5 · objective 4

A company announces much better profits than expected. What usually happens in its order book?

Glossary

Order book
The list of all buy and sell orders waiting to trade, sorted by price.
Bid
The highest price any buyer in the book is currently willing to pay.
Ask (offer)
The lowest price any seller in the book is currently willing to accept. Also called the offer.
Bid-ask spread
The gap between the best ask and the best bid.
Mid price
The price halfway between the best bid and the best ask.
Limit order
An order to buy or sell at a stated price or better. If it cannot trade at once, it waits in the book.
Market order
An order to buy or sell straight away at the best prices available, whatever they are.
Depth
How many shares are waiting at each price in the book.
Tick size
The smallest step by which a price can move, such as one cent.
Price discovery
The way trading between many buyers and sellers settles on a price that reflects what they all know.

Deep Dives & Origins

Deep Dives

  • Harris, Trading and Exchanges: Market Microstructure for Practitioners, Oxford University Press, 2003, the chapters on orders and order books. Intermediate.
  • O'Hara, Market Microstructure Theory, Blackwell, 1995. Advanced.

Origins

  • Harris, L., Trading and Exchanges: Market Microstructure for Practitioners, Oxford University Press, 2003.
  • O'Hara, M., Market Microstructure Theory, Blackwell, 1995.
  • US Securities and Exchange Commission, Regulation NMS, 2005.
  • Directive 2014/65/EU (MiFID II) and Regulation (EU) No 600/2014 (MiFIR), transparency provisions.

Watch this lesson

Video version

Prefer to watch? The same lesson as a 12-minute video will sit here, made from this page's script.