chore: 更新 fidc-backtest-engine - 2026-05-13
This commit is contained in:
@@ -1104,7 +1104,7 @@ pub struct CnSmallCapRotationConfig {
|
||||
pub take_profit_pct: f64,
|
||||
pub signal_symbol: Option<String>,
|
||||
pub skip_months: Vec<u32>,
|
||||
pub skip_month_day_ranges: Vec<(u32, u32, u32)>,
|
||||
pub skip_month_day_ranges: Vec<(Option<u32>, u32, u32, u32)>,
|
||||
}
|
||||
|
||||
impl CnSmallCapRotationConfig {
|
||||
@@ -1159,23 +1159,29 @@ impl CnSmallCapRotationConfig {
|
||||
signal_symbol: Some("000852.SH".to_string()),
|
||||
skip_months: vec![],
|
||||
skip_month_day_ranges: vec![
|
||||
(1, 15, 30),
|
||||
(4, 15, 29),
|
||||
(8, 15, 31),
|
||||
(10, 20, 30),
|
||||
(12, 20, 30),
|
||||
(None, 1, 15, 30),
|
||||
(None, 4, 15, 29),
|
||||
(None, 8, 15, 31),
|
||||
(None, 10, 20, 30),
|
||||
(None, 12, 20, 30),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
fn in_skip_window(&self, date: NaiveDate) -> bool {
|
||||
let year = date.year() as u32;
|
||||
let month = date.month();
|
||||
let day = date.day();
|
||||
self.skip_months.contains(&month)
|
||||
|| self
|
||||
.skip_month_day_ranges
|
||||
.iter()
|
||||
.any(|(m, start_day, end_day)| month == *m && day >= *start_day && day <= *end_day)
|
||||
.any(|(window_year, m, start_day, end_day)| {
|
||||
window_year.map(|value| value == year).unwrap_or(true)
|
||||
&& month == *m
|
||||
&& day >= *start_day
|
||||
&& day <= *end_day
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1533,7 +1539,7 @@ pub struct OmniMicroCapConfig {
|
||||
pub trade_rate: f64,
|
||||
pub stop_loss_ratio: f64,
|
||||
pub take_profit_ratio: f64,
|
||||
pub skip_month_day_ranges: Vec<(u32, u32, u32)>,
|
||||
pub skip_month_day_ranges: Vec<(Option<u32>, u32, u32, u32)>,
|
||||
}
|
||||
|
||||
impl OmniMicroCapConfig {
|
||||
@@ -1592,11 +1598,17 @@ impl OmniMicroCapConfig {
|
||||
}
|
||||
|
||||
fn in_skip_window(&self, date: NaiveDate) -> bool {
|
||||
let year = date.year() as u32;
|
||||
let month = date.month();
|
||||
let day = date.day();
|
||||
self.skip_month_day_ranges
|
||||
.iter()
|
||||
.any(|(m, start_day, end_day)| month == *m && day >= *start_day && day <= *end_day)
|
||||
.any(|(window_year, m, start_day, end_day)| {
|
||||
window_year.map(|value| value == year).unwrap_or(true)
|
||||
&& month == *m
|
||||
&& day >= *start_day
|
||||
&& day <= *end_day
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user