Overview
QuantDesk is an institutional-grade quantitative trading backtesting and simulation suite. It pairs a deterministic C++20 limit order book matching engine with a Python quantitative research environment and an interactive React web dashboard for strategy replay, depth-of-book analysis, and performance analytics.
The Problem
Standard backtesting libraries written purely in Python suffer from significant execution latency, unrealistic fill assumptions, and execution drift when simulating high-frequency or inventory-sensitive strategies like market making and pairs trading.
My Contribution
Architected a native C++20 matching engine implementing price-time priority queues with microsecond event dispatching. Implemented an inventory-aware Avellaneda-Stoikov market maker that dynamically skews bid-ask spreads, and built a full-stack React frontend for historical order replay.
Architecture
Deterministic C++ Matching Engine
Implemented price-time priority queues for bids and asks using memory-efficient contiguous price buckets. Supports LIMIT, MARKET, IOC (Immediate-or-Cancel), and FOK (Fill-or-Kill) orders with immediate partial fill settlement.
Avellaneda-Stoikov Market Making
Implemented the seminal Avellaneda-Stoikov optimal quoting model. As inventory accumulates in either direction, reservation prices skew quotes away from accumulating adverse inventory while maintaining target spread capture.
Statistical Arbitrage & Cointegration
Engineered a pairs trading pipeline in Python utilizing Johansen cointegration tests, rolling z-score spread calculations, and volatility-scaled half-life rebalancing thresholds.
Interactive Strategy Replay Dashboard
Built a React dashboard displaying real-time depth of book heatmaps, cumulative PnL trajectories, drawdown charts, and per-fill execution slippage logs.
Engineering Decisions & Tradeoffs
C++20 for core execution engine instead of Python
Rationale: Python backtesting introduces substantial runtime overhead and cannot accurately model deterministic microsecond execution without language runtime artifacts.
Tradeoff: Requires cross-language bindings and CMake build pipelines compared to an all-Python stack.
Avellaneda-Stoikov quoting over naive fixed spreads
Rationale: Fixed-spread market makers suffer heavy adverse selection during directional price shocks. Dynamic reservation pricing protects capital by penalizing inventory build-up.
Tradeoff: Requires accurate continuous estimation of volatility (gamma) and arrival intensity (kappa).
Challenges & Solutions
Ensuring 100% deterministic execution across test runs
Enforced explicit monotonic timestamp indexing, isolated PRNG seeding, and automated GoogleTest suites verifying exact order book state parity across runs.
Handling multi-level liquidity sweeps without allocation bottlenecks
Designed a recursive price-level decrement loop that updates book volume in-place before emitting execution reports.
Evidence & Results
- ›Sub-microsecond order matching on synthetic and historical book feeds
- ›Deterministic order execution validated by comprehensive GoogleTest coverage
- ›Live interactive web dashboard deployed at https://quantdesk-mu.vercel.app/
- ›Supports full order lifecycle (LIMIT, MARKET, IOC, FOK) with partial fill logic
