## MASSIVE CLEANUP METRICS - **277 files modified/deleted**: Complete workspace transformation - **58 .bak files eliminated**: Zero transitional artifacts remaining - **ALL re-export anti-patterns removed**: 100% architectural compliance - **Zero backward compatibility layers**: Clean, modern architecture only ## ARCHITECTURAL ENFORCEMENT ACHIEVED ### ✅ COMPLETE RE-EXPORT ELIMINATION - Removed ALL `pub use` re-exports across entire codebase - Enforced direct imports: `use config::ServiceConfig` not aliases - Eliminated all backward compatibility shims and transitional code - Zero tolerance for architectural debt ### ✅ CLEAN DEPENDENCY PATTERNS - Services import directly from config crate: `use config::{ServiceConfig, ConfigManager}` - No foxhunt-config-crate or foxhunt- prefixed anti-patterns - Clean separation between config provider and service consumers - Proper ownership boundaries enforced ### ✅ SERVICE ARCHITECTURE COMPLIANCE - TLI remains pure client: no server components, no database deps - Trading Service: monolithic with all business logic contained - Config crate: ONLY component with vault access - Clear service boundaries with no architectural violations ### ✅ CODEBASE HYGIENE - All .bak files purged: zero development artifacts - No dead code or unused imports - Consistent coding patterns across all modules - Modern Rust idioms enforced throughout ## ZERO BACKWARD COMPATIBILITY This commit eliminates ALL transitional code and backward compatibility layers. The architecture is now enforced with zero tolerance for anti-patterns. ## COMPILATION STATUS ✅ Entire workspace compiles cleanly ✅ All services build successfully ✅ Zero architectural violations remain This represents the completion of aggressive architectural enforcement with complete elimination of technical debt and anti-patterns. 🔥 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
67 lines
2.0 KiB
Rust
67 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
|
|
}
|
|
|