Skip to main content

lookup_order_attribution

Function lookup_order_attribution 

pub fn lookup_order_attribution<S>(
    state: &PortfolioState,
    batch_cache: &HashMap<OrderId, (Option<Uuid>, Option<S>)>,
    correlation_to_strategy: &BTreeMap<Uuid, S>,
    order_id: &OrderId,
) -> (Option<Uuid>, Option<S>)
where S: Clone + for<'a> From<&'a str>,
Expand description

Resolve correlation/strategy attribution for an order lifecycle event.

Prefers the batch-local cache (populated by Ack processing) but skips non-informative (None, None) entries. Falls back to open_orders, then terminal_order_attribution, then the runtime correlation_to_strategy map.

Generic over the strategy-id type (String for live, Arc<str> for backtest). Shared between the live runner and the backtest engine (PARITY).