Project
Quantum Financial Digital Twin
Distributed market simulation with 6 heterogeneous agent types, quantum-inspired portfolio optimization, and emergent crisis modeling. 2008 GFC scenario included.
Problem
Existing market simulators are either slow Python agent-based models, statistical Monte Carlo engines that ignore microstructure, or proprietary black-box risk systems. None capture emergent behavior from heterogeneous agent interactions at production scale.
Solution
A production-grade digital twin in Rust that simulates thousands of heterogeneous agents (market makers, momentum traders, fundamental investors, noise traders, hedge funds, central banks) across multiple assets with limit order book microstructure, circuit breakers, and quantum-inspired portfolio optimization.
Architecture
Distributed architecture: agent workers compute in parallel via rayon. Per-asset limit order books with price-time priority matching. Circuit breakers halt trading on volatility spikes. QAOA optimizer periodically rebalances hedge fund portfolios. gRPC API for external control and streaming market data.
Implementation
// 2008 GFC Simulation — Multi-Asset Contagion
let config = MarketConfig {
market_id: "gfc-2008",
assets: vec![
AssetConfig { symbol: "MBS", initial_price: 100.0, volatility: 0.08 },
AssetConfig { symbol: "CDO", initial_price: 100.0, volatility: 0.12 },
AssetConfig { symbol: "BANK", initial_price: 50.0, volatility: 0.20 },
AssetConfig { symbol: "TREASURY", initial_price: 100.0, volatility: 0.03 },
],
agents: vec![
AgentDeployment { agent_type: MarketMaker, count: 10, capital: 5_000_000.0 },
AgentDeployment { agent_type: Momentum, count: 30, capital: 2_000_000.0 },
AgentDeployment { agent_type: HedgeFund, count: 8, capital: 20_000_000.0,
params: [("leverage", 3.0)] },
AgentDeployment { agent_type: CentralBank, count: 1, capital: 100_000_000.0 },
],
};
let mut engine = SimulationEngine::new(config, 2008);
// Phase 1: The Boom (500 ticks)
let result = engine.run(500);
// Phase 2: The Trigger (200 ticks)
let result = engine.run(200);
// Phase 3: The Collapse (300 ticks)
let result = engine.run(300);
println!("Peak Drawdown: {:.2}%", result.max_drawdown * 100.0);
println!("Circuit Breakers: {}", result.circuit_breaker_trips);Vision
A financial digital twin that lets regulators, risk managers, and researchers simulate 'what if' scenarios — 2008 with higher capital requirements, 2020 with different circuit breaker thresholds, a future crisis with quantum-optimized portfolios.