RAHUL ANANTMathematics & Computing
Back to Projects Library
Quantitative SystemsCompleted Engine2024

High-Performance Limit Order Book & Matching Engine

Role: Quantitative Systems Developer

Deterministic, low-latency electronic limit order book (LOB) matching engine designed for algorithmic trading systems and simulated market microstructure.

High-Performance Limit Order Book & Matching Engine

Technology Stack & Libraries

PythonC++Data StructuresAlgorithmic TradingNumPyUnit Testing
The Challenge / Problem

Context & Objectives

Trading firms require microsecond-accurate simulation environments to backtest high-frequency execution strategies without incurring market impact or slippage distortion.

Architectural Solution

Engineered Approach

Implemented dual price-sorted red-black tree ladders (Bids and Asks) with O(1) doubly-linked order cancellation queues at each price tick, eliminating linear scan overhead.

System Architecture & Pipeline

Order Stream -> Validation Engine -> Price Ladder Dispatcher (Bid/Ask) -> Matching Loop (Price-Time Priority) -> Trade Event Logger -> L2 Depth Broadcast.

Designed and implemented a deterministic limit order book matching engine in Python that simulates equity exchange mechanisms. The engine supports Limit Orders, Market Orders, Cancelations, and Partial Fills while calculating Level 2 (L2) market depth metrics in real-time.

Engineered Capabilities & Innovations

Strict Price-Time Priority (FIFO) execution logic conforming to regulatory exchange standards
Real-time Level 2 (L2) and Level 3 (L3) order book depth calculation
Support for Limit, Market, Cancel, and Immediate-or-Cancel (IOC) order directives
Comprehensive stress-test suite verifying zero memory leakage under burst volume

Empirical Results & Benchmarks

Processes 150,000+ orders per second in pure Python with zero invariant violations across 10,000,000 synthetic matching cycles.

Have Questions About This System?

I am always glad to discuss technical architecture, benchmarks, or potential collaboration.