Preparing your design workspace

Loading the problem and your saved attempt…

Design a Crypto Order Matching Engine

Model a price-time-priority order book with placement, cancellation, partial fills, and deterministic matching.

For this exercise, assume one in-memory order book per trading pair. Clients place limit buy and sell orders, cancel their own open orders, and query order and trade state. Crossing orders match by best price and then earliest accepted sequence.

Orders may fill partially; every accepted order, cancellation, and fill has a stable identity. Concurrent requests for the same pair must produce one deterministic sequence, and a retry must not create a second order. Design the objects, interfaces, interactions, and concurrency boundary.

Exclude custody, balances, settlement, market-data fanout, and durable exchange recovery.