Orderbook is a high-performance C++ matching engine that maintains bids and asks, matches incoming orders according to price-time priority, and tracks real-time level data.
Core Matching Engine
At its core, the matching engine processes buy and sell orders. It is designed to be thread-safe with mutex protections, ensuring correct concurrent operations in trading environments.
Multiple Order Types
The orderbook supports several key execution types to match modern financial venue requirements:
Good Till Cancel (GTC) - Orders remain in the book until they are explicitly cancelled or fully matched.
Fill And Kill (FAK) - Orders are filled immediately for as much quantity as available, with any remaining amount cancelled.
Fill Or Kill (FOK) - Orders must be filled completely upon entry or cancelled entirely.
Good For Day (GFD) - Active orders that automatically get cancelled at market close (16:00).
Market Orders - Orders that match at the best available price.
Price-Time Priority
Matching follows a strict price-time priority rule: orders at a better price are matched first. For orders at the same price, the order that was placed first gets priority.
Built for Speed
Written in C++, this engine focuses on low latency matching using efficient data structures and real-time level depth tracking.