Matching Orders
Intermediateمطابقة الأوامر
Also known as: Order Matching, Matching Engine, Trade Matching
Last updated
Definition reviewed before publishing
Our content team writes and reviews every definition before it is published, and revisits it when the way a term is used in the markets changes. The date shows the latest change to this term.
Last updated on 25 November 2026
Matching orders is the process by which an exchange or trading platform pairs a buy order with a compatible sell order in price and quantity to execute a trade. Today it is done automatically by an electronic system called a matching engine, following published priority rules.
Quick summary
• Pairs compatible buy and sell orders to execute trades. • Run by an automated engine, usually with price-time priority. • A large order may be filled at several prices.
How it works
Orders arrive in the order book, where buy orders are ranked from the highest price to the lowest and sell orders from the lowest price to the highest. When a market order, or a limit order priced to meet the other side, arrives, the engine executes it immediately against the best available prices. Most markets apply price-time priority: the order with the better price is filled first, and among orders at the same price, the earliest one goes first. Some futures markets use pro rata allocation instead, splitting the quantity among orders at the same price according to their size. In opening and closing auctions, orders are collected for a period and then a single price is set that maximizes the quantity executed. If there is not enough quantity on the other side, the order is partially filled and the remainder stays in the book.
Example
A stock's order book shows two sell orders: 500 shares at 30 riyals, then 1,000 shares at 30.10. A market buy order for 800 shares arrives, so 500 shares are filled at 30 riyals and 300 shares at 30.10. The total cost is 24,030 riyals (500 × 30 + 300 × 30.10), and the average price is about 30.04 riyals (24,030 ÷ 800).
Where you will see it
In the order book and market depth screens, in trading rules published by exchanges, in brokers' execution policies, and in execution reports that show partial fills and the price achieved.
Why it matters
Matching rules explain why a limit order is sometimes filled after other orders at the same price, and why a large market order is filled at several prices. With this understanding, traders can choose order types and timing that reduce slippage and better judge the chances of their pending orders being filled.
How it is calculated
There is no single formula for matching, but average fill price = sum of (quantity filled × its price) ÷ total quantity filled.
How it differs from similar terms
• Execution: the final outcome of an order reaching the market, while matching is the mechanism that produces that execution on an exchange. • Market maker: a party that continuously quotes buy and sell prices and trades against clients, while matching pairs traders' orders with each other. • Cross-trade: offsetting buy and sell orders from the same broker's clients internally, which is subject to special regulatory limits.
Common mistakes
Confusing legitimate order matching with matched orders used for manipulation, where two parties agree to buy and sell between themselves to create fake trading volume. Matching is a regulated execution mechanism, while the latter is a prohibited practice that regulators penalize.