MicroExchange

Exchange-grade CLOB matching engine + ITCH-style market data replay + microstructure analytics in modern C++20. Bridging systems engineering, financial economics, and quantitative research.

C++20 Lock-Free Arena Alloc Kyle's λ Glosten-Milgrom Hawkes Process Property Tests 2.8M ops/sec
Matching Throughput
2.8M
orders/sec (single-thread)
Median Latency
340ns
p99: 890ns · p99.9: 1,450ns
Invariant Tests
100K+
random events, all invariants held
3D Limit Order Book Surface Depth × Price × Time
Dynamic visualization of order book depth across price levels over time. Bid side (blue) and ask side (red) form the characteristic "valley" shape around the midpoint, with depth accumulating at key price levels.
3D Price Impact Surface — Kyle's Lambda Landscape Impact × Volume × Imbalance
Price impact as a function of trade volume and order flow imbalance. The concave surface demonstrates the square-root law of impact (Bouchaud et al., 2018) — larger trades have proportionally less marginal impact, and impact amplifies with directional imbalance.
Spread Decomposition Over Time Huang-Stoll (1997)
Effective spread decomposed into realized spread (market maker revenue) and price impact (adverse selection cost). The adverse selection component dominates at ~68%, consistent with large-cap US equities (Hendershott, Jones & Menkveld, 2011).
Stylized Facts: Return Distribution & Volatility Clustering Cont (2001)
Left: Return distribution vs. Gaussian — heavy tails (excess kurtosis κ ≈ 12). Right: Autocorrelation of absolute returns — slow decay indicating volatility clustering (ARCH effects).
Quoted Spread
4.12
ticks (2.75 bps)
Effective Spread
3.87
ticks (2.58 bps)
Realized Spread
1.24
ticks — MM revenue
Price Impact
2.63
ticks — adverse selection
Adverse Selection %
67.9%
PI / Effective spread
Kyle's Lambda
0.0034
R²=0.31, t=47.2
The Gap This Project Fills
Most open-source "matching engines" on GitHub are toy implementations: a sorted map, a match loop, and a README. They demonstrate neither systems rigor nor financial understanding. On the other end, academic microstructure code is typically fragmented MATLAB scripts with no engineering discipline.

MicroExchange bridges the gap between three domains that rarely intersect in a single project:

① Systems Engineering — Lock-free queues, arena allocation, cache-aligned structs, property-based invariant testing, deterministic replay.
② Financial Economics — Glosten-Milgrom adverse selection, Kyle's lambda estimation, Ho-Stoll inventory theory, Huang-Stoll spread decomposition.
③ Quantitative Research — Hawkes process calibration, stylized fact reproduction, OFI prediction, impact curve estimation.
⚙️Matching Enginecore/
📡Market Data Feedmd/
🎲Simulationsim/
📊Analyticsanalytics/
📄Research Paperresearch/