use redfolder::calendar::CalendarClient;
use redfolder::config::RedFolderConfig;
use redfolder::engine::BlackoutEngine;
use redfolder::error::Result;
#[tokio::main]
async fn main() -> Result<()> {
let client = CalendarClient::new(None);
let events = client.fetch_or_cached().await?;
let prop_config = RedFolderConfig::prop_firm_strict();
println!("--- RedFolder Prop Firm Risk Guard ---");
println!("Currencies monitored: {:?}", prop_config.currencies);
println!(
"Buffer: {}m before, {}m after",
prop_config.before_min, prop_config.after_min
);
println!("Weekend Curfew Mode: {}", prop_config.weekend_mode);
let engine = BlackoutEngine::compile(&events, &[&prop_config], chrono::Utc::now());
let test_symbols = [("EURUSD", "EUR"), ("GBPUSD", "GBP"), ("USDJPY", "JPY")];
for (symbol, currency) in test_symbols {
let pair_cfg = RedFolderConfig::builder()
.currencies(vec![currency.to_string(), "USD".to_string()])
.impacts(vec!["High"])
.buffer_minutes(5, 5)
.build();
if let Some(win) = engine.status(&pair_cfg) {
println!(
"⛔ REJECT ORDER on {}: Active Red Folder news blackout ({}). Ends in {}m.",
symbol,
win.summary_title(),
win.remaining_minutes()
);
} else {
println!("✅ ALLOW ORDER on {}: Clear to execute.", symbol);
}
}
Ok(())
}