From 6c7f7130cf564526ff67023e10af6583519c51bc Mon Sep 17 00:00:00 2001 From: boris Date: Wed, 17 Jun 2026 19:35:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B9=B3=E5=8F=B0=E7=AD=96?= =?UTF-8?q?=E7=95=A5=E9=87=91=E9=A2=9D=E4=B9=B0=E5=85=A5=E9=A2=84=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fidc-core/src/platform_expr_strategy.rs | 66 ++++++------------- 1 file changed, 21 insertions(+), 45 deletions(-) diff --git a/crates/fidc-core/src/platform_expr_strategy.rs b/crates/fidc-core/src/platform_expr_strategy.rs index bef979a..f0ea7cb 100644 --- a/crates/fidc-core/src/platform_expr_strategy.rs +++ b/crates/fidc-core/src/platform_expr_strategy.rs @@ -6876,19 +6876,11 @@ 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: "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(), - }); - } + order_intents.push(OrderIntent::Value { + symbol: symbol.clone(), + value: buy_cash, + reason: "daily_top_up_buy".to_string(), + }); } if filled_qty > 0 { let spent = (cash_before_buy - projected.cash()).max(0.0); @@ -7005,19 +6997,11 @@ 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(), - }); - } + 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()); @@ -7073,19 +7057,11 @@ 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(), - }); - } + 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()); @@ -14233,11 +14209,11 @@ mod tests { assert!( decision.order_intents.iter().any(|intent| matches!( intent, - OrderIntent::Shares { + OrderIntent::Value { symbol, - quantity, + value, reason, - } if symbol == "000003.SZ" && *quantity > 0 && reason == "daily_top_up_buy" + } if symbol == "000003.SZ" && *value > 0.0 && reason == "daily_top_up_buy" )), "{:?}", decision.order_intents @@ -14867,13 +14843,13 @@ mod tests { assert!( decision.order_intents.iter().any(|intent| matches!( intent, - OrderIntent::Shares { + OrderIntent::Value { symbol, - quantity, + value, reason, } if symbol == "000002.SZ" && reason == "periodic_rebalance_buy" - && *quantity == 900 + && (*value - 10_000.0).abs() < 1e-6 )), "{:?}", decision.order_intents