Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

High-Performance C++ Limit Order Book (LOB)

A deterministic, high-efficiency matching engine implemented in C++20. This project simulates a financial exchange by matching buy and sell limit orders using Price-Time Priority (FIFO).

๐Ÿ—๏ธ System Architecture

The engine utilizes a Nested Map-of-Lists architecture to achieve high-performance algorithmic complexity:

  • Price Discovery: std::map (Red-Black Tree) ensures $O(\log P)$ lookup for the best bid/ask.
  • Priority Management: std::list (Doubly Linked List) maintains $O(1)$ time priority at each price level.
  • Order Tracking: std::unordered_map provides $O(1)$ direct access to orders for instant cancellation.

๐Ÿš€ Performance Characteristics

Operation Complexity Implementation Details
New Order $O(\log P + M)$ Logarithmic price search + $M$ fills
Cancellation $O(1)$ Hash-map iterator lookup
Modification $O(1)$ Direct node access via iterator

๐Ÿ› ๏ธ Build & Run

Ensure you have a C++20 compatible compiler (Clang/GCC).

# Compile
g++ -std=c++20 -Iinclude src/*.cpp -o engine

# Run
./engine

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages