修复AiQuant策略表达式回测执行语义
This commit is contained in:
@@ -41,6 +41,21 @@ impl ChinaAShareRiskControl {
|
||||
candidate: &CandidateEligibility,
|
||||
market: &DailyMarketSnapshot,
|
||||
instrument: Option<&Instrument>,
|
||||
) -> Option<&'static str> {
|
||||
if let Some(reason) = Self::baseline_rejection_reason(date, candidate, market, instrument) {
|
||||
return Some(reason);
|
||||
}
|
||||
if !candidate.allow_buy || !candidate.allow_sell {
|
||||
return Some("trade_disabled");
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
pub fn baseline_rejection_reason(
|
||||
date: NaiveDate,
|
||||
candidate: &CandidateEligibility,
|
||||
market: &DailyMarketSnapshot,
|
||||
instrument: Option<&Instrument>,
|
||||
) -> Option<&'static str> {
|
||||
if let Some(reason) = Self::instrument_rejection_reason(instrument, date) {
|
||||
return Some(reason);
|
||||
@@ -60,9 +75,6 @@ impl ChinaAShareRiskControl {
|
||||
if candidate.is_one_yuan || market.day_open <= 1.0 {
|
||||
return Some("one_yuan");
|
||||
}
|
||||
if !candidate.allow_buy || !candidate.allow_sell {
|
||||
return Some("trade_disabled");
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
@@ -73,8 +85,7 @@ impl ChinaAShareRiskControl {
|
||||
instrument: Option<&Instrument>,
|
||||
check_price: f64,
|
||||
) -> Option<&'static str> {
|
||||
if let Some(reason) = Self::selection_rejection_reason(date, candidate, market, instrument)
|
||||
{
|
||||
if let Some(reason) = Self::baseline_rejection_reason(date, candidate, market, instrument) {
|
||||
return Some(reason);
|
||||
}
|
||||
if !candidate.allow_buy {
|
||||
|
||||
Reference in New Issue
Block a user