From 67f15f12ca1ab2fc40fa0f7453acfcd60d1b077c Mon Sep 17 00:00:00 2001 From: boris Date: Sun, 12 Jul 2026 04:49:40 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9A=94=E7=A6=BB=E6=AC=A1=E6=97=A5=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E4=BB=B7=E4=B8=8E=E4=BF=A1=E5=8F=B7=E6=97=A5=E8=B5=84?= =?UTF-8?q?=E9=87=91=E9=A2=84=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/fidc-core/src/platform_expr_strategy.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/crates/fidc-core/src/platform_expr_strategy.rs b/crates/fidc-core/src/platform_expr_strategy.rs index f2704cf..f1dc89c 100644 --- a/crates/fidc-core/src/platform_expr_strategy.rs +++ b/crates/fidc-core/src/platform_expr_strategy.rs @@ -1329,6 +1329,19 @@ impl PlatformExprStrategy { self.marked_total_value_for_portfolio(ctx, ctx.portfolio, date) } + fn signal_visible_total_value( + &self, + ctx: &StrategyContext<'_>, + date: NaiveDate, + defer_execution: bool, + ) -> f64 { + if defer_execution { + ctx.portfolio.total_value() + } else { + self.marked_total_value(ctx, date) + } + } + fn round_lot_quantity( &self, quantity: u32, @@ -8494,7 +8507,8 @@ impl Strategy for PlatformExprStrategy { } else { 0.0 }; - let marked_total_value = self.marked_total_value(ctx, projection_date); + let marked_total_value = + self.signal_visible_total_value(ctx, projection_date, defer_execution_risk); let mut aiquant_total_value = if marked_total_value.is_finite() && marked_total_value > 0.0 { marked_total_value @@ -12131,6 +12145,8 @@ mod tests { let marked = strategy.marked_total_value(&ctx, date); assert!((marked - 1_250.0).abs() < 1e-6, "{marked}"); + let deferred_total = strategy.signal_visible_total_value(&ctx, date, true); + assert!((deferred_total - 1_100.0).abs() < 1e-6, "{deferred_total}"); } #[test]