diff --git a/crates/fidc-core/src/broker.rs b/crates/fidc-core/src/broker.rs index 0de0aab..373a77f 100644 --- a/crates/fidc-core/src/broker.rs +++ b/crates/fidc-core/src/broker.rs @@ -2295,7 +2295,10 @@ where position: &crate::portfolio::Position, algo_request: Option<&AlgoExecutionRequest>, ) -> RuleCheck { - if self.risk_config.static_rules.respect_allow_buy_sell && !candidate.allow_sell { + if self.risk_config.static_rules.respect_allow_buy_sell + && !self.aiquant_execution_rules + && !candidate.allow_sell + { return RuleCheck::reject("sell_disabled"); } let check_price = if self.aiquant_execution_rules { @@ -2310,6 +2313,10 @@ where } else { ChinaAShareRiskControl::sell_check_price(snapshot, self.execution_price_field) }; + let mut risk_config = self.risk_config.clone(); + if self.aiquant_execution_rules { + risk_config.static_rules.respect_allow_buy_sell = false; + } if let Some(reason) = ChinaAShareRiskControl::sell_rejection_reason_with_config( date, candidate, @@ -2317,7 +2324,7 @@ where instrument, Some(position), check_price, - &self.risk_config, + &risk_config, ) { return RuleCheck::reject(reason); } diff --git a/crates/fidc-core/src/risk_control.rs b/crates/fidc-core/src/risk_control.rs index 16092c7..4d8b185 100644 --- a/crates/fidc-core/src/risk_control.rs +++ b/crates/fidc-core/src/risk_control.rs @@ -845,7 +845,8 @@ mod tests { fn sell_rejection_blocks_execution_price_at_lower_limit() { let prev_date = d(2024, 4, 16); let date = d(2024, 4, 17); - let candidate = candidate(date); + let mut candidate = candidate(date); + candidate.allow_sell = true; let market = market(date, 5.63, 5.63); let position = position(prev_date); @@ -1081,6 +1082,7 @@ mod tests { fn missing_risk_state_rejects_selection_and_buy_when_static_filters_enabled() { 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);