限制盘后固定价格撮合生效日期
This commit is contained in:
@@ -26,6 +26,9 @@ use crate::strategy::{
|
|||||||
TargetPortfolioOrderPricing,
|
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)]
|
#[derive(Debug, Error)]
|
||||||
pub enum BacktestError {
|
pub enum BacktestError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
@@ -1970,6 +1973,16 @@ where
|
|||||||
})
|
})
|
||||||
.filter(|date| self.config.end_date.map(|end| *date <= end).unwrap_or(true))
|
.filter(|date| self.config.end_date.map(|end| *date <= end).unwrap_or(true))
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
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| {
|
let has_decision_inputs = |date: NaiveDate| {
|
||||||
!self.data.factor_snapshot_rows_on(date).is_empty()
|
!self.data.factor_snapshot_rows_on(date).is_empty()
|
||||||
&& !self.data.candidate_snapshot_rows_on(date).is_empty()
|
&& !self.data.candidate_snapshot_rows_on(date).is_empty()
|
||||||
|
|||||||
Reference in New Issue
Block a user