From 0ac07ac0f14e62482ce1aafa7f54c21596621b90 Mon Sep 17 00:00:00 2001 From: boris Date: Sat, 19 Sep 2026 21:56:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E6=8C=81=E6=9C=AA=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E7=B2=BE=E5=BA=A6=E7=8A=B6=E6=80=81=E7=9A=84=E6=97=A7=E5=90=88?= =?UTF-8?q?=E5=90=8C=E5=BA=8F=E5=88=97=E5=8C=96=E8=BA=AB=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/fidc-core/src/stock_pool_execution.rs | 1 + crates/fidc-core/src/stock_pool_execution_tests.rs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/crates/fidc-core/src/stock_pool_execution.rs b/crates/fidc-core/src/stock_pool_execution.rs index bf5018f..0447d03 100644 --- a/crates/fidc-core/src/stock_pool_execution.rs +++ b/crates/fidc-core/src/stock_pool_execution.rs @@ -485,6 +485,7 @@ pub struct StockPoolDecisionConstraints { pub frozen_positions: BTreeMap, pub prior_target_weights: BTreeMap, /// Sizing ratios from prior plans; integer bps are display/legacy only. + #[serde(skip_serializing_if = "BTreeMap::is_empty")] pub prior_target_weight_ratios: BTreeMap, pub pending_entry_symbols: BTreeSet, pub next_day_outside_exit_symbols: BTreeSet, diff --git a/crates/fidc-core/src/stock_pool_execution_tests.rs b/crates/fidc-core/src/stock_pool_execution_tests.rs index d43694e..35cc534 100644 --- a/crates/fidc-core/src/stock_pool_execution_tests.rs +++ b/crates/fidc-core/src/stock_pool_execution_tests.rs @@ -1,5 +1,11 @@ use super::*; +#[test] +fn legacy_constraints_do_not_gain_an_empty_precision_field() { + let value = serde_json::to_value(StockPoolDecisionConstraints::default()).unwrap(); + assert!(value.get("prior_target_weight_ratios").is_none()); +} + #[test] fn equal_thirty_seats_use_full_precision_at_a_board_lot_boundary() { for (equity, price, executable, held) in [("999377.147617", "3.07", "3.070307", 2000), ("995624.8819", "6.42", "6.420642", 900)] {