01 · C++20 order book and market making
MM Engine
A limit order book and matching engine in C++20, with a Python research layer for market making.
Price-time priority matching with a zero-allocation hot path: integer price ticks in a fixed band, a preallocated node pool with an intrusive FIFO per level, and an open-addressing order map. Python reads the trade tape as a zero-copy NumPy view through pybind11. An Avellaneda-Stoikov market maker runs through the engine and is compared with symmetric quoting.
- 10.1M
- messages per second (median of 5 runs × 5M messages)
- 262 ns
- median latency per message; p99 722 ns, p99.9 2.97 µs
- 207
- tests, 200 of them differential against a reference book, clean under ASan and UBSan
- 6.7 vs 14.3
- P&L std: inventory-aware quoting vs symmetric, for 5% less mean profit (1,000 sims)
C++20 · pybind11 · Python · GoogleTest · CMake
Synthetic message stream on a shared 4-vCPU cloud VM. Real exchange data replay is next.
Book levels are illustrative. Statistics from results/as_mm.json, gamma 0.1.



