修正AiQuant兼容持仓成本止损口径

This commit is contained in:
boris
2026-07-10 10:35:58 +08:00
parent f7d0889bbc
commit e396c895dc
3 changed files with 255 additions and 9 deletions
@@ -3349,7 +3349,7 @@ fn rebalance_optimizer_skips_unfunded_buy_when_existing_position_cannot_sell() {
}
#[test]
fn rebalance_uses_prev_close_for_open_auction_valuation() {
fn rebalance_uses_day_open_for_open_auction_valuation() {
let prev_date = NaiveDate::from_ymd_opt(2024, 1, 9).unwrap();
let date = NaiveDate::from_ymd_opt(2024, 1, 10).unwrap();
let data = DataSet::from_components(
@@ -3515,7 +3515,7 @@ fn rebalance_uses_prev_close_for_open_auction_valuation() {
let held = portfolio.position("000001.SZ").expect("held position");
let target = portfolio.position("000002.SZ").expect("target position");
assert_eq!(held.quantity, 500);
assert_eq!(target.quantity, 400);
assert_eq!(target.quantity, 900);
assert_eq!(report.fill_events.len(), 2);
assert!(
report
@@ -3531,7 +3531,7 @@ fn rebalance_uses_prev_close_for_open_auction_valuation() {
.iter()
.any(|fill| fill.symbol == "000002.SZ"
&& fill.side == fidc_core::OrderSide::Buy
&& fill.quantity == 400)
&& fill.quantity == 900)
);
}