Welcome to OrderBook CLI, a high-performance trading engine simulator built using modern C++20, designed with OOP, STL containers, RAII, and multithreading principles. This project simulates a basic stock exchange order book and allows you to:
- Add/Cancel/Modify orders
- Match trades automatically
- View market stats (VWAP, Last traded price, Best bid/ask)
- Run unit tests using GoogleTest
- Orderbook: Core engine that handles all operations.
- Order: Encapsulates trading intent.
- OrderModify: Lightweight utility to modify existing orders.
- Trade / TradeInfo: Encapsulates matched trades (Buy/Sell pairs).
- OrderbookLevelInfos: Returns L1 data (Best bid/ask and levels).
| Feature | Description |
|---|---|
std::shared_ptr |
Manage order lifetimes automatically (RAII) |
std::map, std::unordered_map |
High-performance containers for O(1)/logN ops |
std::mutex, std::thread |
Thread-safe design with cleanup support |
enum class, constexpr, auto |
Safe and expressive coding |
chrono |
High-resolution order timing and benchmarking |
Makefile |
Portable build system with support for testing and cleanup |
The system auto-calculates and displays:
- ✅ Last Traded Price
- 📊 Total Volume Traded
- 📉 VWAP (Volume-Weighted Average Price)
- 🏷️ Best Bid / Best Ask
makemake runmake testmake clean✨ Tip: All test files are in
OrderbookTest/and follow the GoogleTest pattern.
├── Orderbook.cpp / .h # Core orderbook logic
├── Order.h / OrderModify.h # Order definitions and mods
├── Trade.h / TradeInfo.h # Matched trade details
├── LevelInfo.h # Price levels (bids/asks)
├── OrderbookLevelInfos.h # Bid-Ask L1 data summary
├── Usings.h # Common typedefs
├── main.cpp # CLI interface
├── Makefile # Build system
├── OrderbookTest/test.cpp # GoogleTest unit tests
├── Images/ # Screenshots for demo
└── README.md # You're reading it!
Made with ❤️ by Muqeeth – a Computer Science undergrad, passionate about systems, performance engineering, and solving real-world problems through clean design.
This project is open-source.






