Strip all 413 #[allow(dead_code)] annotations from 139 files and remove the actual dead code they were suppressing: unused struct fields (and their constructor sites), unused methods/functions, and entire dead structs. Key removals: - trading_engine compliance: ~50 dead structs/fields across audit, reporting, SOX modules - trading_service: dead execution engine fields, broker routing, paper trading methods - ml_training_service: dead TLS validation (~340 lines), GPU state, monitoring fields - backtesting_service: dead model cache, TLS validation, TradeSignal fields - risk: dead VaR engine fields, safety coordinator fields, position tracker fields - adaptive-strategy: dead ensemble methods, regime detection, sizing functions 147 files changed, -4264 net lines. Workspace compiles with 0 errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
adaptive-strategy
Adaptive trading strategy framework combining ensemble ML models, execution algorithms, market microstructure analysis, and risk management.
Overview
AdaptiveStrategy is the top-level type. It wraps an EnsembleCoordinator in Arc<RwLock> and coordinates predictions from four model types -- DQN, PPO, TFT, and Mamba2 -- loaded via InferenceAdapterBridge from the ml crate.
EnsembleConfig is re-exported from ml (not defined in this crate).
Modules
- config -- Strategy configuration, seeded IDs (
default-production,development,aggressive) - ensemble --
EnsembleCoordinator, model weighting, signal aggregation - execution -- TWAP, VWAP, Implementation Shortfall, POV, Arrival Price algorithms
- microstructure -- Order book analysis, trade flow classification, price impact modeling
- regime -- Market regime detection (HMM, threshold, ML-based)
- risk -- Position sizing (Kelly, risk parity, vol targeting), portfolio limits, drawdown monitoring
Features
| Cargo feature | Description |
|---|---|
postgres |
Hot-reload strategy config from PostgreSQL |
Usage
use adaptive_strategy::{AdaptiveStrategy, StrategyConfig};
let config = StrategyConfig::default();
let strategy = AdaptiveStrategy::new(config).await?;
Testing
SQLX_OFFLINE=true cargo test -p adaptive-strategy --lib
Dependencies
Core: tokio, candle-core, serde, tracing, chrono
ML models provided by the ml crate.