**Progress: 1,178 → 57 test errors (95% reduction)** ## Status Summary - ✅ Production code: Compiles cleanly (0 errors) - ⚠️ Test code: 57 errors remain (massive improvement) - ⚙️ All services build successfully - 📊 Warning count: 253 (target: <20) - AGENTS WILL FIX ## Remaining Test Errors (57 total) ### Primary Issues: 1. 23× E0308 mismatched types 2. 17× E0433 undeclared Decimal 3. 15× E0433 compliance module not found 4. 6× E0624 private method access 5. Various import and type issues ## Next Phase: Wave 33-2 Launch 10+ parallel agents to: - Fix remaining 57 test compilation errors - Reduce 253 warnings to <20 - Achieve 95% test coverage - Ensure all tests pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
66 lines
2.0 KiB
Rust
66 lines
2.0 KiB
Rust
//! Basic adaptive strategy example
|
|
//!
|
|
//! This example demonstrates how to set up and run a basic adaptive trading strategy
|
|
//! with ensemble models, risk management, and execution algorithms.
|
|
|
|
use adaptive_strategy::config::AdaptiveStrategyConfig;
|
|
use adaptive_strategy::AdaptiveStrategy;
|
|
use std::time::Duration;
|
|
use tokio::time::sleep;
|
|
use tracing::{info, Level};
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
// Initialize logging
|
|
tracing_subscriber::fmt().with_max_level(Level::INFO).init();
|
|
|
|
info!("Starting basic adaptive strategy example");
|
|
|
|
// Create configuration
|
|
let config = create_strategy_config();
|
|
|
|
// Initialize the adaptive strategy
|
|
let mut strategy = AdaptiveStrategy::new(config).await?;
|
|
|
|
info!("Strategy initialized successfully");
|
|
|
|
// Get initial state
|
|
let initial_state = strategy.get_state().await;
|
|
info!(
|
|
"Initial strategy state: active={}, regime={}",
|
|
initial_state.active, initial_state.current_regime
|
|
);
|
|
|
|
// Simulate running for a short period (in production, this would run continuously)
|
|
info!("Running strategy simulation for 10 seconds...");
|
|
|
|
// Start the strategy (this would run indefinitely in production)
|
|
// For demo purposes, we'll use a timeout
|
|
let strategy_task = tokio::spawn(async move {
|
|
if let Err(e) = strategy.start().await {
|
|
eprintln!("Strategy error: {}", e);
|
|
}
|
|
});
|
|
|
|
// Let it run for 10 seconds
|
|
sleep(Duration::from_secs(10)).await;
|
|
|
|
info!("Stopping strategy simulation");
|
|
strategy_task.abort();
|
|
|
|
info!("Example completed successfully");
|
|
|
|
Ok(())
|
|
}
|
|
|
|
/// Create a comprehensive strategy configuration
|
|
fn create_strategy_config() -> AdaptiveStrategyConfig {
|
|
let mut config = AdaptiveStrategyConfig::default();
|
|
|
|
// Customize the execution interval for demo
|
|
config.general.execution_interval = Duration::from_millis(500);
|
|
config.general.error_backoff_duration = Duration::from_secs(2);
|
|
|
|
config
|
|
}
|