A real-time order matching engine implemented in C++, simulating various order types commonly used in trading systems. This project demonstrates data structure design, execution logic, and unit testing for realistic order flow behavior — inspired by electronic trading infrastructure.
- Implements major order types:
- Good Till Cancel (GTC)
- Fill And Kill (FAK)
- Fill Or Kill (FOK)
- Good For Day (GFD)
- Market Orders
- Tracks bid/ask spread and handles partial fills
- Uses
std::map
for O(log N) insertions and lookups - Unit-tested using Google Test Framework
- Matching engine logic and trade execution
- Efficient order book using
std::map
- Handling edge cases (partial fills, price improvement, empty books)
- C++ testing and validation of execution paths
- Principles inspired by options trading simulations
Requires C++17 and Google Test.
g++ -std=c++17 -Iinclude -lgtest -lgtest_main -pthread src/*.cpp tests/*.cpp -o orderbook_test
./orderbook_test