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