# Understanding Matching Orders: Trading Process, Examples, and Algorithms

> **Definition**
>
> Matching orders is the process used by an exchange to pair buy and sell orders to facilitate trades.

## What Are Matching Orders?

Matching orders is the process by which a securities [exchange](https://www.investopedia.com/terms/e/exchange.asp) pairs one or more unsolicited buy orders with one or more sell orders to make trades. This can be contrasted with [requests for a quote](https://www.investopedia.com/terms/r/request-for-quote.asp) (RFQ) in a security to proceed with a trade.

If one investor wants to buy stock and another wants to sell the same amount at the same price, their orders match, and the transaction takes place. The work of pairing these orders, order matching, identifies buy orders, or [bids](https://www.investopedia.com/terms/b/bid.asp), with corresponding sell orders, or [asks](https://www.investopedia.com/terms/a/ask.asp), to execute them. Over the past decade, this process has become almost entirely automated, often using algorithms such as FIFO or pro-rata. Quick and accurate matching is crucial for pricing and trade efficiency, especially with the rise of high-frequency trading.

### Key Takeaways

*   Matching orders pair buy and sell orders of equal value to facilitate trades on a securities exchange.
*   Exchanges use automated systems, predominantly implementing FIFO and pro-rata algorithms, to match buy and sell orders.
*   Quick and accurate order matching is critical to avoid inefficiencies and unfavorable trade prices.
*   Historically, orders were matched through face-to-face interaction; now, computer algorithms have streamlined the process.
*   High-frequency trading improves efficiency by prioritizing trades to maximize order volume in exchanges.

## Understanding the Order Matching Process

Matching the orders of buyers and sellers is the primary work of specialists and [market makers](https://www.investopedia.com/terms/m/marketmaker.asp) in the exchanges. The matches happen when compatible buy orders and sell orders for the same [security](https://www.investopedia.com/terms/s/security.asp) are submitted in close proximity in price and time.

A buy order and a sell order match if the buy price meets or goes above the sell price. From there, the computerized order-matching systems of different exchanges use a variety of methods to prioritize orders for matching.

> **Fast Fact**
>
> Today, most exchanges use computer algorithms for matching orders, but in the past, brokers did this face-to-face on the trading floor.

Fast and accurate order matching is crucial for exchanges. Active investors and [day traders](https://www.investopedia.com/terms/d/daytrader.asp) aim to minimize trading inefficiencies. A slow order-matching system can force trades at less-than-ideal prices, reducing profits. If order-matching methods favor buyers over sellers, they can be exploited.

This is where [high-frequency trading](https://www.investopedia.com/ask/answers/09/high-frequency-trading.asp) (HFT) has improved efficiency. Exchanges aim to prioritize trades in a way that benefits buyers and sellers equally so as to maximize order volume—the lifeblood of the exchange.

## Key Algorithms Used in Order Matching

All major markets have transitioned to electronic matching. Each securities exchange uses its own specific algorithm to match orders. Broadly, they fall under two categories: [first-in-first-out](https://www.investopedia.com/terms/f/fifo.asp) (FIFO) and [pro-rata](https://www.investopedia.com/terms/p/pro-rata.asp).

### FIFO: How First-In-First-Out Works

Under a basic FIFO algorithm, or price-time-priority algorithm, the earliest active buy order at the highest price takes priority over any subsequent order at that price, which in turn takes priority over any active buy order at a lower price. For example, if a buy order for 200 shares of stock at $90 per share precedes an order for 50 shares of the same stock at the same price, the system must match the entire 200-share order to one or more sell orders before beginning to match any portion of the 50-share order.

### Pro-Rata: Understanding Proportional Order Matching

Under a basic pro-rata algorithm, the system prioritizes active orders at a particular price, proportional to the relative size of each order. For example, if both a 200-share buy order and a 50-share buy order at the same price are active when a compatible 200-share sell order arrives, the system will match 160 shares to the 200-share buy order and 40 shares to the 50-share buy order.

Since the sell order is not large enough to fulfill both buy orders, the system will partially fill both. In this case, the pro-rata matching algorithm fills 80 percent of each order.

## The Bottom Line

Matching orders is the core process that connects buy and sell orders on securities exchanges, ensuring trades are executed quickly and efficiently. Once a manual task, it is now largely automated, which has revolutionized the speed and accuracy of trade execution.

DIfferent algorithms, such as FIFO and pro-rata, determine how orders are prioritized and filled, helping balance the interests of buyers and sellers. This automation has greatly improved trading efficiency, benefiting active traders in particular. High-frequency trading further drives this efficiency by keeping order volume high and markets liquid.