How a Stock Exchange Really Works
What actually happens in the microseconds after you tap 'Buy' — the order book, price-time priority, the full journey through the clearing corporation, how the opening price is discovered, and what happens when a trade goes wrong.
A stock exchange is an electronic marketplace that matches buyers and sellers in real time. Once you can follow one order from your phone all the way into your demat account — naming every hop it passes through — the market stops feeling mysterious, and you start placing orders with intent instead of guesswork.
You open your broker app, type a stock name, and tap 'Buy'. A second later it says 'Executed'. It feels like magic — but it is actually a precise, regulated process happening at incredible speed.
Behind that single tap, your order is risk-checked by your broker, travels to an exchange, joins a queue of thousands of other orders, gets matched against a willing seller by strict rules, is guaranteed by a clearing corporation, and is finally settled into your demat account the next trading day.
Understanding this journey makes you a better trader. You learn why some orders fill instantly and others do not, why prices 'jump' at 9:15, why the closing price is not the last price you saw, and what protects you when the person on the other side of your trade disappears.
What an Exchange Actually Does
The electronic marketplace
A stock exchange is a regulated, electronic platform whose single job is to match buy orders with sell orders, fairly and fast. In India, the two main equity exchanges are the NSE (National Stock Exchange) and the BSE (Bombay Stock Exchange).
The exchange itself does not decide a stock's price and does not take a side. It maintains an orderly marketplace where demand (buyers) and supply (sellers) meet. The price you see is the result of those forces, not a number the exchange sets.
Everything runs through a central system called the order matching engine, which processes an enormous volume of orders using fixed, published rules so that no participant gets unfair priority. Speed matters, but fairness of the rule matters more: the same logic applies to an order for 1 share and an order for 10 lakh shares.
A useful mental model is the railway reservation system. It does not decide who deserves a seat. It applies one published rule to every request in the order it arrives, and publishes the result. An exchange does the same thing with ownership instead of seats.
- An exchange is a regulated electronic platform that matches buyers and sellers
- NSE and BSE are India's two primary equity exchanges
- The exchange never sets prices or takes sides — demand and supply do
- A matching engine applies fixed, published rules at very high speed
The Order Book: Bids, Asks & the Spread
The market's live queue
At the heart of every stock is its order book — a live list of all pending buy orders (bids) and sell orders (asks, also called offers) at different price levels.
The highest price a buyer is currently willing to pay is the Best Bid. The lowest price a seller is currently willing to accept is the Best Ask. The gap between them is the spread (the cost of crossing from one side of the book to the other).
Your broker app usually shows the top five levels of each side. That view is called market depth, and it tells you two things at a glance: how far apart the two sides are, and how much quantity is waiting at each price.
The spread is a quiet but real cost. A tight spread means the stock is liquid (many buyers and sellers, close together). A wide spread means the stock is illiquid — and you can lose money the instant you buy, before the price has moved at all.
- The order book lists all pending bids and asks at each price level
- Best Bid = highest buy price waiting; Best Ask = lowest sell price waiting
- Spread = Best Ask − Best Bid; a tighter spread means more liquidity
- Market depth shows how much quantity is waiting at each price
How Orders Get Matched: Price-Time Priority
The rule that keeps it fair
The matching engine follows one core rule: price-time priority. Price comes first — the best price always gets matched ahead of a worse price. If two orders share the same price, time decides — whoever placed their order earlier gets filled first.
This is the railway queue again. A better price is like a higher-priority quota; among people in the same quota, the one who arrived first is served first. Nothing else — not your account size, not your broker — changes your place.
This explains a frustration every beginner meets. Your limit order at ₹500 sits unfilled while the screen shows trades at ₹500. That is not a glitch. There was quantity ahead of you at ₹500, it absorbed all the selling available at that level, and the price moved away before your turn came.
The rule is completely mechanical and blind to who you are. A retail order and an institutional order at the same price are treated by the same priority logic.
- Best price is matched first (price priority)
- At the same price, the earliest order is matched first (time priority)
- The engine is blind to participant identity — the rule is the same for all
- Your limit order can sit unfilled if others are ahead of you in the queue
Order Types Every Beginner Must Know
Market, Limit, Stop-Loss
How your order behaves depends on the order type you choose. Getting this right is one of the fastest ways to stop losing money to careless execution.
The core trade-off is simple, and it never goes away: you can have certainty of execution or certainty of price, but not both. A market order guarantees you trade; it does not guarantee at what price. A limit order guarantees the price; it does not guarantee you trade at all.
Stop-loss orders add a second layer: a trigger price that arms the order. Nothing sits in the order book until the trigger is touched. Until then the exchange is simply watching.
- Market order = speed and certainty of execution, but not of price
- Limit order = control of price, but not certainty of execution
- Stop-loss orders do nothing until the trigger price is touched
- SL becomes a limit order; SL-M becomes a market order once triggered
| Order type | What it does | You get | You do not get |
|---|---|---|---|
| Market | Executes immediately against the best available prices | Certainty of execution | Certainty of price |
| Limit | Executes only at your chosen price or better | Certainty of price | Certainty of execution |
| Stop-Loss (SL) | Places a limit order once a trigger price is touched | A defined exit with price control | A guaranteed fill in a fast move |
| Stop-Loss Market (SL-M) | Places a market order once the trigger is touched | A near-certain exit once triggered | Control over the exit price |
From App Tap to Demat Credit: The Full Lifecycle
Every hop your order takes, named
When you tap 'Buy', your order does not go straight to the exchange. It travels through a chain of regulated, accountable entities — and it is worth knowing every one of them, because when something goes wrong, knowing the hop tells you whom to ask.
The first four hops happen in well under a second. The last three happen over the next trading day, quietly, without you doing anything.
Nothing in this chain depends on trust between you and the stranger who sold you the shares. That is the whole design: the chain replaces trust with process.
- The broker's risk check happens before the exchange ever sees your order
- Matching creates the trade; it does not move any shares or money
- The clearing corporation becomes the counterparty to both sides
- Shares are credited by NSDL/CDSL into your own demat account, in your name
The Pre-Open Call Auction: How the Opening Price Is Found
Why 9:15 does not start from yesterday's close
Overnight, a lot happens — global markets move, results are announced, news breaks. If trading simply resumed at 9:15 from yesterday's close, the first few seconds would be chaos, and whoever had the fastest connection would take everyone else's money.
So the Indian market opens with a call auction instead of continuous trading. Between 9:00 and roughly 9:08, orders are collected but nothing is matched. Order entry closes at a randomised moment inside the final minute, so nobody can time the exact last instant. Between about 9:08 and 9:12 the exchange computes the opening price and executes the matched trades. From about 9:12 to 9:15 there is a buffer that carries the market into continuous trading.
The opening price is the equilibrium price — the single price at which the largest quantity can be traded, given every order that came in. If two prices would trade the same quantity, the exchange picks the one leaving the least unmatched quantity; if still tied, the one closest to the previous close.
Only limit and market orders are accepted in the pre-open. A market order placed here executes at the discovered equilibrium price, whatever it turns out to be. If no equilibrium price can be found because nothing overlaps, market orders are cancelled and limit orders are carried into the continuous session, where the opening price then becomes the first traded price.
- The pre-open is a call auction — orders are collected first, matched later
- Order entry closes at a random moment inside the final minute
- The opening price is the price at which the maximum quantity can trade
- A market order in the pre-open executes at whatever equilibrium price emerges
| Price | Cumulative buy quantity | Cumulative sell quantity | Quantity that can trade |
|---|---|---|---|
| ₹104 | 300 | 2,000 | 300 |
| ₹103 | 900 | 1,500 | 900 |
| ₹102 | 1,600 | 1,600 | 1,600 ← highest |
| ₹101 | 2,200 | 900 | 900 |
| ₹100 | 3,000 | 400 | 400 |
Liquidity: Why Some Stocks Are Far Safer to Trade
The difference between a price and a fill
Liquidity is how easily you can buy or sell without moving the price against yourself. It is the single most underrated risk a beginner takes.
High-volume stocks are liquid: tight spreads, deep quantity at each price level, and easy fills in either direction. Low-volume stocks are illiquid: wide spreads, thin quantity, and a price that jumps several percent because one person sold 500 shares.
The trap is that an illiquid stock's screen price looks just as solid as a liquid one's. It is not. A price with no quantity behind it is a quotation, not a market. You discover the difference on the day you want to exit in a hurry.
Two habits protect you: read the traded quantity and market depth before you buy, and never take a position so large that you are a meaningful share of a stock's daily volume. If your exit would itself be the day's biggest trade, you do not have an exit.
- Liquidity = how easily you trade without moving the price
- Liquid stocks: tight spreads and deep quantity; illiquid: wide spreads and thin quantity
- A screen price with no quantity behind it is a quotation, not a market
- Never let your position be a large share of a stock's daily traded volume
Clearing & Settlement: The T+1 Cycle
How shares actually reach your demat
A matched trade is only a promise. The shares and money must still change hands — that is clearing (working out who owes what) and settlement (actually moving it).
India runs equities on a T+1 rolling settlement cycle. 'T' is the trade day. 'T+1' is the next trading day, when money leaves the buyer, shares leave the seller, and each side receives what it is owed. Note the word trading: weekends and exchange holidays are skipped, so a Friday trade settles on Monday.
Clearing is netting. If your broker's clients bought 10,000 shares of a stock and sold 6,000 on the same day, the broker's net obligation to the clearing corporation is 4,000 shares, not 16,000. Netting is why an enormous volume of trades settles with a far smaller movement of money and stock.
This is also why you hold three linked accounts: a bank account (money), a demat account (your shares, held electronically at NSDL or CDSL in your own name), and a trading account (which places orders). SEBI has moved to direct pay-out, so shares are credited by the clearing corporation straight into your demat account rather than sitting in a broker's pooled account first.
Alongside the standard T+1 cycle, SEBI has been introducing an optional same-day (T+0) settlement in phases for a limited set of stocks. It runs beside T+1 rather than replacing it, so check what your broker and the stock actually support before assuming same-day credit.
- T = trade day; T+1 = the next trading day, when settlement completes
- Weekends and exchange holidays are skipped when counting T+1
- Clearing nets obligations so only the difference actually moves
- Shares are credited directly into your own demat account at NSDL/CDSL
What a Clearing Corporation Actually Guarantees
Why counterparty risk is not yours
You bought 100 shares from a stranger. You have never met them, you do not know their name, and you have no way to sue them. So why is it safe?
Because the moment your trade is registered, a clearing corporation legally steps into the middle through a process called novation. Your single trade with a stranger becomes two trades: you versus the clearing corporation, and the clearing corporation versus the seller. It becomes the buyer to every seller and the seller to every buyer. In India, NSE trades clear through NSE Clearing and BSE trades through Indian Clearing Corporation.
This is what a settlement guarantee means. If the seller fails to deliver, that is now the clearing corporation's problem to solve, not yours. It buys the shares in an auction, or compensates you in cash, and recovers the cost from the defaulter. You are made whole either way.
The guarantee is backed by real money, not goodwill. Clearing members post margins upfront on every position — a value-at-risk margin sized to cover normal daily moves, an extreme loss margin for abnormal ones, and mark-to-market settlement of losses. Above that sits a Core Settlement Guarantee Fund contributed by the clearing corporation, the exchange, and its members, specifically to absorb a default.
Understand the boundary, though. The clearing corporation guarantees that the trade settles. It guarantees nothing about the price, and it does not protect you from a bad decision, a bad company, or a broker misusing your money — those are different protections, with different mechanisms.
- Novation replaces your unknown counterparty with the clearing corporation
- It becomes the buyer to every seller and the seller to every buyer
- The guarantee is funded by upfront margins and a Core Settlement Guarantee Fund
- It guarantees settlement of the trade — never the price or the quality of the company
| Guaranteed by the clearing corporation | Not guaranteed by anyone | |
|---|---|---|
| The other side delivering | Yes — you receive shares or compensation | — |
| Your money being paid out | Yes, on the settlement date | — |
| The price you paid | — | Fully at market risk |
| The company's future | — | Entirely your own research risk |
When a Trade Goes Wrong: Short Delivery & the Auction
What happens if the seller fails to deliver
Occasionally a seller does not deliver the shares by the settlement deadline. This is called short delivery, and the system has a specific, mechanical answer for it.
The clearing corporation runs an auction session on the settlement day, in which other market participants offer to sell the missing shares. Whatever quantity is bought in that auction is delivered to the buyer who was waiting. The buyer's side is completed, one day later than normal, and the buyer is not penalised — the fault was not theirs.
The defaulting seller pays for the fix. They receive the auction price rather than the price they sold at, so if the auction fills higher than their sale, they absorb the difference plus the exchange's charges.
If the auction finds no seller at all, the trade is closed out in cash instead. The standard close-out formula in the equity segment takes the higher of two numbers: the highest price the stock traded at between the trade day and the auction day, or 20% above the closing price on the auction day. That deliberately harsh formula exists to make failing to deliver expensive enough that nobody does it casually.
You will meet this most often from the other direction — as the accidental defaulter — which is why the next lesson on settlement and market timings covers it in detail.
- Short delivery = the seller fails to deliver shares at pay-in
- The clearing corporation runs an auction to source the missing shares
- The buyer is protected; the defaulting seller pays the difference and charges
- If the auction fails, close-out uses a deliberately punitive formula
Circuit Breakers: Index-Level and Stock-Level
The brakes built into the market
Markets are allowed to fall. They are not allowed to fall in an uncontrolled, panic-driven spiral with no time for anyone to think. Circuit breakers are the brakes, and they work at two different levels.
Market-wide circuit breakers apply to the whole market and are triggered by moves in the benchmark indices — Nifty 50 or Sensex, whichever breaches a threshold first. There are three thresholds: 10%, 15% and 20%. What happens next depends on both the threshold and the time of day, because a shock at 9:30 needs a longer cooling-off period than one at 15:00. After a halt, trading restarts with a fresh pre-open call auction so that a single price is rediscovered rather than raced to.
Stock-level price bands work differently. Each stock has a daily band — commonly 2%, 5%, 10% or 20%, depending on the security and its surveillance category — beyond which no order can be placed that day. Hitting the top of the band is called an upper circuit; hitting the bottom is a lower circuit. Stocks on which derivatives are traded generally have a wider, dynamic band that the exchange can flex during the day rather than a hard freeze.
Understand what a circuit does and does not do. It stops the price moving further that day. It does not create buyers. A stock stuck at its lower circuit with no bids means there is no one to sell to at any permitted price — the brake has stopped the fall on the screen, not the problem underneath.
- Market-wide breakers trigger at 10%, 15% and 20% on Nifty 50 or Sensex
- The halt length depends on when in the day the breach happens
- Trading resumes through a fresh pre-open call auction after a halt
- Stock-level price bands cap how far one stock can move in a day
| Trigger | Before 13:00 | 13:00 to ~14:30 | After ~14:30 |
|---|---|---|---|
| 10% move | 45-minute halt | 15-minute halt | No halt |
| 15% move | 1 hour 45 minute halt | 45-minute halt | Trading halted for the day |
| 20% move | Halted for the day | Halted for the day | Halted for the day |
Putting It Together: Why the Machinery Should Make You Careful, Not Casual
Trust the plumbing, respect the risk
Step back and look at what you now know. Your order is risk-checked, queued by a published rule, matched by an identity-blind engine, guaranteed by a margin-backed clearing corporation, settled on a fixed cycle, and credited into an account held in your own name at a depository.
That is an extraordinarily robust chain, and it is worth appreciating. You can trade with a complete stranger for lakhs of rupees and never once need to trust them personally.
But notice exactly what the chain protects. It protects the process. Every single one of those safeguards concerns whether the trade completes correctly — not whether it was a good idea. There is no mechanism anywhere in the market that protects you from overpaying, over-sizing, or buying a business you have not understood.
That is the correct division of labour. The exchange handles the mechanics flawlessly so that you are free to spend all your attention on the only part it cannot do for you: deciding what to own, how much, and when to step away.
- The chain guarantees the process, not the outcome
- Counterparty risk is engineered away; market risk is not
- Your shares are held in your own name at a depository, not by your broker
- The only risk left for you to manage is the one that actually decides your results
Frequently Asked Questions
Does the stock exchange decide the price of a stock?
No. The exchange only matches buyers and sellers. The price is set by demand and supply — the highest price a buyer will pay meeting the lowest price a seller will accept. The exchange is a neutral referee, not a price-setter, which is why the same stock can quote slightly differently on NSE and BSE at the same instant.
What is the difference between a market order and a limit order?
A market order executes immediately against the best available prices — certainty of execution, no certainty of price. A limit order executes only at your specified price or better — certainty of price, no certainty of execution. In an illiquid stock a market order can fill several percent away from the last traded price, so use limit orders there.
What does T+1 settlement mean?
T is the trade day and T+1 is the next trading day, when money and shares actually change hands. Buy on Monday and the shares are credited to your demat on Tuesday; buy on Friday and they arrive on Monday, because weekends and exchange holidays are skipped. SEBI has also been introducing an optional same-day T+0 settlement in phases for a limited set of stocks.
Why didn't my limit order get filled even though the price reached it?
Price-time priority. Other orders at the same price were placed before yours and sit ahead of you in the queue. If the available quantity at that price is used up before your turn arrives, the price can move away without ever filling you. Nothing is wrong — you were simply later in the line.
How is the opening price at 9:15 decided?
Through the pre-open call auction. Orders are collected from 9:00 without being matched, entry closes at a randomised moment near 9:08, and the exchange then computes the equilibrium price — the single price at which the maximum quantity can trade. Every matched order executes at that one price, and continuous trading begins at 9:15.
What happens if the person on the other side of my trade defaults?
You are protected. Through novation, the clearing corporation becomes the buyer to every seller and the seller to every buyer, backed by upfront margins and a Core Settlement Guarantee Fund. If a seller fails to deliver, the clearing corporation sources the shares in an auction or compensates you in cash and recovers the cost from the defaulter.
What is an upper circuit and a lower circuit?
They are the top and bottom of a stock's permitted price band for the day — commonly 2%, 5%, 10% or 20% depending on the security and its surveillance category. Once a stock is locked at a circuit, no order can be placed beyond it that day. Being at a lower circuit is not a floor; it usually means no buyer exists at the permitted price.
Founder of Mr. Chartist. Helping Indian retail traders learn the markets the right way — price action, risk, and real businesses over hype.