chore: clean up examples, update ML binaries and risk tests

- Delete 14 unused example files (-3,543 lines): config, adaptive-strategy,
  data, storage, trading_engine, api_gateway, backtesting, trading_service, chaos
- Update ML training/eval binaries: improved CLI args, completion tracking,
  CUDA test cleanup, hyperopt enhancements
- Fix KAN network and TFT module adjustments
- Update risk test assertions for consistency
- Fix backtesting repositories and promotion manager
- Update .serena project config and Cargo dependencies

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-02-27 01:33:18 +01:00
parent 1de1769c4f
commit afd85b2f8f
46 changed files with 403 additions and 3544 deletions

View File

@@ -77,7 +77,7 @@ struct Args {
#[arg(long)]
model: String,
/// Feature dimension (must match extract_ml_features output)
/// Feature dimension (must match `extract_ml_features` output)
#[arg(long, default_value_t = 51)]
feature_dim: usize,
@@ -392,6 +392,7 @@ fn create_model(
/// Run supervised inference on test features and return per-bar trade returns,
/// action counts, and directional accuracy.
#[allow(clippy::cognitive_complexity)]
fn evaluate_fold(
fold: usize,
model_name: &str,
@@ -529,6 +530,7 @@ fn evaluate_fold(
// Main
// ---------------------------------------------------------------------------
#[allow(clippy::cognitive_complexity, clippy::too_many_lines)]
fn main() -> Result<()> {
tracing_subscriber::fmt()
.with_env_filter(
@@ -552,7 +554,13 @@ fn main() -> Result<()> {
args.tx_cost_bps, args.spread_ticks, args.tick_size
);
let device = Device::Cpu;
let device = if let Ok(d) = Device::cuda_if_available(0) {
info!("Using CUDA device for evaluation");
d
} else {
info!("CUDA unavailable, using CPU");
Device::Cpu
};
// 1. Load all OHLCV bars
info!("Step 1/4: Loading OHLCV bars from DBN files...");
@@ -629,14 +637,14 @@ fn main() -> Result<()> {
Ok(f) => f,
Err(e) => {
warn!(
" Fold {} test feature extraction failed: {}",
" Fold {} -- test feature extraction failed: {}",
window.fold, e
);
continue;
}
};
if test_features.is_empty() {
warn!(" Fold {} empty test features, skipping", window.fold);
warn!(" Fold {} -- empty test features, skipping", window.fold);
continue;
}
let test_norm = norm_stats.normalize_batch(&test_features);
@@ -644,7 +652,7 @@ fn main() -> Result<()> {
// Align bars to features
let warmup_offset = window.test.len().saturating_sub(test_norm.len());
let test_bars_aligned = if warmup_offset < window.test.len() {
&window.test[warmup_offset..]
window.test.get(warmup_offset..).unwrap_or(&window.test)
} else {
&window.test
};
@@ -669,7 +677,7 @@ fn main() -> Result<()> {
Ok((returns, action_counts, directional_accuracy)) => {
let metrics = compute_metrics(&returns);
info!(
" [{}] Fold {} Sharpe={:.4} MaxDD={:.2}% WinRate={:.1}% PF={:.2} Return={:.4}% Trades={} DirAcc={:.1}%",
" [{}] Fold {} -- Sharpe={:.4} MaxDD={:.2}% WinRate={:.1}% PF={:.2} Return={:.4}% Trades={} DirAcc={:.1}%",
args.model.to_uppercase(),
window.fold,
metrics.sharpe_ratio,
@@ -681,7 +689,7 @@ fn main() -> Result<()> {
directional_accuracy,
);
info!(
" [{}] Actions BUY={} SELL={} HOLD={}",
" [{}] Actions -- BUY={} SELL={} HOLD={}",
args.model.to_uppercase(),
action_counts.first().copied().unwrap_or(0),
action_counts.get(1).copied().unwrap_or(0),
@@ -748,7 +756,7 @@ fn main() -> Result<()> {
};
info!(
" {} avg Sharpe={:.4} avg MaxDD={:.2}% avg WinRate={:.1}% avg DirAcc={:.1}%",
" {} -- avg Sharpe={:.4} avg MaxDD={:.2}% avg WinRate={:.1}% avg DirAcc={:.1}%",
args.model.to_uppercase(),
aggregate.avg_sharpe,
aggregate.avg_drawdown,