A production-grade C++17 smart order router with latency modeling, simulated venues, and performance analytics
- Clean architecture: Separation of concerns (core, venue, router, analytics, utils)
- Simulated exchanges: Configurable latency, fill probability, partial fills, execution reports
- Latency model: Effective latency = network + processing; interface ready for EWMA/adaptive models
- Routing strategy: Score = price_advantage − latency_penalty + fill_weight; multiple modes (BestPrice, LowestLatency, HybridScore)
- Performance analytics: Execution latency, fill ratio, slippage, venue efficiency ranking
- Precise timing:
std::chronomicrosecond-level measurement; RAII, smart pointers, no globals
mkdir build && cd build
cmake ..
cmake --build ../smart_order_routerRuns 1000 simulated orders with randomized market data and prints a final performance report comparing venues.
cd build && ctestinclude/
core/ Order, ExecutionReport, MarketData, Types
venue/ Venue, SimulatedExchange, VenueManager
router/ SmartOrderRouter, LatencyModel, RoutingStrategy
analytics/ PerformanceAnalyzer, Metrics
utils/ Logger, Clock
src/ Implementation files
tests/ test_router, test_latency
config/ router_config.yaml
data/ sample_market_data.csv
After a typical run you'll see venue-level stats similar to:
Venue A (VENUE_A):
Avg Latency: 320 µs
Fill Rate: 92%
Avg Slippage: 0.3 bps
Venue B (VENUE_B):
Avg Latency: 180 µs
Fill Rate: 75%
Avg Slippage: 0.6 bps
Venue C (VENUE_C):
Avg Latency: 450 µs
Fill Rate: 88%
Avg Slippage: 0.4 bps
Hybrid Router: Improved fill quality and reduced effective slippage across venues.
- Move semantics and constexpr where appropriate
- No heap allocations in hot path for critical routing logic
- Thread-safe design where order submission and analytics are concerned
- End-to-end latency measured from order acceptance to execution report
MIT