Order Types and How Exchanges Match Trades
How order matching works on crypto exchanges: market, limit and stop orders, price-time priority, maker and taker fees, partial fills and common mistakes.
Order matching is the process an exchange uses to pair buy orders with sell orders: on most centralized crypto exchanges, a matching engine keeps an order book of resting orders and fills each new order against the best opposite price, with earlier orders at the same price filled first. The order type you choose, such as market, limit or stop, decides whether your order trades immediately, waits for a price, or triggers only under certain conditions.
Understanding this mechanism helps you predict what price you will actually get, why fees differ for makers and takers, and why orders sometimes fill partially or not at all. It is basic knowledge that saves money on every trade.
The Order Book and the Matching Engine
An order book is a live list of all open buy orders (bids) and sell orders (asks) for a trading pair. Bids are sorted from highest to lowest price; asks from lowest to highest. The gap between the best bid and best ask is the spread. Our guide on how to read a crypto order book walks through a real layout.
The matching engine is the software that processes incoming orders. For each new order it:
- 1Checks whether it can match against resting orders on the opposite side.
- 2Fills as much as possible at the best available prices.
- 3Places any unfilled remainder on the book (for limit orders) or cancels it (for some order types).
- 4Records the trade and updates balances.
Price-time priority
Most exchanges use price-time priority, also called FIFO (first in, first out):
- Price first: a higher bid or lower ask gets filled before worse-priced orders.
- Time second: at the same price, the order that arrived first is filled first.
So if you place a limit buy at the same price as many others, you join the back of the queue at that level.
Main Order Types
| Order type | What it does | When it fills | Main risk |
|---|---|---|---|
| Market | Buy or sell immediately at best available prices | Instantly, if liquidity exists | Slippage in thin markets |
| Limit | Buy or sell at a set price or better | Only when the market reaches your price | May never fill |
| Stop-market | Becomes a market order once a trigger price is hit | After trigger | Can fill far from trigger in fast moves |
| Stop-limit | Becomes a limit order once a trigger price is hit | After trigger, at limit or better | May not fill if price gaps past limit |
| Take-profit | Closes a position when a target price is reached | After trigger | Same as stop variants |
| Trailing stop | Stop price follows the market by a set distance | When price reverses by that distance | Volatile markets trigger it early |
For practical setup tips, see how to use limit, market and stop orders.
Time-in-force and special instructions
Many exchanges let you add conditions:
- Good-til-canceled (GTC): stays on the book until filled or canceled.
- Immediate-or-cancel (IOC): fills what it can immediately and cancels the rest.
- Fill-or-kill (FOK): fills completely and immediately or not at all.
- Post-only: is only accepted if it would rest on the book as a maker; if it would trade immediately, it is canceled.
- Reduce-only: on derivatives platforms, can only shrink an existing position.
Makers, Takers and Fees
A maker places an order that does not match immediately and therefore rests on the book, adding liquidity. A taker sends an order that matches against resting orders, removing liquidity.
Exchanges often charge takers more than makers because makers provide the liquidity that makes the market usable. A limit order placed away from the current price is usually a maker order; a market order is always a taker order. A limit order priced to cross the spread is treated as a taker for the part that fills immediately.
A Worked Example
Imagine an order book for a token with these asks (sell orders):
- 2 tokens at 10.00
- 3 tokens at 10.05
- 10 tokens at 10.20
If you submit a market buy for 6 tokens, the engine fills 2 at 10.00, 3 at 10.05 and 1 at 10.20. Your average price is about 10.06, even though the "price" displayed before your order was 10.00. That difference is slippage.
If instead you place a limit buy for 6 tokens at 10.05, you get 5 tokens immediately (2 at 10.00 and 3 at 10.05), and the remaining 1 token rests on the book as a bid at 10.05 until someone sells to you.
How Decentralized Exchanges Differ
Many decentralized exchanges do not use an order book at all. Automated market makers price trades from a formula based on the token balances in a liquidity pool, so your trade executes against the pool rather than against another person's order. Price impact depends on pool size. Some newer decentralized platforms do run on-chain or hybrid order books with matching engines similar to centralized exchanges. Related reading: Arbitrage in Crypto Explained.
Learn more in centralized vs decentralized exchanges.
Common Mistakes
- 1Using market orders on illiquid tokens. Check the depth of the book first; a modest order can move the price sharply.
- 2Setting a stop-limit with no gap. If the limit equals the trigger, a fast move can skip past both and leave you unprotected.
- 3Forgetting open orders. Old limit orders can fill unexpectedly days later when the market returns to that price.
- 4Ignoring fees. Frequent taker trades add up; check the fee schedule.
- 5Assuming stops guarantee a price. In sudden drops, stop-market orders fill at the next available price, which may be far lower.
Bottom line
Every trade you make goes through a matching process, and the order type you choose decides how that process treats you. Use market orders when speed matters and liquidity is deep, limit orders when price matters, and stops as a risk tool rather than a guarantee. Checking the order book and fee structure before trading is a small habit that consistently improves results. Compare trading venues in our exchange directory.
Câu hỏi thường gặp
How does an exchange match buy and sell orders?
Most centralized exchanges use a matching engine and an order book. Incoming orders are matched against resting orders on the opposite side at the best available price. When several orders share the same price, the one placed first is usually filled first, a rule called price-time priority.
What is the difference between a maker and a taker?
A maker places an order that rests on the order book and adds liquidity, such as a limit order below the current ask. A taker places an order that matches immediately against existing orders and removes liquidity, such as a market order. Many exchanges charge makers lower fees than takers.
Why did my limit order only partially fill?
A limit order fills only at your price or better. If there was not enough volume available at that price before the market moved away, only part of the order executed. The remaining portion stays on the book until it fills, you cancel it, or it expires.
Is a market order or a limit order better?
Neither is always better. A market order fills quickly but can execute at a worse price, especially in thin markets. A limit order controls the price but may not fill at all. Many traders use limit orders for less liquid assets and larger trades.
