diff --git a/crates/fidc-core/src/risk_control.rs b/crates/fidc-core/src/risk_control.rs index c153965..353e801 100644 --- a/crates/fidc-core/src/risk_control.rs +++ b/crates/fidc-core/src/risk_control.rs @@ -342,14 +342,6 @@ impl ChinaAShareRiskControl { if reject_paused && (market.paused || candidate.is_paused) { return Some("paused"); } - let reject_st = match scope { - RiskCheckScope::Selection => config.static_rules.reject_st_selection, - RiskCheckScope::Buy => config.static_rules.reject_st_buy, - RiskCheckScope::Sell => false, - }; - if reject_st && candidate.is_st { - return Some("st"); - } let reject_star_st = match scope { RiskCheckScope::Selection => config.static_rules.reject_star_st_selection, RiskCheckScope::Buy => config.static_rules.reject_star_st_buy, @@ -358,6 +350,14 @@ impl ChinaAShareRiskControl { if reject_star_st && candidate.is_star_st { return Some("star_st"); } + let reject_st = match scope { + RiskCheckScope::Selection => config.static_rules.reject_st_selection, + RiskCheckScope::Buy => config.static_rules.reject_st_buy, + RiskCheckScope::Sell => false, + }; + if reject_st && candidate.is_st && !candidate.is_star_st { + return Some("st"); + } let reject_new_listing = match scope { RiskCheckScope::Selection => config.static_rules.reject_new_listing_selection, RiskCheckScope::Buy => config.static_rules.reject_new_listing_buy, @@ -877,6 +877,10 @@ mod tests { let mut star_st_candidate = candidate(date); star_st_candidate.is_star_st = true; star_st_candidate.allow_sell = true; + let mut overlapping_star_st_candidate = candidate(date); + overlapping_star_st_candidate.is_st = true; + overlapping_star_st_candidate.is_star_st = true; + overlapping_star_st_candidate.allow_sell = true; let mut config = FidcRiskControlConfig::default(); config.static_rules.reject_st_selection = false; @@ -904,6 +908,16 @@ mod tests { ), Some("star_st") ); + assert_eq!( + ChinaAShareRiskControl::selection_rejection_reason_with_config( + date, + &overlapping_star_st_candidate, + &market, + None, + &config, + ), + Some("star_st") + ); config.static_rules.reject_st_selection = true; config.static_rules.reject_st_buy = true; @@ -932,6 +946,17 @@ mod tests { ), None ); + assert_eq!( + ChinaAShareRiskControl::buy_rejection_reason_with_config( + date, + &overlapping_star_st_candidate, + &market, + None, + 6.27, + &config, + ), + None + ); } #[test]