C++20 implementation of a Level 3 limit order book, NASDAQ ITCH 5.0 parser, lock-free telemetry path, online VPIN/imbalance/micro-price signals, an adaptive Avellaneda-Stoikov market-making simulator, and a quote-level risk gate.
The hot path avoids heap allocation by using fixed-capacity, cache-line-aligned data structures:
FixedSlabPool<T, N>owns order nodes in pre-linked 64-byte chunks.LockFreeSPSC<T, N>moves engine events to the alpha thread using atomic head/tail sequences.- The L3 book uses intrusive FIFO queues per price level plus fixed open-addressed tables for order and price lookup.
RiskControllerevaluates quote permissions and sizes from inventory, notional, drawdown, and VPIN toxicity state.
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
ctest --test-dir build --output-on-failureThe default compiler flags include -O3, -march=native, -fno-exceptions, and -fno-rtti on GCC/Clang-compatible compilers.
The project always builds a dependency-free CTest harness. If GTest is installed, CMake also builds the matching_engine_gtests target.
ctest --test-dir build --output-on-failureCI installs GTest and configures with MATCHING_ENGINE_REQUIRE_GTEST=ON, so the richer GoogleTest suite is required on GitHub Actions.
./build/matching_engine
./build/engine_benchIf Google Benchmark is installed, the benchmark target links against it. Otherwise it builds a standalone latency harness that reports median, p99, and throughput for hot FIFO fills, add/cancel churn, ITCH decode, and alpha quote/risk generation.
More detail: