Order Lifecycle And Reconciliation
IMC keeps order execution and exposure verification explicit.
Open Flow
- Read current mode context from
fundsor analyzer status. - Send
placeorder,placesmartorder,basketorder,splitorder,optionsorder, oroptionsmultiorderwith mode precondition fields. - Verify the broker order with
orderstatus.
Close Flow
- Send
closepositionwith the strategy name and mode precondition fields. - If the close response succeeds, read
positionsopenfor the same strategy, symbol, exchange, and product. - Treat
positionsopen.quantity = 0as zero-exposure proof. - Treat
closepositionreturningNO_STRATEGY_EXPOSUREas zero-exposure proof. - If neither proof is available, keep the local client state pending reconciliation rather than assuming the position is still open.
Why positionsopen Exists
positionsopen is not an order endpoint. It is a strategy-scoped reconciliation read. It answers one question: "does this strategy still have exposure for this symbol/product?"
Because it is read-only, it is mode-checked but does not create a protected operation lease.
Protected entries
Use protected-order lifecycle to place broker-managed TP/SL with entry. Protected book v2 supplies actual cumulative fill evidence; no exposure alone must not release margin or invent a fill/P&L. Strategy closes verify linked protection cancellation before closing; generated working/uncertain exits block unsafe closes. Protection failure does not automatically liquidate the entry.