Files
foxhunt/adaptive-strategy
jgrusewski 434f9fbf7a fix(adaptive-strategy): replace fake Kelly return history with error + fallback
get_historical_returns was returning a hardcoded 20-value vector of fake
returns for ALL symbols, causing Kelly criterion to compute position sizes
based on fabricated data. Now returns an error explaining that no market
data feed is connected.

calculate_position_size catches the Kelly/PPO sizing errors and falls
back to standard fixed-fraction sizing with a warning log, instead of
propagating the error to callers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 23:22:50 +01:00
..

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.