Skip to content

Low-latency Limit Order Book (LOB) and Matching Engine in C++17. Processes live market data from Binance.

Notifications You must be signed in to change notification settings

Manav0559/HFT-OrderBook-CPP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

High-Frequency Limit Order Book (C++)

C++ Build Latency

A low-latency Limit Order Book (LOB) implementation designed for high-frequency trading simulations.

Live Demo

Screen.Recording.2026-01-10.at.1.36.24.AM.mov

Performance Benchmarks

Tested on MacBook Air (Apple Silicon):

  • Average Latency: 1.21 microseconds/order
  • Throughput: ~800000 orders/sec

Features

  • Matching Engine: Standard Price-Time priority (FIFO) matching logic.
  • Data Structures: std::map (Red-Black Tree) for ordered price levels; std::vector for order queues.
  • Live Feed: Integrated Python adapter to stream real-time Binance BTC/USDT market depth.
  • Optimization: Uses fixed-point arithmetic (integers) to avoid floating-point errors and latency.

How to Run

1. Live Trading Simulation: This script fetches data from Binance and updates the book in real-time.

chmod +x run_live.sh
./run_live.sh

About

Low-latency Limit Order Book (LOB) and Matching Engine in C++17. Processes live market data from Binance.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published