保持未升级精度状态的旧合同序列化身份

This commit is contained in:
boris
2026-09-19 21:56:16 +08:00
parent 689f93f1f1
commit 2b8691473e
2 changed files with 7 additions and 0 deletions
@@ -485,6 +485,7 @@ pub struct StockPoolDecisionConstraints {
pub frozen_positions: BTreeMap<String, FrozenStockPoolPosition>,
pub prior_target_weights: BTreeMap<String, i32>,
/// Sizing ratios from prior plans; integer bps are display/legacy only.
#[serde(skip_serializing_if = "BTreeMap::is_empty")]
pub prior_target_weight_ratios: BTreeMap<String, Decimal>,
pub pending_entry_symbols: BTreeSet<String>,
pub next_day_outside_exit_symbols: BTreeSet<String>,
@@ -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)] {