修正ST星ST独立风控判定

This commit is contained in:
boris
2026-07-04 11:21:00 +08:00
parent e045ca5a49
commit bf457d94ce
+33 -8
View File
@@ -342,14 +342,6 @@ impl ChinaAShareRiskControl {
if reject_paused && (market.paused || candidate.is_paused) { if reject_paused && (market.paused || candidate.is_paused) {
return Some("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 { let reject_star_st = match scope {
RiskCheckScope::Selection => config.static_rules.reject_star_st_selection, RiskCheckScope::Selection => config.static_rules.reject_star_st_selection,
RiskCheckScope::Buy => config.static_rules.reject_star_st_buy, RiskCheckScope::Buy => config.static_rules.reject_star_st_buy,
@@ -358,6 +350,14 @@ impl ChinaAShareRiskControl {
if reject_star_st && candidate.is_star_st { if reject_star_st && candidate.is_star_st {
return Some("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 { let reject_new_listing = match scope {
RiskCheckScope::Selection => config.static_rules.reject_new_listing_selection, RiskCheckScope::Selection => config.static_rules.reject_new_listing_selection,
RiskCheckScope::Buy => config.static_rules.reject_new_listing_buy, RiskCheckScope::Buy => config.static_rules.reject_new_listing_buy,
@@ -877,6 +877,10 @@ mod tests {
let mut star_st_candidate = candidate(date); let mut star_st_candidate = candidate(date);
star_st_candidate.is_star_st = true; star_st_candidate.is_star_st = true;
star_st_candidate.allow_sell = 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(); let mut config = FidcRiskControlConfig::default();
config.static_rules.reject_st_selection = false; config.static_rules.reject_st_selection = false;
@@ -904,6 +908,16 @@ mod tests {
), ),
Some("star_st") 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_selection = true;
config.static_rules.reject_st_buy = true; config.static_rules.reject_st_buy = true;
@@ -932,6 +946,17 @@ mod tests {
), ),
None None
); );
assert_eq!(
ChinaAShareRiskControl::buy_rejection_reason_with_config(
date,
&overlapping_star_st_candidate,
&market,
None,
6.27,
&config,
),
None
);
} }
#[test] #[test]