Order books and auctions: matching, the pre-open session and liquidity
Every trade on an Indian exchange is matched by a computer following strict rules. How the limit order book works and how a market order 'walks the book', step by step; why price and time priority matter; how call auctions set the opening price and, since August 2026, the closing price of F&O stocks on NSE; the 2012 'flash crash' when one mistaken order emptied the book; and what crossing the spread costs an active trader, with a calculator.
Facts reviewed Oct 2026
Stock Market Basics showed what happens when you press Buy: the order goes to the exchange, and is matched, cleared and settled. This module opens up each of those steps.
It starts with the heart of the exchange: the order book, and the matching engine that pairs buyers with sellers millions of times a day.
The limit order book
A limit order says: buy (or sell) this many shares, at this price or better. The exchange keeps, for each share, a list of all limit orders that haven’t yet been filled:
- Bids: orders to buy, sorted from the highest price down.
- Asks (or offers): orders to sell, sorted from the lowest price up.
The highest bid and the lowest ask are the best bid and offer. The gap between them is the bid-ask spread. A quote screen usually shows the top five price levels on each side, with the quantity at each: the market depth.
| Bid qty | Bid (₹) | Ask (₹) | Ask qty |
|---|---|---|---|
| 1,200 | 499.50 | 500.50 | 800 |
| 3,500 | 499.00 | 501.00 | 2,100 |
| 5,000 | 498.50 | 501.50 | 4,000 |
Here the spread is ₹500.50 − ₹499.50 = ₹1.
Matching: price, then time
Indian exchanges use price-time priority:
- A better price is filled first: the highest bid, or the lowest ask.
- At the same price, the earlier order is filled first.
A market order says: buy (or sell) now, at whatever price it takes.
Worked example: walking the book. You place a market order to buy 1,000 shares, against the book above.
- First level: 800 shares at ₹500.50. Cost: 800 × ₹500.50 = ₹4,00,400. You still need 200.
- Second level: 200 of the 2,100 shares at ₹501.00. Cost: 200 × ₹501 = ₹1,00,200.
- Total cost: ₹5,00,600 for 1,000 shares.
- Average price: ₹500.60. That’s 10 paise above the best ask.
Bigger orders walk the book further, paying worse prices at each level. That’s why big investors split their orders over time. (Algorithmic & Systematic Trading covers how.) A limit order that doesn’t cross the spread simply joins the queue and waits.
Two buy orders sit at ₹250.00: A placed at 10:01, and B at 10:03. A new sell order, for fewer shares than A's, arrives at ₹249.95. What happens?
The sell order crosses the best bid, so it trades at the resting order's price, ₹250. At the same price, the earlier order (A) has time priority.
A real case: the 2012 “flash crash”
On the morning of 5 October 2012, the Nifty 50 fell more than 15% in seconds.
The cause was a mistake at a broker, Emkay Global. A dealer, placing an order for an institutional client, typed the order’s value where the quantity should have gone. The system sent out 59 sell orders for baskets of Nifty shares, worth more than ₹650 crore in all.
Those were, in effect, huge market orders. They walked the book of every Nifty company, filling against lower and lower bids until there were hardly any left. The fall tripped the index circuit breaker, and trading halted for about 15 minutes. It restarted with a pre-open auction, and prices recovered. NSE refused to cancel the trades, and Emkay bore losses of about ₹51 crore.
The lesson: an order book is only as deep as the orders resting in it. A big enough market order will find prices nobody expected.
Call auctions
Continuous matching works well during the day. But at the open and close, orders pile up and prices are uncertain. So exchanges use call auctions:
- Orders are collected for a few minutes, without matching.
- The exchange then finds the single price that maximises the quantity traded: the equilibrium price.
- All matched orders trade at that one price.
Worked example: an auction. At each possible price, add up the buy orders willing to pay that price or more. Then add up the sell orders willing to accept that price or less.
| Price (₹) | Buy qty at this price or higher | Sell qty at this price or lower | Tradeable |
|---|---|---|---|
| 101 | 2,000 | 9,000 | 2,000 |
| 100 | 5,000 | 6,000 | 5,000 |
| 99 | 8,000 | 3,000 | 3,000 |
- At each price, the tradeable amount is the smaller of the two quantities.
- At ₹101: only 2,000 buyers, so 2,000 trade.
- At ₹100: 5,000 buyers and 6,000 sellers, so 5,000 trade.
- At ₹99: only 3,000 sellers, so 3,000 trade.
- Auction price: ₹100, where the most shares can trade. 1,000 sell orders at ₹100 are left over.
The pre-open session runs from 9:00 to 9:15 am. Orders are collected for about eight minutes, then matched to set the opening price, with a short buffer before continuous trading starts at 9:15. Pre-open auctions are also used on a share’s listing day after an IPO, and when trading resumes after a halt, as in 2012.
The closing auction. Since 3 August 2026, shares in NSE’s F&O segment end continuous trading at 3:15 pm. They then go into a closing auction session that sets their official closing price. Other shares keep a closing price based on the volume-weighted average of the last half hour. (As of October 2026.) An auction is harder to push around than a few last-minute trades, which matters because closing prices settle derivatives and value funds.
Liquidity: spread, depth and resilience
A liquid share has:
- a tight spread: a fraction of a percent for big companies, sometimes just one tick (the smallest price step);
- a deep order book, with large quantities near the best prices;
- resilience: the book refills quickly after a big trade.
Illiquid shares have wide spreads and thin books. Trading them is expensive, and prices can jump on small orders.
The cost of crossing the spread
Every time you buy at the ask and sell at the bid, you pay the spread. For an occasional investor, it’s small. For an active trader, it adds up.
Worked example. A trader buys and sells 200 shares of a ₹500 share, with a ₹1 spread, 20 times a month.
- Spread as a share of price: ₹1 ÷ ₹500 = 0.2%.
- Cost per round trip: ₹1 × 200 = ₹200.
- Cost a year: ₹200 × 20 × 12 = ₹48,000.
- Compared with the position: each trade is worth about ₹1 lakh. So the spread alone costs 48% of it a year, before brokerage, STT and other charges.
Spread cost only: brokerage, STT, exchange charges, GST and stamp duty come on top. The defaults: a 0.2% spread costs ₹200 per round trip and ₹48,000 a year, 48% of the ₹1 lakh position. Halve the trading and the cost halves.
Going further: who provides the resting orders? Every limit order sitting in the book offers free options to everyone else. A bid at ₹499.50 tells the market that anyone may sell to it at ₹499.50, until it’s cancelled. If bad news hits, faster traders sell into that bid before its owner can react. So people who post limit orders face the risk of being “picked off”. In return, they earn the spread when patient traders cross it. That trade-off, earning the spread versus being picked off, is the business of market makers, the subject of the next lesson. It also explains why spreads widen in volatile moments: posting orders becomes riskier, so fewer people do it, and those who do ask for more.
Common mistakes
- Using market orders in thin books. You may walk the book to bad prices.
- Ignoring the spread. For frequent traders, it can cost more than brokerage.
- Assuming the last price is the price you’ll get. You buy at the ask and sell at the bid.
- Placing big orders all at once. Split them, or use limit orders.
- Trading at the open without understanding the auction. The opening price is set by the pre-open match.
Practice 1: A share has a ₹2 spread on a ₹200 price. You trade 100 shares, 10 round trips a month. What's the yearly spread cost?
- Spread as a share of price: ₹2 ÷ ₹200 = 1%.
- Per round trip: ₹2 × 100 = ₹200.
- A year: ₹200 × 10 × 12 = ₹24,000.
- Against the ₹20,000 position: 120% a year.
Illiquid shares make frequent trading ruinous. Enter 199, 201, 100 and 10 in the calculator to check.
Practice 2: In an auction, buyers willing at ₹50 or more total 4,000 shares and sellers at ₹50 or less total 3,500. At ₹51, buyers total 2,500 and sellers 6,000. At ₹49, buyers total 6,000 and sellers 1,500. What's the auction price?
- At ₹51: the smaller of 2,500 and 6,000 is 2,500.
- At ₹50: the smaller of 4,000 and 3,500 is 3,500.
- At ₹49: the smaller of 6,000 and 1,500 is 1,500.
- Auction price: ₹50, where the most shares, 3,500, can trade.
Key takeaways
- The order book lists bids and asks by price. The spread and depth measure liquidity.
- Matching follows price-time priority. Market orders walk the book: 1,000 shares in the example cost an average ₹500.60, not ₹500.50.
- On 5 October 2012, mistaken orders worth over ₹650 crore emptied the Nifty’s books and knocked the index down more than 15% in seconds.
- Call auctions find the price that trades the most shares. The pre-open (9:00–9:15 am) sets the open. Since 3 August 2026, a closing auction sets the close for F&O shares on NSE.
- Crossing the spread is a real cost that grows with trading, and with illiquidity.