Architecture
The quant flow wraps Rust primitives (MarkovRegimeModel, VpinDetector, prediction_greeks, cornish_fisher_var, etc.) into a cohesive pipeline that runs inside the oversight loop.
Regime Detection
Classifies fund-level market regime using a 3-state Hidden Markov Model (calm/volatile/crisis) with trend and mean-reversion overlays.| Regime | Strategy Preference | Position Scale |
|---|---|---|
quiet | Market-making | 1.0x |
trending_up / trending_down | Directional | 1.0x |
mean_reverting | Market-making | 1.0x |
volatile | Reduced exposure | 0.7x |
crisis | Minimal exposure | 0.5x |
Multi-Factor Alpha Model
Replaces the naiveedge = 0.05 * fitness with a 7-factor model that self-calibrates using information coefficients (IC).
Prediction Market Factors
| Factor | Signal | Computation |
|---|---|---|
| Liquidity | Volume ratio | tanh(volume_24h / median_volume - 1) |
| Momentum | Price trend | tanh(price_change * 10) |
| Mean-reversion | Distance from 0.5 | 1 - abs(price - 0.5) * 2 |
| Event proximity | Time to expiry | 1 / (1 + days_to_expiry) |
| Spread | Spread vs. average | tanh((avg - current) / avg) |
| Cross-market | Exchange divergence | Price difference, clamped |
| Entropy | Uncertainty | shannon_entropy(price), normalized |
Hypothesis Framework
Tracks trading ideas through a formal lifecycle with Bayesian updating and statistical validation.Hypothesis Lifecycle
confidence * edge) wins deployment priority. SQLite persistence survives restarts.
Signal Ensemble
Combines multiple signal sources with IC-weighted blending and redundancy detection.Research Intelligence
Event-driven research triggers replace purely timer-based scanning.Portfolio Optimization
Constraint-aware optimizer that replaces simple equal-weight allocation.Risk Analytics
Regime-conditional risk limits, Cornish-Fisher tail risk, and portfolio Greeks.Alpha Decay Tracking
Monitors edge erosion and predicts when strategies should be retired.Execution Intelligence
VPIN toxicity detection, inventory risk management, and execution scheduling.Performance Attribution
Fund-level alpha/beta decomposition, strategy contribution, and cost analysis.Oversight Loop Integration
All 10 modules are wired into the FundManager oversight loop automatically:| Tick | Step | Module |
|---|---|---|
| Every | 7b | RegimeDetector.update() — regime transitions fire research triggers |
| Every | 8c | RiskAnalytics.dynamic_limits() — regime-conditional position limits |
| 5 | 8d | RiskAnalytics.portfolio_greeks() — fund-level Greeks snapshot |
| Every | 9b | ExecutionIntelligence.update_toxicity() — per-market VPIN |
| N | 10 | PortfolioOptimizer.optimize() — replaces allocator when enabled |
| N | 13 | AlphaModel + HypothesisManager + AlphaDecayTracker — enhanced research-to-deploy |
| 60 | 14b | AlphaDecayTracker.check_alerts() + HypothesisManager.check_decay() |
| Every | 18 | ResearchIntelligence.consume_triggers() — event-driven research |
| 60 | 19 | PerformanceAttribution.compute() — attribution snapshot |
Configuration
Three new fields onFundConfig control the quant flow:
fund.regime_detector, fund.alpha_model, etc.) even when optimization_enabled and regime_risk_enabled are False. The flags only control whether they replace the defaults in the oversight loop.
Rust Primitives Used
| Python Module | Rust Functions |
|---|---|
RegimeDetector | MarkovRegimeModel (3-state HMM) |
AlphaModel | information_coefficient, edge, shannon_entropy |
AlphaDecayTracker | signal_half_life |
HypothesisManager | deflated_sharpe, benjamini_hochberg |
SignalEnsemble | combine_signals, information_coefficient, signal_half_life |
PortfolioOptimizer | multi_kelly, ledoit_wolf_shrinkage |
RiskAnalytics | cornish_fisher_var, cornish_fisher_cvar, prediction_greeks |
ExecutionIntelligence | VpinDetector, OfiTracker, reservation_price, optimal_spread, mm_size |