Skip to content
All interviews

Stock exchange (order matching engine)

Accept limit and market orders, enforce pre-trade risk limits, and match buys against sells by strict price-time priority. Traditional database locks are orders of magnitude too slow and non-deterministic; a real exchange sequences commands into a total order per symbol and runs a single-threaded, in-memory deterministic state machine.

Notes and ratings save in this browser. Completing self-assessment records your progress.

45:00

Requirements checklist

Clarifying questions
  • Which order types are in scope (limit, market, cancel, IOC/FOK)?
  • What is the latency target at the matching engine (sub-millisecond vs tens of milliseconds) and peak message rate?
  • How many symbols are traded, and can one hot symbol receive a large fraction of the volume?
  • Are pre-trade risk checks (buying power, fat-finger limits) part of the gateway path?

requirements

Suggested time: about 6 minutes. Includes pre-trade risk checks, `clientOrderId` idempotency, and deterministic replay.