fix(stock-pool): separate cumulative condition facts from quote capacity
This commit is contained in:
@@ -746,6 +746,15 @@ where
|
||||
if self.execution_quote_loader.is_none() {
|
||||
return Ok(());
|
||||
}
|
||||
let cumulative_conditions = decision.order_intents.iter().any(|intent| {
|
||||
matches!(intent.unwrapped(), OrderIntent::StockPool { contract }
|
||||
if crate::stock_pool_quote_facts::requires_session_totals(&contract.rule))
|
||||
});
|
||||
if cumulative_conditions && (self.broker.execution_price_field() != PriceField::Close
|
||||
|| start_time.is_some() || self.broker.intraday_execution_start_time().is_some()) {
|
||||
let mut symbols = execution_quote_symbols_for_decision(decision, portfolio, open_orders);
|
||||
self.load_missing_execution_quotes(execution_date, None, None, &mut symbols)?;
|
||||
}
|
||||
let submission_time = start_time.or_else(|| self.broker.intraday_execution_start_time());
|
||||
let post_close_window = self.broker.post_close_execution_quote_window_for_order(
|
||||
execution_date,
|
||||
@@ -5796,7 +5805,7 @@ mod tests {
|
||||
fn physical_on_day_rules_keep_each_actual_submission_time() {
|
||||
let date = d(2026, 7, 6);
|
||||
let quotes = vec![
|
||||
IntradayExecutionQuote {
|
||||
IntradayExecutionQuote { observation_kind: Default::default(),
|
||||
date,
|
||||
symbol: SYMBOL.to_string(),
|
||||
timestamp: date.and_hms_opt(10, 18, 0).expect("morning timestamp"),
|
||||
@@ -5809,7 +5818,7 @@ mod tests {
|
||||
amount_delta: 110_000.0,
|
||||
trading_phase: Some("continuous_auction".to_string()),
|
||||
},
|
||||
IntradayExecutionQuote {
|
||||
IntradayExecutionQuote { observation_kind: Default::default(),
|
||||
date,
|
||||
symbol: SYMBOL.to_string(),
|
||||
timestamp: date.and_hms_opt(10, 19, 0).expect("future timestamp"),
|
||||
@@ -5822,7 +5831,7 @@ mod tests {
|
||||
amount_delta: 990_000.0,
|
||||
trading_phase: Some("continuous_auction".to_string()),
|
||||
},
|
||||
IntradayExecutionQuote {
|
||||
IntradayExecutionQuote { observation_kind: Default::default(),
|
||||
date,
|
||||
symbol: SYMBOL.to_string(),
|
||||
timestamp: date.and_hms_opt(15, 10, 0).expect("post-close timestamp"),
|
||||
@@ -5950,7 +5959,7 @@ mod tests {
|
||||
let closing_only = matches!(scenario,2|3);
|
||||
let delayed = scenario == 4;
|
||||
let date = if closing_only { d(2026, 7, 6) } else if delayed { d(2026, 6, 2) } else { d(2026, 6, 1) };
|
||||
let quote = |hour, minute, price| IntradayExecutionQuote {
|
||||
let quote = |hour, minute, price| IntradayExecutionQuote { observation_kind: Default::default(),
|
||||
date, symbol: SYMBOL.into(), timestamp: date.and_hms_opt(hour, minute, 0).unwrap(),
|
||||
last_price: price, bid1: price, ask1: price, bid1_volume: 10_000, ask1_volume: 10_000,
|
||||
volume_delta: 10_000, amount_delta: price * 10_000.0, trading_phase: None,
|
||||
@@ -6073,7 +6082,7 @@ mod tests {
|
||||
Ok(request
|
||||
.symbols
|
||||
.into_iter()
|
||||
.map(|symbol| IntradayExecutionQuote {
|
||||
.map(|symbol| IntradayExecutionQuote { observation_kind: Default::default(),
|
||||
date: request.date,
|
||||
symbol,
|
||||
timestamp: request.date.and_hms_opt(15, 5, 0).expect("valid timestamp"),
|
||||
|
||||
Reference in New Issue
Block a user