From bf457d94ce5a085effb0c575dc5a2acdc393bd4c Mon Sep 17 00:00:00 2001 From: boris Date: Sat, 4 Jul 2026 11:21:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3ST=E6=98=9FST=E7=8B=AC?= =?UTF-8?q?=E7=AB=8B=E9=A3=8E=E6=8E=A7=E5=88=A4=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/fidc-core/src/risk_control.rs | 41 ++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 8 deletions(-) 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]