nautechsystems/nautilus_trader · error

Trigger/conditional orders ({order_type:?}) are not supporte

Error message

Trigger/conditional orders ({order_type:?}) are not supported for OKX spreads

What it means

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.

Source

Thrown at crates/adapters/okx/src/execution.rs:644

                .await
                .context("failed to request OKX account state")?;
            emitter.send_account_state(account_state);
            Ok(())
        });
    }

    fn is_conditional_order(&self, order_type: OrderType) -> bool {
        OKX_CONDITIONAL_ORDER_TYPES.contains(&order_type)
    }

    fn submit_order_route(
        &self,
        instrument_id: InstrumentId,
        order_type: OrderType,
    ) -> anyhow::Result<OrderCommandRoute> {
        if self.is_conditional_order(order_type) {
            if is_spread_instrument(instrument_id) {
                anyhow::bail!(
                    "Trigger/conditional orders ({order_type:?}) are not supported for OKX spreads"
                );
            }

            let inst_type = okx_instrument_type_from_symbol(instrument_id.symbol.as_str());
            if inst_type == OKXInstrumentType::Option {
                anyhow::bail!(
                    "Trigger/conditional orders ({order_type:?}) are not supported for OKX options"
                );
            }

            return Ok(OrderCommandRoute::AlgoHttp);
        }

        if is_spread_instrument(instrument_id) {
            Ok(OrderCommandRoute::SpreadHttp)
        } else {
            Ok(OrderCommandRoute::RegularWs)

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Use plain (non-conditional) `LIMIT` or `MARKET` orders for OKX spread instruments.
  2. Implement stop protection in strategy code (poll marks and submit market orders) instead of venue-side trigger orders.
  3. Trade a non-spread instrument (outright futures/perp/option) if venue-side conditional orders are required.
Defensive patterns

Strategy: validation

Validate before calling

if is_conditional_order(order_type) && is_spread_instrument(instrument_id) {
    return Err(anyhow::anyhow!("Conditional orders unsupported for OKX spreads"));
}
client.submit_order(order)?;

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/81b732c2c07de78d. Report an issue: GitHub.