修复日线盘中调度按分钟行情撮合

This commit is contained in:
boris
2026-09-07 01:29:18 +08:00
parent 54ccfe7e0a
commit f1a6a2695d
+13 -7
View File
@@ -780,7 +780,7 @@ where
return execution_price; return execution_price;
} }
} }
if self.execution_price_field == PriceField::Last { if self.matching_type_uses_intraday_quotes() {
let start_cursor = self let start_cursor = self
.runtime_intraday_start_time .runtime_intraday_start_time
.get() .get()
@@ -1271,7 +1271,10 @@ where
OrderSide::Buy => quote.buy_price(), OrderSide::Buy => quote.buy_price(),
OrderSide::Sell => quote.sell_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 { if quote.last_price.is_finite() && quote.last_price > 0.0 {
Some(quote.last_price) Some(quote.last_price)
} else { } else {
@@ -7294,7 +7297,7 @@ where
let post_close_window = self.post_close_execution_window(date); let post_close_window = self.post_close_execution_window(date);
let use_intraday_quotes = post_close_window.is_some() let use_intraday_quotes = post_close_window.is_some()
|| algo_request.is_some() || algo_request.is_some()
|| self.execution_price_field == PriceField::Last; || self.matching_type_uses_intraday_quotes();
if !use_intraday_quotes { if !use_intraday_quotes {
return None; return None;
} }
@@ -7316,7 +7319,7 @@ where
}); });
let end_cursor = if end_cursor.is_none() let end_cursor = if end_cursor.is_none()
&& matching_type == MatchingType::CurrentBarClose && matching_type == MatchingType::CurrentBarClose
&& self.execution_price_field == PriceField::Last && self.matching_type_uses_intraday_quotes()
{ {
start_cursor start_cursor
} else { } else {
@@ -7802,7 +7805,8 @@ where
| MatchingType::MinuteBestCounterparty | MatchingType::MinuteBestCounterparty
| MatchingType::Vwap | MatchingType::Vwap
| MatchingType::Twap | MatchingType::Twap
) ) || (self.matching_type == MatchingType::CurrentBarClose
&& self.intraday_execution_start_time.is_some())
} }
fn quote_quantity_limited(&self, matching_type: MatchingType) -> bool { fn quote_quantity_limited(&self, matching_type: MatchingType) -> bool {
@@ -9086,8 +9090,9 @@ mod tests {
let broker = BrokerSimulator::new_with_execution_price( let broker = BrokerSimulator::new_with_execution_price(
ChinaAShareCostModel::default(), ChinaAShareCostModel::default(),
ChinaEquityRuleHooks, 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_intraday_execution_start_time(date.and_hms_opt(9, 33, 0).unwrap().time());
let mut snapshot = limit_test_snapshot(); let mut snapshot = limit_test_snapshot();
snapshot.last_price = 9.0; snapshot.last_price = 9.0;
@@ -11114,8 +11119,9 @@ mod tests {
let broker = BrokerSimulator::new_with_execution_price( let broker = BrokerSimulator::new_with_execution_price(
ChinaAShareCostModel::default(), ChinaAShareCostModel::default(),
ChinaEquityRuleHooks, 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_intraday_execution_start_time(date.and_hms_opt(9, 33, 0).unwrap().time())
.with_slippage_model(SlippageModel::PriceRatio(0.002)) .with_slippage_model(SlippageModel::PriceRatio(0.002))
.with_strict_value_budget(true) .with_strict_value_budget(true)