status_reason is { code, message } on rejected, unconfirmed and needs_attention, and on a
canceled ioc order and its canceled legs. It is null otherwise. On rejected, unconfirmed and
needs_attention the order copies it from the first leg in the order’s status.
New codes can appear without a new version; treat one you do not recognize by the order’s
status.
venue_status carries the venue’s own state, and venue_order_id its order ID, for your
reconciliation. On a split order both are null. Each entry in legs has its own status,
status_reason, venue_status and venue_order_id, and the order’s status is worked out from all
of them:
- When every leg is final, the order is
filledif every leg filled. Otherwise it iscanceledif any leg filled or was canceled, thenexpired, thenrejected. - While any leg is working, the first that applies wins:
needs_attention,unconfirmed,cancel_requested(a leg waits on its venue to confirm a cancel),partially_filled(any shares filled),open,pending.
Typical paths
needs_attention can follow any working status and is left out of the diagram.
An ioc order never rests: it ends filled, or canceled with whatever filled first, 0 if
nothing matched, and status_reason.code IOC_REMAINDER_CANCELED.