A high-performance C++ order matching engine with Qt6 GUI and SQLite persistence.
# Build setup
mkdir build && cd build
cmake ..
make
# Run GUI application
./OrderBookGUI
# Run tests
./test_orderbookPre-populate the database with market scenarios for testing:
# Built-in scenarios
./populate_db --scenario normal # Balanced market
./populate_db --scenario thin # Wide spreads
./populate_db --scenario volatile # Random prices
# Python-generated data
python3 scripts/data/populate_orderbook.py # Generate CSV
./populate_db --csv data/csv/orderbook_scenario.csv
# Database management
./populate_db --clear # Clear all orders
./populate_db --stats # Show statisticsThe GUI automatically loads pre-populated orders on startup.
# Make changes to source files
# Then rebuild (only changed files recompile)
make && ./OrderBookGUI
# Run tests after changes
./test_orderbooksrc/core/- Core orderbook engine and data structuressrc/gui/- Qt6 GUI application with real-time visualizationdatabase/lib/- SQLite database integrationdatabase/tools/- Database population utilitiesscripts/data/- Python data generation scriptstests/- Comprehensive stress tests and benchmarks
CMakeLists.txt- Build configuration creating orderbook_lib static librarybuild/- Generated build files and executables
test/test_orderbook.cpp- Comprehensive test suite covering all functionality including:- Basic functionality (empty orderbook, single orders, multiple orders)
- Order matching (exact match, partial fills, multiple matches, price/time priority)
- Edge cases (zero quantity, large quantities, price boundaries, cancellation)
- Fill-or-Kill orders (successful execution and rejection)
- Performance tests (many orders)
- Price-time priority matching algorithm
- Partial fill support with remaining quantity tracking
- Automatic trade generation for matched orders
- Fill-or-Kill (FOK) order type support
std::map<Price, std::list<OrderPointer>>for bid/ask price levelsstd::unordered_map<OrderId, OrderEntry>for O(1) order lookup- FIFO ordering within price levels using std::list
Order- Individual order with fill trackingOrderbook- Main matching engineOrderbookLevelInfos- Price level aggregation for display
- C++20 compatible compiler
- CMake 3.20 or higher
- docs/PROJECT_OVERVIEW.md - Complete technical architecture and design decisions
- docs/guides/DATABASE_GUIDE.md - Database setup, operations, and management
- docs/guides/TESTING_GUIDE.md - Comprehensive testing and script usage guide
- docs/PROJECT_STRUCTURE.md - Detailed project organization and component overview