project

C++ Limit Order Book And Market Making Simulator

result3.7M events/sec benchmark, 12,423 QQQ ITCH messages, paired 30 seed statistics, and queue diagnostics.

Deterministic C++ matching engine, benchmark harness, bounded QQQ ITCH replay, and market making simulator for naive versus Avellaneda Stoikov quoting.

status: completebenchmark: 3.7M events/secreplay: 12,423 QQQ ITCH messagesconfidence: high

Problem

Can I build a C++ market microstructure simulator that is more than a toy backtest: deterministic matching behavior, reproducible benchmarks, real data replay checks, risk controls, and honest statistical interpretation?

Approach

Built a one instrument C++ limit order book with price time priority, partial fills, cancel and replace, self trade prevention, CSV replay, and direct external execution for named ITCH style resting order executions.

Added a benchmark harness, bounded QQQ Nasdaq ITCH replay, naive and Avellaneda Stoikov market makers, inventory caps, terminal liquidation, paired 30 seed strategy statistics, and queue position diagnostics.

What failed or changed

The early synthetic flow overstated execution activity relative to the bounded ITCH sample. I added an ITCH calibrated flow profile and found market maker fill rates collapsed from roughly 43 to 50 percent to roughly 1.5 to 1.8 percent.

The flat order book initially looked around 15 percent faster than the map book on one paired run, but longer diagnostics showed the result was workload and host noise sensitive rather than a general array book win.

The strategy result narrowed. Avellaneda Stoikov did not show broad PnL dominance. Paired same seed statistics supported selected inventory risk and risk adjusted improvements under hand chosen flow, with weaker or negative PnL effects elsewhere.

Finding

The strongest claim is not that the strategy makes money. The strongest claim is that the simulator can test market making mechanisms honestly: queue position matters, sparse execution dominates ITCH calibrated fill collapse, and inventory aware quoting reduces selected risk metrics without implying broad PnL dominance.

The queue diagnostic finding is especially important: even zero queue ITCH calibrated quotes filled around 1.8 to 2.0 percent versus roughly 72 to 74 percent for hand chosen zero queue quotes.

How to reproduce

The repository includes CMake build commands, CTest coverage, benchmark artifacts, ITCH replay artifacts, paired delta outputs, and queue position diagnostics.

The README gives the main commands; the research note keeps the stage by stage numbers, caveats, and interpretation changes.