Prefer to watch? This article is also a video.
How Buying a Share Works: One Tap, Six Stops
Buying a share happens in two parts. In the first second, the exchange finds you a seller. The next working day, your money and the shares actually change hands. Along the way, your order makes six stops:
- Your phone: you tap Buy.
- Your broker (Zerodha, Groww, Upstox, whichever you use) checks the order.
- The exchange matches it with a seller. Your app says Executed.
- The clearing corporation guarantees the trade and settles it.
- The depository, CDSL or NSDL, moves the shares.
- Your demat account receives them, in your name.
If it helps, picture a vegetable mandi. Only licensed agents can trade on the floor, so you go through one: that’s your broker. The mandi official writes every offer in a register and matches buyers to sellers: that’s the exchange. A guarantor makes sure both sides deliver: the clearing corporation. And a locker keeps the goods safe in your name: the depository.
Stop 1: Your Broker Checks the Order
Before anything reaches the exchange, your broker runs a few checks in milliseconds. Do you have the money? Is the price inside the day’s allowed range? Is the quantity allowed?
The point is that a bad order never reaches the exchange. Fail a check and you see Rejected right away. Pass, and the order goes to the exchange, because only registered brokers are allowed to connect to it.
When you open an account, your broker actually gives you two: a trading account, used to place orders, and a demat account, where the shares you buy are held.
Stop 2: How the Exchange Matches Orders (the Order Book)
The exchange keeps an order book for every stock: everyone who wants to sell, and everyone who wants to buy, at what price. Here is one for HDLABS (my own company, not listed anywhere; it just keeps the numbers simple):
| Side | Price | Order | Shares |
|---|---|---|---|
| Sell | ₹101.00 | #1 | 50 |
| Sell | ₹100.50 | #2 (arrived first) | 30 |
| Sell | ₹100.50 | #3 | 20 |
| Buy | ₹100.00 | #4 | 40 |
| Buy | ₹99.50 | #5 | 60 |
The cheapest seller wants ₹100.50; the best buyer offers ₹100. Nobody trades yet, because the seller wants more than the buyer will pay. That gap is the spread.
Two rules decide who trades with whom:
- Best price first. A buyer should always get the cheapest seller.
- At the same price, first come, first served. Whoever was waiting longer goes first, because that’s fair.
Now you tap Buy: 40 shares at market price. The best price is ₹100.50, and order #2 was there first, so you take all 30 of its shares. You still need 10, so you take them from order #3, the next in line. Its other 10 shares stay in the book. Forty shares, two trades, ₹4,020, and the whole thing takes microseconds. Your app says Executed.
The prices you see in that order book reach your app through the exchange’s market data feed: see How Market Data Reaches Your Screen.
For engineers: those two rules shape the data structure. Prices are kept sorted, so the best price is always at hand, and each price holds a first-in, first-out queue of orders.
The Rules Don’t Pause
On 15 September 2008, the day Lehman Brothers collapsed, I was at the New York Stock Exchange, on the floor where the engineering team and the data centre were. Screens were turning red, and nobody could do anything about it. There is no pause button. Matching carried on, one order after another, exactly as it was built to, and the market data systems sent every trade out to the world as it happened.
That day taught me what an exchange really has to be: calm, when nobody else is.
Stop 3: Clearing and T+1 Settlement
Executed is day T. But at this point no money and no shares have moved.
The moment the trade is executed, the clearing corporation (NSE Clearing, for trades on NSE) steps in. It becomes the buyer to every seller and the seller to every buyer. You never have to trust the stranger on the other side of your trade; you only have to trust the clearing corporation.
Through the day it adds up every trade, and only the difference moves. If a broker’s clients buy 1,000 shares of a stock and sell 900, only 100 need to move. That means far fewer transfers, and far less to go wrong.
Why not settle instantly? Every trade has to be checked, the money collected and the shares lined up. So on the next working day, T+1, the money goes to the sellers and the shares come to you.
Stops 4–6: Into Your Demat Account
The shares move at the depository, CDSL or NSDL, and land in your demat account, in your name. That raises the question most people never ask: if the shares are at the depository, what exactly does your broker hold? The answer is in the next post: Who Actually Holds Your Shares?
The Whole Journey
Two parts. In the first second, your broker checks the order and the exchange matches it: best price first, then first come. Executed. The next working day, the clearing corporation settles it, and the shares land in your demat account, in your name. That is how buying shares in India works, every time, on NSE or BSE.
HDLABS is used as an example only. HD Labs is the author’s company and is not listed on any stock exchange. This article explains how the systems work. It is not financial or investment advice, and limits and rules change: check the current ones with SEBI, your broker or the exchange.