Skip to content

Pumkinmarble/exchange-engine

Repository files navigation

Exchange Engine

A high-performance simulated stock exchange written in C++17. It combines a work-stealing thread pool with per-symbol limit order books to process buy and sell orders across multiple trading symbols concurrently. (This project combines my previous order-book and thread-pool into one)

How it works

  • Each symbol (e.g. AAPL, TSLA) gets its own order book with FIFO price-time priority matching
  • A thread pool distributes order processing across CPU cores, automatically stealing work from busy threads to keep all cores utilized
  • Supports market and limit orders with partial fills

Build & Run

Requirements: g++ with C++17 support, make

make        # compile
make run    # compile and run benchmarks
make clean  # remove build artifacts

Project Structure

order_book.h / order_book.cpp       — limit order book (LOB) per symbol
thread_pool.h / thread_pool.cpp     — work-stealing thread pool
exchange_engine.h / exchange_engine.cpp  — ties the two together
main.cpp                            — demo and benchmarks
Makefile

Benchmarks

Tested on an 8-core machine:

Symbols Orders Throughput Avg Latency
4 200K 456K/sec 332ns
8 200K 403K/sec 395ns
16 200K 418K/sec 398ns

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors