Loading...
FinchTrade

Definition

Order Matching in Trading: Engines, Algorithms, and Examples

Order matching converts compatible buy and sell orders into trades. Understand matching engines, priority rules, partial fills, and execution risks.

Order matching is the process of bringing compatible buy and sell orders together to execute trades. On electronic order-driven venues, compatibility depends on price, available quantity, order instructions, and the venue’s execution rules.

How Order Matching Works

An electronic order book holds eligible resting buy and sell orders. The matching engine processes incoming orders and updates that book. Its matching algorithm determines which eligible orders receive priority and how executable quantity is allocated. These are separate elements of order matching: storage, processing, and execution rules.

In a continuous order book, a buy limit can trade against eligible offers at or below its maximum price. A sell limit can trade against eligible bids at or above its minimum price. The submitted limits need not be identical; the execution price follows venue rules.

When an order arrives, the engine identifies compatible opposing orders, applies priority rules, allocates quantity, and records any resulting trades. One incoming order can fill against several resting orders, potentially at several prices. Filled quantities are removed from the book, while remaining quantities are handled according to order instructions.

A Hypothetical Order-Matching Example

In a hypothetical book, the only sell orders offer four units at $100 and six units at $101. An incoming limit order seeks 12 units with a $101 ceiling. Assuming execution at resting-order prices and best-price priority, it buys four units at $100 and six at $101. The submitted buy and sell limits differ on the first fill, but their prices are compatible. Only ten units execute, leaving two unfilled. Those two may rest as a bid at $101 if the order instructions permit.

FinchTrade services

Price-Time Priority and Pro-Rata Allocation

  • Price Priority: Price-time priority ranks higher bids and lower offers ahead of worse prices on their respective sides. Pro-rata allocation distributes quantity among eligible resting orders at a given executable price level.
  • Allocation at One Price: At the same price, price-time priority fills earlier eligible orders first, commonly called first in, first out (FIFO). Pro-rata distributes executable quantity in proportion to eligible order sizes, subject to venue-specific rounding and allocation rules.
  • Partial Fills: Under FIFO, an earlier order may fill fully while later orders receive nothing. Under pro-rata, several eligible orders at that price may each receive a partial fill.

Price-time priority is a common model for order matching, not a universal standard. The venue sets the applicable algorithm; an individual trader does not choose it for an order.

Order Instructions and Execution Risks

A market order seeks available opposing liquidity without specifying a limit price. It can receive multiple fill prices, experience slippage relative to an expected price, or fail to fill completely. A limit order constrains acceptable prices but does not guarantee execution. Unmatched quantities may rest, expire, or be canceled according to time-in-force instructions and venue rules.

Order matching cannot supply missing counterparties or guarantee liquidity. Rapid price changes can leave less liquidity available or lead to unfavorable prices within an order’s constraints; they do not make incompatible limits valid matches. Heavy message traffic can strain processing capacity, while deceptive orders can distort apparent supply and demand. Infrastructure, surveillance, and risk controls support venue operation but are not themselves matching algorithms.

After Trade Execution

Order matching contributes to price discovery by converting available trading interest into executed prices, but it does not establish a uniquely fair price. Execution is also distinct from clearing and settlement. Clearing determines post-trade obligations and may involve netting or a central counterparty, depending on the market. Settlement completes the transfer of cash and assets under the applicable arrangements.

Power your growth with seamless crypto liquidity

A single gateway to liquidity with competitive prices, fast settlements, and lightning-fast issue resolution

Get started