修正FIDC选股风控延后边界
This commit is contained in:
@@ -584,8 +584,7 @@ fn missing_selection_risk_state_rejected(code: &str, config: &FidcRiskControlCon
|
||||
|| config.static_rules.reject_bjse_selection
|
||||
|| config.static_rules.reject_one_yuan_selection
|
||||
|| config.static_rules.reject_upper_limit_selection
|
||||
|| config.static_rules.reject_lower_limit_selection
|
||||
|| config.static_rules.respect_allow_buy_sell;
|
||||
|| config.static_rules.reject_lower_limit_selection;
|
||||
}
|
||||
missing_field_rejected(&fields, config, RiskCheckScope::Selection)
|
||||
}
|
||||
@@ -681,15 +680,13 @@ fn missing_single_field_rejected(
|
||||
RiskCheckScope::Sell => false,
|
||||
},
|
||||
"allow_buy" => match scope {
|
||||
RiskCheckScope::Selection | RiskCheckScope::Buy => {
|
||||
config.static_rules.respect_allow_buy_sell
|
||||
}
|
||||
RiskCheckScope::Selection => false,
|
||||
RiskCheckScope::Buy => config.static_rules.respect_allow_buy_sell,
|
||||
RiskCheckScope::Sell => false,
|
||||
},
|
||||
"allow_sell" => match scope {
|
||||
RiskCheckScope::Selection | RiskCheckScope::Sell => {
|
||||
config.static_rules.respect_allow_buy_sell
|
||||
}
|
||||
RiskCheckScope::Selection => false,
|
||||
RiskCheckScope::Sell => config.static_rules.respect_allow_buy_sell,
|
||||
RiskCheckScope::Buy => false,
|
||||
},
|
||||
"upper_limit" | "upper_limit_price" | "high_limit" | "high_limit_price" => match scope {
|
||||
@@ -1086,7 +1083,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_risk_state_rejects_selection_and_buy_when_static_filters_enabled() {
|
||||
fn missing_risk_state_default_selection_ignores_allow_flags_but_buy_rejects() {
|
||||
let date = d(2025, 1, 2);
|
||||
let mut candidate = candidate(date);
|
||||
candidate.allow_sell = true;
|
||||
@@ -1106,11 +1103,28 @@ mod tests {
|
||||
6.27,
|
||||
);
|
||||
|
||||
assert_eq!(selection_reason, Some("missing_risk_state"));
|
||||
assert_eq!(selection_reason, None);
|
||||
assert_eq!(buy_reason, Some("missing_risk_state"));
|
||||
assert_eq!(sell_reason, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_risk_state_selection_still_respects_configured_static_filters() {
|
||||
let date = d(2025, 1, 2);
|
||||
let mut candidate = candidate(date);
|
||||
candidate.allow_sell = true;
|
||||
candidate.risk_level_code = Some("missing_risk_state:is_st,allow_buy".to_string());
|
||||
let market = market(date, 6.27, 5.63);
|
||||
let mut config = FidcRiskControlConfig::default();
|
||||
config.static_rules.reject_st_selection = true;
|
||||
|
||||
let selection_reason = ChinaAShareRiskControl::selection_rejection_reason_with_config(
|
||||
date, &candidate, &market, None, &config,
|
||||
);
|
||||
|
||||
assert_eq!(selection_reason, Some("missing_risk_state"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_risk_state_selection_audit_keeps_missing_fields_in_reason() {
|
||||
let date = d(2025, 1, 2);
|
||||
@@ -1119,12 +1133,11 @@ mod tests {
|
||||
Some("missing_risk_state:is_st,allow_buy,upper_limit_price".to_string());
|
||||
let market = market(date, 6.27, 5.63);
|
||||
|
||||
let mut config = FidcRiskControlConfig::default();
|
||||
config.static_rules.reject_st_selection = true;
|
||||
config.static_rules.reject_upper_limit_selection = true;
|
||||
let decision = ChinaAShareRiskControl::selection_rejection_decision_with_config(
|
||||
date,
|
||||
&candidate,
|
||||
&market,
|
||||
None,
|
||||
&FidcRiskControlConfig::default(),
|
||||
date, &candidate, &market, None, &config,
|
||||
)
|
||||
.expect("missing risk state rejection");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user