diff --git a/crates/fidc-core/src/engine.rs b/crates/fidc-core/src/engine.rs index 3ee1506..6042ad6 100644 --- a/crates/fidc-core/src/engine.rs +++ b/crates/fidc-core/src/engine.rs @@ -26,6 +26,9 @@ use crate::strategy::{ TargetPortfolioOrderPricing, }; +pub const POST_CLOSE_FIXED_PRICE_EFFECTIVE_DATE: NaiveDate = + NaiveDate::from_ymd_opt(2026, 7, 6).expect("valid post-close effective date"); + #[derive(Debug, Error)] pub enum BacktestError { #[error(transparent)] @@ -1970,6 +1973,16 @@ where }) .filter(|date| self.config.end_date.map(|end| *date <= end).unwrap_or(true)) .collect::>(); + if self.broker.matching_type() == MatchingType::PostCloseFixedPrice + && calendar_dates + .first() + .is_some_and(|date| *date < POST_CLOSE_FIXED_PRICE_EFFECTIVE_DATE) + { + return Err(BacktestError::Execution(format!( + "post_close_fixed_price is unavailable before {}", + POST_CLOSE_FIXED_PRICE_EFFECTIVE_DATE + ))); + } let has_decision_inputs = |date: NaiveDate| { !self.data.factor_snapshot_rows_on(date).is_empty() && !self.data.candidate_snapshot_rows_on(date).is_empty()