Trading Integration
Integrate trading workflows with explicit order lifecycle states and reconciliation hooks.
#Purpose
Explains trading request flow, order status progression, and close-loop reconciliation expectations.
#Integration prerequisites
- Asset normalization and account entitlement checks are implemented.
- Quote validity and slippage policy are defined in client logic.
- Order status polling and event ingestion are both available.
#Request and response patterns
- Order create request returns order ID and initial accepted/rejected state.
- Status requests expose current fill, cancellation, and terminal state context.
- Execution and settlement-related events provide asynchronous updates.
#Lifecycle and state model
- Submit validated order intent with idempotency key and client reference.
- Observe transition through pending, open, partially_filled, filled, canceled, or failed.
- Reconcile final fill quantities, fees, and timestamps against internal ledger.
#Error and failure taxonomy
- Validation failure for unsupported pair or order parameter.
- Execution failure due to liquidity or market movement constraints.
- Post-trade reconciliation mismatch due to delayed event consumption.
#Retry and idempotency guidance
Retry submission only when no accepted order ID exists for the same logical trade intent.
#Observability and debugging entry points
- Order acceptance rate, rejection reason distribution, and time-to-final-state.
- Delta between API polled state and event-consumed state.
- Reconciliation hooks that compare fill and fee totals by order ID.