How It Works? Inside a Stock Exchange
How Stock Exchanges Match Buyers and Sellers
Bilkul Bazaar | Sunday Special
Every day, millions of shares are bought and sold on stock exchanges. Investors simply click “Buy” or “Sell” through their trading apps, and within seconds, a transaction may be completed.
But what happens behind that simple click?
How does the exchange find a buyer for every seller and a seller for every buyer? Who decides the price at which a share is traded?
The answer lies in an electronic system called the order book, which continuously matches compatible buy and sell orders.
1. It Starts With an Investor’s Order
When an investor wants to buy a share, they place a buy order through their stockbroker. Similarly, an investor who wants to sell places a sell order.
For example, an investor may place an order to:
- Buy 100 shares of a company at ₹500 each
- Sell 100 shares at ₹500 each
The order is electronically transmitted by the broker to the stock exchange.
2. What Is an Order Book?
The stock exchange maintains an electronic order book containing outstanding buy and sell orders.
It has two sides:
Buy Side — Bids
This shows the prices buyers are willing to pay.
For example:
| Buyer | Quantity | Price |
| A | 100 shares | ₹500 |
| B | 200 shares | ₹499 |
| C | 150 shares | ₹498 |
The highest buying price is normally at the top.
Sell Side — Offers
This shows the prices sellers are willing to accept.
| Seller | Quantity | Price |
| X | 100 shares | ₹500 |
| Y | 200 shares | ₹501 |
| Z | 150 shares | ₹502 |
The lowest selling price is normally at the top.
The difference between the highest bid and lowest ask is called the bid-ask spread.
3. The Exchange Looks for a Match
Now imagine that Buyer A is willing to pay ₹500 for 100 shares, while Seller X is willing to sell 100 shares at ₹500.
The prices match.
The exchange’s trading system automatically matches the two orders and a trade takes place.
The buyer receives the shares and the seller receives the money through the settlement process.
There is no employee sitting at a desk manually pairing buyers and sellers. The matching is performed electronically according to predefined rules.
4. Price Priority Comes First
One of the most important principles in order matching is price priority.
Suppose three investors want to buy the same share:
- Investor A offers ₹500
- Investor B offers ₹499
- Investor C offers ₹498
The ₹500 bid has priority because it offers the seller the highest price.
Similarly, on the selling side, a seller offering the lowest price generally gets priority.
This is why the best available buying and selling prices are at the front of the order book.
5. What Happens When Prices Are the Same?
Suppose two investors both want to buy shares at ₹500.
- Investor A places the order at 10:01:05
- Investor B places the order at 10:01:08
Investor A’s order generally gets priority because it arrived first.
This is known as time priority.
So, in simple terms, the system broadly follows:
Better price first → Earlier order next
This helps create an organised and transparent marketplace.
6. What If the Buy and Sell Prices Don’t Match?
Suppose a buyer is willing to pay only ₹498, while the lowest seller is asking ₹500.
There is no immediate match.
The buyer’s order can remain in the order book, waiting for a seller willing to sell at ₹498 or lower.
Similarly, the seller’s order may remain in the order book until a buyer is willing to pay the asking price.
This is why an order does not always get executed immediately.

7. Market Orders Work Differently
An investor can also place a market order, which instructs the system to buy or sell at the best available price rather than specifying a particular price.
For example, if the best available sell orders are:
- 100 shares at ₹500
- 200 shares at ₹501
- 300 shares at ₹502
A market order to buy 250 shares could be filled partly at ₹500 and partly at ₹501.
Therefore, the final price may differ from the price the investor expected, particularly in a less liquid or highly volatile stock.
8. Who Actually Determines the Share Price?
There is no single person deciding that a share should trade at ₹500 or ₹501.
The price emerges from the interaction between demand and supply.
If more buyers are willing to pay higher prices, the traded price can move upward.
If more sellers are willing to sell at lower prices, the price can move downward.
This continuous process of buying and selling is what creates the market price investors see on their screens.
9. What Happens After the Trade?
Once a buy and sell order are matched, the trade is recorded by the exchange.
But the process does not end there.
The transaction then moves through the clearing and settlement system, where the obligations of the buyer and seller are completed.
In India, the standard settlement cycle for many equity trades is T+1, meaning settlement generally takes place one working day after the trade date, subject to the applicable rules and exceptions.
The buyer ultimately receives the shares in their demat account, while the seller receives the sale proceeds.
10. Why Does This System Matter?
The electronic order-matching system allows stock exchanges to handle an enormous number of transactions quickly and systematically.
It provides:
- Speed — orders can be matched in fractions of a second.
- Transparency — available bids and offers form an organised order book.
- Fairness — predefined matching rules determine priority.
- Liquidity — large numbers of buyers and sellers can participate in the same marketplace.
- Efficiency — investors do not have to personally find someone willing to take the opposite side of their trade.
The Simple Logic Behind the Market
At its core, the stock market is based on a remarkably simple principle:
One investor wants to buy. Another investor wants to sell. The exchange’s trading system brings compatible orders together.
The price at which they meet becomes the price of the trade.
So, the next time you press “Buy” on your trading app and see your order executed almost instantly, remember that an electronic marketplace is continuously comparing thousands of buy and sell orders to find the right match.
A stock exchange matches buyers and sellers electronically, primarily using price and time priority, allowing trades to happen quickly and systematically.
Note: We seek Sponsors for this column. Please connect with us at editorbilkul@gmail.com