调整回测撮合为分钟线执行价语义
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user