From df949ab8ee8d0e106a20a59fc375a7cb732418a9 Mon Sep 17 00:00:00 2001 From: boris Date: Tue, 16 Jun 2026 05:45:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3AiQuant=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E4=B9=B0=E5=85=A5=E6=95=B0=E9=87=8F=E8=AF=AD=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fidc-core/src/platform_expr_strategy.rs | 56 ++++++++++++++----- 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/crates/fidc-core/src/platform_expr_strategy.rs b/crates/fidc-core/src/platform_expr_strategy.rs index 1ab3d24..343ac24 100644 --- a/crates/fidc-core/src/platform_expr_strategy.rs +++ b/crates/fidc-core/src/platform_expr_strategy.rs @@ -6614,11 +6614,6 @@ impl Strategy for PlatformExprStrategy { if buy_cash <= 0.0 { break; } - order_intents.push(OrderIntent::Value { - symbol: symbol.clone(), - value: buy_cash, - reason: "daily_top_up_buy".to_string(), - }); intraday_attempted_buys.insert(symbol.clone()); attempted_any = true; let cash_before_buy = projected.cash(); @@ -6630,6 +6625,21 @@ impl Strategy for PlatformExprStrategy { buy_cash, &mut projected_execution_state, ); + if filled_qty > 0 { + if self.config.aiquant_transaction_cost { + order_intents.push(OrderIntent::Shares { + symbol: symbol.clone(), + quantity: filled_qty as i32, + reason: "daily_top_up_buy".to_string(), + }); + } else { + order_intents.push(OrderIntent::Value { + symbol: symbol.clone(), + value: buy_cash, + reason: "daily_top_up_buy".to_string(), + }); + } + } let spent = if filled_qty > 0 { (cash_before_buy - projected.cash()).max(0.0) } else { @@ -6738,11 +6748,6 @@ impl Strategy for PlatformExprStrategy { if !self.stock_passes_expr(ctx, &day, &decision_stock)? { continue; } - order_intents.push(OrderIntent::Value { - symbol: symbol.clone(), - value: buy_cash, - reason: "periodic_rebalance_buy".to_string(), - }); let cash_before_buy = projected.cash(); let filled_qty = self.project_order_value( ctx, @@ -6753,6 +6758,19 @@ impl Strategy for PlatformExprStrategy { &mut projected_execution_state, ); if filled_qty > 0 { + if self.config.aiquant_transaction_cost { + order_intents.push(OrderIntent::Shares { + symbol: symbol.clone(), + quantity: filled_qty as i32, + reason: "periodic_rebalance_buy".to_string(), + }); + } else { + order_intents.push(OrderIntent::Value { + symbol: symbol.clone(), + value: buy_cash, + reason: "periodic_rebalance_buy".to_string(), + }); + } let spent = (cash_before_buy - projected.cash()).max(0.0); aiquant_available_cash = (aiquant_available_cash - spent).max(0.0); intraday_attempted_buys.insert(symbol.clone()); @@ -6798,11 +6816,6 @@ impl Strategy for PlatformExprStrategy { if !self.stock_passes_expr(ctx, &day, &decision_stock)? { continue; } - order_intents.push(OrderIntent::Value { - symbol: symbol.clone(), - value: buy_cash, - reason: "periodic_rebalance_buy".to_string(), - }); let cash_before_buy = projected.cash(); let filled_qty = self.project_order_value( ctx, @@ -6813,6 +6826,19 @@ impl Strategy for PlatformExprStrategy { &mut projected_execution_state, ); if filled_qty > 0 { + if self.config.aiquant_transaction_cost { + order_intents.push(OrderIntent::Shares { + symbol: symbol.clone(), + quantity: filled_qty as i32, + reason: "periodic_rebalance_buy".to_string(), + }); + } else { + order_intents.push(OrderIntent::Value { + symbol: symbol.clone(), + value: buy_cash, + reason: "periodic_rebalance_buy".to_string(), + }); + } let spent = (cash_before_buy - projected.cash()).max(0.0); aiquant_available_cash = (aiquant_available_cash - spent).max(0.0); rebalance_working_symbols.insert(symbol.clone());