Quant interview prep guides

Matching Engine Interview Guide

Matching engine interview guide for order book state, price-time priority, marketable orders, partial fills, cancels, and caveats.

Candidates discussing market microstructure or exchange-style coding prompts.

A matching engine applies venue rules

A matching engine maintains order book state and applies rules for which orders trade. Price-time priority is common in examples, but real venues can have different rules.

Marketable orders consume liquidity

A buy order priced at or above the best ask can trade against resting sell orders. Partial fills occur when available quantity is smaller than the incoming order size.

Concrete example

If the ask book has 100 shares at 10 and 50 shares at 10.01, a marketable buy for 120 shares fills 100 at 10 and 20 at 10.01, leaving 30 at 10.01.

State updates must be consistent

After each add, cancel, or trade, the book should preserve price ordering, quantity totals, and order identity. Testing tiny books exposes many implementation bugs.

Common mistakes

Candidates often assume all orders fully fill or ignore priority. A stronger answer tracks remaining quantity, timestamps, and the exact rule used for matching.

Practice the pattern

Use the LeetQuidity curriculum and calibration to turn this topic into a focused practice plan.