Day 319 — Reading someone else’s matching engine

Monday, 21 June 2027 · Week 46 of 52 · Production · Study day · 60 min

Reading production code you did not write is the skill this week is actually for, and a matching engine is a good target because you already know exactly what it has to do.

What you should be able to do tonight

  • Trace an order through a real engine’s code from submission to fill.
  • Name two design decisions it makes that yours does not, and say what each buys.

Tasks 60 min

35 min Trace the path: find where an order enters, where it is validated, where it is matched and where the fill is published. Draw the call path on paper rather than in your head. The parts you cannot follow are as informative as the parts you can, so write those down too.

25 min Compare against your own toy book from day 9 and day 281: what does the real engine handle that yours does not? Self-trade prevention, order modification semantics, and the sequencing guarantees under concurrent input are the three you will find, and each of them is a correctness requirement rather than a feature.

Resources

Deliverable

A hand-drawn call path for an order through a real engine, with three handled cases your own book does not cover.

Checkpoint

What is self-trade prevention, and what goes wrong without it?

Prepare for tomorrow

Ten minutes tonight so Day 320, Tuesday, 22 June 2027 starts clean. This is what the evening email sends you.

Sketch the C++ classes for a minimal order book: an order, a price level, and the book itself.

Decide the container for each from day 318’s measurements.

Three sketches, no code.