精简平台选股缺排名字段诊断
This commit is contained in:
@@ -7042,6 +7042,8 @@ impl PlatformExprStrategy {
|
||||
5,
|
||||
);
|
||||
let mut candidates = Vec::new();
|
||||
let mut missing_rank_count = 0usize;
|
||||
let mut missing_rank_examples = Vec::new();
|
||||
for candidate in universe {
|
||||
let stock = self.selection_stock_state_with_factor_date(
|
||||
ctx,
|
||||
@@ -7064,11 +7066,9 @@ impl PlatformExprStrategy {
|
||||
}
|
||||
let rank_value = self.rank_value(ctx, day, &candidate, &stock)?;
|
||||
if !rank_value.is_finite() {
|
||||
if diagnostics.len() < 12 {
|
||||
diagnostics.push(format!(
|
||||
"{} rejected by missing rank field",
|
||||
candidate.symbol
|
||||
));
|
||||
missing_rank_count += 1;
|
||||
if missing_rank_examples.len() < 5 {
|
||||
missing_rank_examples.push(candidate.symbol.clone());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -7114,6 +7114,13 @@ impl PlatformExprStrategy {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if selected.len() < limit && missing_rank_count > 0 && diagnostics.len() < 12 {
|
||||
diagnostics.push(format!(
|
||||
"rank_field_unavailable count={} examples={}",
|
||||
missing_rank_count,
|
||||
missing_rank_examples.join(",")
|
||||
));
|
||||
}
|
||||
|
||||
Ok((selected, diagnostics, risk_decisions))
|
||||
}
|
||||
@@ -7709,6 +7716,8 @@ impl PlatformExprStrategy {
|
||||
) -> Result<(Vec<String>, Vec<String>, usize, Vec<String>), BacktestError> {
|
||||
let mut diagnostics = Vec::new();
|
||||
let mut candidates = Vec::new();
|
||||
let mut missing_rank_count = 0usize;
|
||||
let mut missing_rank_examples = Vec::new();
|
||||
let quote_usage = self.stock_filter_quote_usage();
|
||||
let selection_risk_deferral = if ctx.is_lagged_execution() {
|
||||
SelectionRiskDeferral::All
|
||||
@@ -7748,11 +7757,9 @@ impl PlatformExprStrategy {
|
||||
}
|
||||
let rank_value = self.rank_value(ctx, day, &candidate, &stock)?;
|
||||
if !rank_value.is_finite() {
|
||||
if diagnostics.len() < 12 {
|
||||
diagnostics.push(format!(
|
||||
"{} quote_plan rejected by missing rank field",
|
||||
candidate.symbol
|
||||
));
|
||||
missing_rank_count += 1;
|
||||
if missing_rank_examples.len() < 5 {
|
||||
missing_rank_examples.push(candidate.symbol.clone());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -7812,6 +7819,17 @@ impl PlatformExprStrategy {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (selected_symbols.len() < selection_limit
|
||||
|| quote_candidate_symbols.len() < quote_candidate_limit)
|
||||
&& missing_rank_count > 0
|
||||
&& diagnostics.len() < 12
|
||||
{
|
||||
diagnostics.push(format!(
|
||||
"quote_plan_rank_field_unavailable count={} examples={}",
|
||||
missing_rank_count,
|
||||
missing_rank_examples.join(",")
|
||||
));
|
||||
}
|
||||
Ok((
|
||||
quote_candidate_symbols,
|
||||
selected_symbols,
|
||||
|
||||
Reference in New Issue
Block a user