调整回测撮合为分钟线执行价语义

This commit is contained in:
boris
2026-06-26 17:03:48 +08:00
parent 380c34aa66
commit a131c761e5
8 changed files with 59 additions and 66 deletions
+6 -8
View File
@@ -1444,7 +1444,7 @@ where
let snapshot = self.data.market(date, &intent.symbol);
if matches!(
self.broker.matching_type(),
MatchingType::NextMinuteBestCounterparty | MatchingType::CounterpartyOffer
MatchingType::MinuteBestCounterparty
) {
let depth = self.data.order_book_depth_on(date, &intent.symbol);
if !depth.is_empty() {
@@ -1454,7 +1454,7 @@ where
let quotes = self.data.execution_quotes_on(date, &intent.symbol);
for quote in quotes {
let price = match self.broker.matching_type() {
MatchingType::NextMinuteBestOwn => match intent.side() {
MatchingType::MinuteBestOwn => match intent.side() {
OrderSide::Buy => {
if quote.bid1.is_finite() && quote.bid1 > 0.0 {
quote.bid1
@@ -1470,12 +1470,10 @@ where
}
}
},
MatchingType::NextMinuteBestCounterparty | MatchingType::CounterpartyOffer => {
match intent.side() {
OrderSide::Buy => quote.buy_price().unwrap_or(quote.last_price),
OrderSide::Sell => quote.sell_price().unwrap_or(quote.last_price),
}
}
MatchingType::MinuteBestCounterparty => match intent.side() {
OrderSide::Buy => quote.buy_price().unwrap_or(quote.last_price),
OrderSide::Sell => quote.sell_price().unwrap_or(quote.last_price),
},
_ => quote.last_price,
};
if let Some(snapshot) = snapshot {