{"record":{"id":"81b732c2c07de78d","repo":"nautechsystems/nautilus_trader","slug":"trigger-conditional-orders-order-type-are-no","errorCode":null,"errorMessage":"Trigger/conditional orders ({order_type:?}) are not supported for OKX spreads","messagePattern":"Trigger/conditional orders \\((.+?)\\) are not supported for OKX spreads","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/okx/src/execution.rs","lineNumber":644,"sourceCode":"                .await\n                .context(\"failed to request OKX account state\")?;\n            emitter.send_account_state(account_state);\n            Ok(())\n        });\n    }\n\n    fn is_conditional_order(&self, order_type: OrderType) -> bool {\n        OKX_CONDITIONAL_ORDER_TYPES.contains(&order_type)\n    }\n\n    fn submit_order_route(\n        &self,\n        instrument_id: InstrumentId,\n        order_type: OrderType,\n    ) -> anyhow::Result<OrderCommandRoute> {\n        if self.is_conditional_order(order_type) {\n            if is_spread_instrument(instrument_id) {\n                anyhow::bail!(\n                    \"Trigger/conditional orders ({order_type:?}) are not supported for OKX spreads\"\n                );\n            }\n\n            let inst_type = okx_instrument_type_from_symbol(instrument_id.symbol.as_str());\n            if inst_type == OKXInstrumentType::Option {\n                anyhow::bail!(\n                    \"Trigger/conditional orders ({order_type:?}) are not supported for OKX options\"\n                );\n            }\n\n            return Ok(OrderCommandRoute::AlgoHttp);\n        }\n\n        if is_spread_instrument(instrument_id) {\n            Ok(OrderCommandRoute::SpreadHttp)\n        } else {\n            Ok(OrderCommandRoute::RegularWs)","sourceCodeStart":626,"sourceCodeEnd":662,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/okx/src/execution.rs#L626-L662","documentation":"OKX spread instruments ( instruments in the SPRD family) cannot be traded with trigger/conditional (algo) orders: the adapter's `submit_order_route` rejects conditional order types for spreads before routing. The HTTP algo-order endpoint OKX exposes does not accept spread instruments, so `submit_order_route` bails instead of returning the `AlgoHttp` route.","triggerScenarios":"Calling `submit_order` (which delegates to `submit_order_route`) with a conditional order type (`is_conditional_order(order_type)` is true — e.g. `StopLimit`, `StopMarket`, `LimitIfTouched`, `MarketIfTouched`, trailing stops) where `instrument_id` is a spread instrument (`is_spread_instrument` returns true).","commonSituations":"Deploying a strategy with stop-loss/take-profit brackets onto an OKX spread (e.g. futures calendar spread); a generic execution algorithm that attaches conditional exit orders without checking instrument family.","solutions":["Use plain (non-conditional) `LIMIT` or `MARKET` orders for OKX spread instruments.","Implement stop protection in strategy code (poll marks and submit market orders) instead of venue-side trigger orders.","Trade a non-spread instrument (outright futures/perp/option) if venue-side conditional orders are required."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if is_conditional_order(order_type) && is_spread_instrument(instrument_id) {\n    return Err(anyhow::anyhow!(\"Conditional orders unsupported for OKX spreads\"));\n}\nclient.submit_order(order)?;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only attach stop/conditional orders to outright (non-spread) OKX instruments.","Implement stop-loss logic in strategy code for spreads.","Check `is_spread_instrument` before constructing algo orders."],"tags":["okx","spread","conditional-order","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}