A real-time BTC-USD Order Book matching engine built in C++17. This project simulates a low-latency trading environment by processing market data updates and executing market orders with price-time priority.
-
Price-Time Priority: Maintains a sorted L2 book using
std::mapwith$O(\log N)$ discovery. - Matching Engine: Supports aggressive market orders that cross the spread and match against existing liquidity.
-
Multithreaded Design: Asynchronous market data feed simulation using
std::threadandstd::mutex. - Analytics: Real-time trade logging to CSV and a Python-based visualizer for post-trade analysis.
- C++17: Core engine logic.
- CMake: Build system.
- nlohmann/json: JSON parsing for simulated market data.
- Python (Pandas/Matplotlib): Data visualization.
- Prerequisites: Install
nlohmann-jsonandcmake. - Build:
mkdir build && cd build cmake .. make
- Run:
./bin/lob_simulator --config=../data/configs/default-config.json
This project is licensed under the terms of the MIT license.