Skip to main content

generate_reconciliation_order_events

Function generate_reconciliation_order_events 

Source
pub fn generate_reconciliation_order_events(
    order: &OrderAny,
    report: &OrderStatusReport,
    instrument: Option<&InstrumentAny>,
    ts_now: UnixNanos,
) -> Vec<OrderEventAny>
Expand description

Generates reconciliation events for a live order status report.

Events are produced in venue-temporal order: any missing Accepted event first, then an OrderUpdated if the venue snapshot shows a confirmed quantity/price amendment, then any status/fill events from reconcile_order_report. Emitting the amendment before the fill matters when the venue increased the total quantity and reported a fill that would otherwise close the order under the stale local quantity. The Updated step is suppressed for pending venue states so a still-unconfirmed amend cannot mutate the local projection ahead of venue confirmation.