Day 320 — Writing a small order book that works

Tuesday, 22 June 2027 · Week 46 of 52 · Production · Study day · 60 min

Writing a hundred lines that compile and behave correctly is a different and more convincing skill than reading, and it is the artifact that makes the C++ line on your CV defensible.

What you should be able to do tonight

  • Implement an order book in C++ supporting add, cancel and market order execution with price-time priority.
  • Test it against your Python implementation on the same message sequence and get identical results.

Tasks 60 min

40 min Write it: the three classes from last night, with the containers you chose, and the three operations. Keep it under two hundred lines and compile with warnings as errors. Getting it to compile is a real part of the exercise and the error messages are where most of the learning is.

20 min Test it against something you trust: replay a slice of your ITCH sample through both your Python book and the C++ one and assert the resulting books match at every step. Identical output on real message sequences is a much stronger test than any unit test you would have written.

Resources

Deliverable

A compiling C++ order book under two hundred lines, verified against the Python implementation on a real ITCH slice.

Checkpoint

What does your C++ book do when a cancel arrives for an order that already fully executed?

Prepare for tomorrow

Ten minutes tonight so Day 321, Wednesday, 23 June 2027 starts clean. This is what the evening email sends you.

Time your Python book and your C++ book on the same million-message replay.

Write both numbers down.

Then guess how much of the gap is the language and how much is the data structure.