修复多时点调度与触发价撮合

This commit is contained in:
boris
2026-08-28 11:44:31 +08:00
parent 5bbb093f47
commit 59be3b5dd5
3 changed files with 225 additions and 32 deletions
+20
View File
@@ -529,6 +529,18 @@ impl<C, R> BrokerSimulator<C, R> {
self
}
/// Override the price source after selecting the order-matching contract.
///
/// A scheduled daily `current_bar_close` order uses the latest completed
/// intraday quote at its actual trigger time, while an unscheduled daily
/// order uses the official daily close. Keeping this as an explicit final
/// builder step prevents `with_matching_type` from silently erasing the
/// resolved runner contract.
pub fn with_execution_price_field(mut self, execution_price_field: PriceField) -> Self {
self.execution_price_field = execution_price_field;
self
}
pub fn with_slippage_model(mut self, slippage_model: SlippageModel) -> Self {
self.slippage_model = slippage_model;
self
@@ -7073,6 +7085,14 @@ where
.or(runtime_end_time)
.map(|end_time| date.and_time(end_time))
});
let end_cursor = if end_cursor.is_none()
&& matching_type == MatchingType::CurrentBarClose
&& self.execution_price_field == PriceField::Last
{
start_cursor
} else {
end_cursor
};
let quotes = data.execution_quotes_on(date, symbol);
if let Some(fill) = self.select_execution_fill_with_ledger(