WealthJot.ai

How Buyers and Sellers Get Matched

beginner7 min read

The order book and the price-time priority rule that decides who trades with whom.

At the heart of the exchangeA regulated marketplace where shares are bought and sold. is one fast, fair, dumb machine: the matching engine. It keeps a live list of every buy and sell order — the order bookThe live list of buy and sell orders for a stock. — and pairs them by two simple rules.

Price-time priority

  • Price first: the highest bid and the lowest ask get matched first — best prices win.
  • Time second: among equal prices, whoever placed the order earlier gets filled first.

A trade happens only when a buyer’s bid meets a seller’s ask at the same price. If the best buyer offers ₹100 and the best seller wants ₹101, nothing trades — until someone moves. That gapA jump between one bar’s close and the next bar’s open. is the spreadThe gap between the highest buy price and lowest sell price. (next lesson).

No human decides who you trade with. It’s a transparent, rule-based queue: best price, then first in line. Once you see the market as an order bookThe live list of buy and sell orders for a stock., “the price” stops being mysterious — it’s just where the top of the buy queue meets the top of the sell queue.
Key takeawayThe matching engine pairs orders by price-time priority: best price first, earliest order next. A trade occurs only when bid meets ask.
FAQs
What is the order book?

A live, ranked list of all outstanding buy orders (bids) and sell orders (asks) for a stock, with their prices and quantities. The “market depth” view in your trading app shows the top few levels of it.