From cad8877b7a5e9b1943e8fa9baa08b40c9fd8c4dc Mon Sep 17 00:00:00 2001 From: boris Date: Wed, 1 Jul 2026 15:00:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3AiQuant=E7=AD=89=E6=9D=83?= =?UTF-8?q?=E8=B0=83=E4=BB=93=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/engine.rs | 6 +--- .../fidc-core/src/platform_expr_strategy.rs | 16 ++++------ crates/fidc-core/tests/corporate_actions.rs | 30 ++++++++++++------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/crates/fidc-core/src/engine.rs b/crates/fidc-core/src/engine.rs index 8b310dd..62e2c5f 100644 --- a/crates/fidc-core/src/engine.rs +++ b/crates/fidc-core/src/engine.rs @@ -2884,11 +2884,7 @@ where }); let note = format!( "cash_dividend_receivable {} share_cash={:.6} quantity={} payable_date={} cash={:.2}", - action.symbol, - action.share_cash, - quantity_after, - payable_date, - cash_delta + action.symbol, action.share_cash, quantity_after, payable_date, cash_delta ); notes.push(note.clone()); report.account_events.push(AccountEvent { diff --git a/crates/fidc-core/src/platform_expr_strategy.rs b/crates/fidc-core/src/platform_expr_strategy.rs index 9629164..bef9713 100644 --- a/crates/fidc-core/src/platform_expr_strategy.rs +++ b/crates/fidc-core/src/platform_expr_strategy.rs @@ -7967,14 +7967,8 @@ impl Strategy for PlatformExprStrategy { slot_working_symbols.remove(symbol); } - if !self.config.aiquant_transaction_cost { - aiquant_available_cash = projected.cash(); - } - let fixed_buy_cash = if self.config.aiquant_transaction_cost { - aiquant_available_cash * trading_ratio / selection_limit as f64 - } else { - aiquant_total_value * trading_ratio / selection_limit as f64 - }; + aiquant_available_cash = projected.cash(); + let fixed_buy_cash = aiquant_total_value * trading_ratio / selection_limit as f64; let target_budget = aiquant_total_value * trading_ratio; let mut rebalance_working_symbols = slot_working_symbols.clone(); if self.config.release_slot_on_exit_signal { @@ -18398,7 +18392,7 @@ mod tests { } #[test] - fn platform_aiquant_periodic_rebalance_uses_cash_divided_by_top_n_buy_budget() { + fn platform_aiquant_periodic_rebalance_uses_total_value_equal_weight_buy_budget() { let prev_date = d(2025, 5, 13); let date = d(2025, 5, 14); let retained_symbols = (1..=17) @@ -18597,7 +18591,7 @@ mod tests { assert!( decision.order_intents.iter().all(|intent| match intent { OrderIntent::Value { value, reason, .. } if reason == "periodic_rebalance_buy" => - (*value - 6_500.0).abs() < 1e-6, + (*value - 126_500.0).abs() < 1e-6, _ => true, }), "{:?}", @@ -18755,7 +18749,7 @@ mod tests { reason, } if symbol == "000002.SZ" && reason == "periodic_rebalance_buy" - && (*value - 5_000.0).abs() < 1e-6 + && (*value - 10_000.0).abs() < 1e-6 )), "{:?}", decision.order_intents diff --git a/crates/fidc-core/tests/corporate_actions.rs b/crates/fidc-core/tests/corporate_actions.rs index 1aa9fe7..7ede34e 100644 --- a/crates/fidc-core/tests/corporate_actions.rs +++ b/crates/fidc-core/tests/corporate_actions.rs @@ -410,8 +410,14 @@ fn engine_settles_same_day_dividend_after_split_for_aiquant_semantics() { delisted_at: None, status: "active".to_string(), }], - vec![stock_market_snapshot(buy_date), stock_market_snapshot(ex_date)], - vec![stock_factor_snapshot(buy_date), stock_factor_snapshot(ex_date)], + vec![ + stock_market_snapshot(buy_date), + stock_market_snapshot(ex_date), + ], + vec![ + stock_factor_snapshot(buy_date), + stock_factor_snapshot(ex_date), + ], vec![stock_candidate(buy_date), stock_candidate(ex_date)], vec![benchmark_snapshot(buy_date), benchmark_snapshot(ex_date)], vec![CorporateAction { @@ -469,12 +475,16 @@ fn engine_settles_same_day_dividend_after_split_for_aiquant_semantics() { assert_eq!(reinvest_fill.quantity, 100); assert!((reinvest_fill.price - ((10.0 - 1.05) / 1.2)).abs() < 1e-9); - assert!(result - .position_events - .iter() - .any(|event| event.reason == "stock_split 1.200000" && event.quantity_after == 1_200)); - assert!(result - .account_events - .iter() - .any(|event| event.note.contains("cash_receivable_reinvested"))); + assert!( + result + .position_events + .iter() + .any(|event| event.reason == "stock_split 1.200000" && event.quantity_after == 1_200) + ); + assert!( + result + .account_events + .iter() + .any(|event| event.note.contains("cash_receivable_reinvested")) + ); }