Skip to content
Wildflower
Join free
How markets work underneath

Free Trading School · Level 7 · Course 7.10

Matching engines

Lesson 2 of 12 in How markets work underneathModule 1: Exchanges and matching

Advanced · How markets work underneath

Matching engines

Wildflower Trading School · Lesson 7.10.1.2

Wildflower

Every order you send ends up at one piece of software: the matching engine. By the end of this lesson, you'll know what it does with each message, why it handles them strictly one at a time, and why that means arriving first matters more than clicking first.

1 of 6

What you'll learn

  • Follow each message. The engine takes new orders, changes and cancels, one at a time.
  • Trace a fill. It fills what it can, leaves the rest waiting and sends out the results.
  • Know your place in line. It's set when your order reaches the engine.
  • Check where your stops wait. Many platforms hold stops until they trigger.
  • Expect price protection. CME Globex fills market orders only within a price band.

Exercise

  1. Look in your platform's or 's help pages for how are handled.
  2. Find out whether your stops wait at the , or on the platform's computers until they trigger (a ).
  3. Write the answer down with your .

Next: First in, first out and pro-rata.

Quick check

  1. 1. Two traders send orders for the last 2 contracts at a price. Who gets them?

  2. 2. A sell limit at 5,000.00 for 5 contracts meets only 2 bids at 5,000.00 or higher. What happens to the other 3?

  3. 3. Your platform holds your stop order on its own computers. What does that mean?

0 of 3 answered.

Finished this lesson?

Tick it off and keep your place

Make a free account and we'll remember where you are, so “First in, first out and pro-rata” is waiting next time.

Read the full notes

A matching engine holds the order book and handles every new order, change and cancel strictly one at a time in the order they arrive, trading what can trade and sending out the results, so when your message arrives matters more than when you clicked.

  • The holds the and takes in three kinds of message: new order, change, cancel. More: How an exchange matches orders.
  • For each message it checks the book, trades what can trade, rests the rest, and sends a note to each trader involved plus a data update to everyone.
  • Made-up: asks 4 at 5,000.25. Buy 2 at market: 2 trade at 5,000.25, 2 left. Sell 5 limit 5,000.00 against 2 bids there: 2 trade, 3 rest as a new offer at 5,000.00.
  • Messages are handled one at a time, in arrival order. Arrival at the engine sets your place, not your click, which travels through platform, broker and network first. See Latency in trading and Delay and speed.
  • rest in the exchange's book. Some are held by the exchange; many platforms hold stops and brackets themselves until triggered ().
  • On CME Globex, get : they fill only within a band, and the rest waits at its edge as a limit order.

Worked example

Made-up numbers

Three messages through the engine

Made-up numbers · asks: 4 at 5,000.25, 5 at 5,000.50 · bids: 3 at 5,000.00, 6 at 4,999.75

  1. Buy 2 at market: 2 trade at 5,000.25; 2 left there.
  2. Cancel 1 bid at 5,000.00: nothing trades; 2 bids left there.
  3. Sell 5, limit 5,000.00: 2 trade at 5,000.00; the other 3 can't trade at 5,000.00 or better, so they rest as an offer at 5,000.00.

Two trades printed, and the best offer is now 5,000.00 with 3 contracts.

Trading is risky. You can lose money. This lesson explains how markets work. It isn't advice.