From f1a6a2695dda310f141d61aeefa1bfb77fca7564 Mon Sep 17 00:00:00 2001 From: boris Date: Mon, 7 Sep 2026 01:29:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A5=E7=BA=BF=E7=9B=98?= =?UTF-8?q?=E4=B8=AD=E8=B0=83=E5=BA=A6=E6=8C=89=E5=88=86=E9=92=9F=E8=A1=8C?= =?UTF-8?q?=E6=83=85=E6=92=AE=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/fidc-core/src/broker.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/crates/fidc-core/src/broker.rs b/crates/fidc-core/src/broker.rs index d955513..d484ad4 100644 --- a/crates/fidc-core/src/broker.rs +++ b/crates/fidc-core/src/broker.rs @@ -780,7 +780,7 @@ where return execution_price; } } - if self.execution_price_field == PriceField::Last { + if self.matching_type_uses_intraday_quotes() { let start_cursor = self .runtime_intraday_start_time .get() @@ -1271,7 +1271,10 @@ where OrderSide::Buy => quote.buy_price(), OrderSide::Sell => quote.sell_price(), }, - MatchingType::MinuteLast | MatchingType::Vwap | MatchingType::Twap => { + MatchingType::CurrentBarClose + | MatchingType::MinuteLast + | MatchingType::Vwap + | MatchingType::Twap => { if quote.last_price.is_finite() && quote.last_price > 0.0 { Some(quote.last_price) } else { @@ -7294,7 +7297,7 @@ where let post_close_window = self.post_close_execution_window(date); let use_intraday_quotes = post_close_window.is_some() || algo_request.is_some() - || self.execution_price_field == PriceField::Last; + || self.matching_type_uses_intraday_quotes(); if !use_intraday_quotes { return None; } @@ -7316,7 +7319,7 @@ where }); let end_cursor = if end_cursor.is_none() && matching_type == MatchingType::CurrentBarClose - && self.execution_price_field == PriceField::Last + && self.matching_type_uses_intraday_quotes() { start_cursor } else { @@ -7802,7 +7805,8 @@ where | MatchingType::MinuteBestCounterparty | MatchingType::Vwap | MatchingType::Twap - ) + ) || (self.matching_type == MatchingType::CurrentBarClose + && self.intraday_execution_start_time.is_some()) } fn quote_quantity_limited(&self, matching_type: MatchingType) -> bool { @@ -9086,8 +9090,9 @@ mod tests { let broker = BrokerSimulator::new_with_execution_price( ChinaAShareCostModel::default(), ChinaEquityRuleHooks, - PriceField::Last, + PriceField::Close, ) + .with_matching_type(MatchingType::CurrentBarClose) .with_intraday_execution_start_time(date.and_hms_opt(9, 33, 0).unwrap().time()); let mut snapshot = limit_test_snapshot(); snapshot.last_price = 9.0; @@ -11114,8 +11119,9 @@ mod tests { let broker = BrokerSimulator::new_with_execution_price( ChinaAShareCostModel::default(), ChinaEquityRuleHooks, - PriceField::Last, + PriceField::Close, ) + .with_matching_type(MatchingType::CurrentBarClose) .with_intraday_execution_start_time(date.and_hms_opt(9, 33, 0).unwrap().time()) .with_slippage_model(SlippageModel::PriceRatio(0.002)) .with_strict_value_budget(true)