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)] {