From 19b7a0c00c140c32a2c48e8ac360d5a4a102ba2a Mon Sep 17 00:00:00 2001 From: boris Date: Mon, 29 Jun 2026 17:45:46 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=9B=AE=E6=A0=87=E7=BB=84?= =?UTF-8?q?=E5=90=88=E5=8C=BA=E9=97=B4=E8=A1=A8=E8=BE=BE=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/fidc-core/src/platform_expr_strategy.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/fidc-core/src/platform_expr_strategy.rs b/crates/fidc-core/src/platform_expr_strategy.rs index 846e343..9688a6d 100644 --- a/crates/fidc-core/src/platform_expr_strategy.rs +++ b/crates/fidc-core/src/platform_expr_strategy.rs @@ -20259,13 +20259,16 @@ mod tests { target_weights_expr: concat!( "{", "\"000521.SZ\": if current_date == \"2023-01-03\" { 0.025 } else { 0.0 },", + "\"000333.SZ\": if current_date >= \"2023-01-03\" && current_date < \"2023-02-27\" { 0.05 } else { 0.0 },", "\"001239.SZ\": if current_date == \"2024-08-13\" { 0.025 } else { 0.0 }", "}" ) .to_string(), order_prices_expr: None, valuation_prices_expr: None, - when_expr: None, + when_expr: Some( + "current_date >= \"2023-01-03\" && current_date <= \"2023-03-02\"".to_string(), + ), reason: "date_conditioned_target_weights".to_string(), }]; let mut strategy = PlatformExprStrategy::new(cfg); @@ -20276,13 +20279,14 @@ mod tests { match &decision.order_intents[0] { crate::strategy::OrderIntent::TargetPortfolioSmart { target_weights, .. } => { assert_eq!(target_weights.get("000521.SZ").copied(), Some(0.025)); + assert_eq!(target_weights.get("000333.SZ").copied(), Some(0.05)); assert_eq!(target_weights.get("001239.SZ").copied(), Some(0.0)); assert_eq!( target_weights .iter() .filter(|(_, weight)| weight.abs() > f64::EPSILON) .count(), - 1 + 2 ); } other => panic!("unexpected explicit target portfolio intent: {other:?}"),