- Archive: 85 agent .txt files → docs/archive/agents/legacy_txt/ - Scripts: Move 110 shell scripts → scripts/ (keep deploy.sh in root) - Models: Move 18 .safetensors → ml/models/checkpoints/training_artifacts/ - Delete: 34 directories (~33GB freed) - target/, coverage_*, test artifacts - Build: Clean 14 build artifacts (.rlib, .o, .pid, binaries) - Tests: Move 14 .rs files → tests/standalone/ - SQL: Move 5 files → sql/ (keep init-db*.sql for Docker) - Wave 153: Archive to docs/archive/historical/wave153/ - Docs: Archive 9 markdown files to wave_d/reports/ and historical/ Total impact: ~34GB freed (both waves), root directory cleaned from 583 to ~40 essential files Directory count reduced from 65 to 31 (52% reduction) All historical data preserved in organized archive structure
72 lines
2.2 KiB
Rust
72 lines
2.2 KiB
Rust
//! Manual test for regime orchestrator database integration
|
|
//! Run with: cargo run --bin test_regime_db_integration
|
|
|
|
use chrono::Utc;
|
|
use ml::regime::orchestrator::{Bar, RegimeOrchestrator};
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
// Database connection
|
|
let database_url = "postgresql://foxhunt:foxhunt_dev_password@localhost:5432/foxhunt";
|
|
let pool = sqlx::PgPool::connect(database_url).await?;
|
|
|
|
println!("✓ Connected to database");
|
|
|
|
// Create orchestrator
|
|
let mut orchestrator = RegimeOrchestrator::new(pool.clone()).await?;
|
|
println!("✓ Created RegimeOrchestrator");
|
|
|
|
// Create test bars (trending pattern)
|
|
let base_time = Utc::now();
|
|
let bars: Vec<Bar> = (0..100)
|
|
.map(|i| {
|
|
let price = 4500.0 + (i as f64 * 2.0); // Strong uptrend
|
|
Bar {
|
|
timestamp: base_time + chrono::Duration::seconds(i as i64 * 60),
|
|
open: price,
|
|
high: price + 1.0,
|
|
low: price - 0.5,
|
|
close: price + 0.8,
|
|
volume: 1000.0,
|
|
}
|
|
})
|
|
.collect();
|
|
|
|
println!("✓ Created {} test bars", bars.len());
|
|
|
|
// Run detection
|
|
let regime_state = orchestrator
|
|
.detect_and_persist("ES.FUT", &bars)
|
|
.await?;
|
|
|
|
println!("✓ Detected regime: {}", regime_state.regime);
|
|
println!(" Confidence: {:.2}", regime_state.confidence);
|
|
println!(" ADX: {:?}", regime_state.adx);
|
|
|
|
// Query database
|
|
let regime_count: i64 = sqlx::query_scalar(
|
|
"SELECT COUNT(*) FROM regime_states WHERE symbol = 'ES.FUT'"
|
|
)
|
|
.fetch_one(&pool)
|
|
.await?;
|
|
|
|
println!("✓ Database regime_states rows: {}", regime_count);
|
|
|
|
let transition_count: i64 = sqlx::query_scalar(
|
|
"SELECT COUNT(*) FROM regime_transitions WHERE symbol = 'ES.FUT'"
|
|
)
|
|
.fetch_one(&pool)
|
|
.await?;
|
|
|
|
println!("✓ Database regime_transitions rows: {}", transition_count);
|
|
|
|
// Print final status
|
|
println!("\n=== REGIME DETECTION INTEGRATION: PASS ===");
|
|
println!("Test execution: PASS");
|
|
println!("Database population: OK");
|
|
println!("Regime states: {} rows", regime_count);
|
|
println!("Transitions: {} rows", transition_count);
|
|
|
|
Ok(())
|
|
}
|