nautechsystems/nautilus_trader · error

unsupported order type for Bybit: {order_type}

Error message

unsupported order type for Bybit: {order_type}

What it means

Raised by map_order_type when converting a Nautilus OrderType to a Bybit order type and the variant has no mapping. Market, Limit, StopMarket, MarketIfTouched, StopLimit and LimitIfTouched are supported; everything else is rejected.

Source

Thrown at crates/adapters/bybit/src/execution.rs:539

            return true;
        }
        !code.is_empty() && msg.contains(code)
    }

    fn is_low_margin_error<E: std::fmt::Display>(err: &E) -> bool {
        err.to_string()
            .contains("needs to be equal to or greater than")
    }

    fn map_order_type(order_type: OrderType) -> anyhow::Result<(BybitOrderType, bool)> {
        match order_type {
            OrderType::Market => Ok((BybitOrderType::Market, false)),
            OrderType::Limit => Ok((BybitOrderType::Limit, false)),
            OrderType::StopMarket | OrderType::MarketIfTouched => {
                Ok((BybitOrderType::Market, true))
            }
            OrderType::StopLimit | OrderType::LimitIfTouched => Ok((BybitOrderType::Limit, true)),
            _ => anyhow::bail!("unsupported order type for Bybit: {order_type}"),
        }
    }

    fn map_time_in_force(tif: TimeInForce, is_post_only: bool) -> BybitTimeInForce {
        if is_post_only {
            return BybitTimeInForce::PostOnly;
        }

        match tif {
            TimeInForce::Gtc => BybitTimeInForce::Gtc,
            TimeInForce::Ioc => BybitTimeInForce::Ioc,
            TimeInForce::Fok => BybitTimeInForce::Fok,
            _ => BybitTimeInForce::Gtc,
        }
    }

    fn validate_bbo_params(
        order: &OrderAny,

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Use only supported order types: Market, Limit, StopMarket, MarketIfTouched, StopLimit, LimitIfTouched
  2. Emulate unsupported types (e.g. trailing stops) client-side or with stop-market plus manual adjustment
  3. Check adapter release notes/changelog for added order-type support and upgrade the adapter

Example fix

// before
let order = order_factory.trailing_stop_market(...); // unsupported on Bybit adapter
// after
let order = order_factory.stop_market(...); // supported: maps to Market + trigger_flag
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED: &[OrderType] = &[
    OrderType::Market, OrderType::Limit, OrderType::StopMarket,
    OrderType::MarketIfTouched, OrderType::StopLimit, OrderType::LimitIfTouched,
];
assert!(SUPPORTED.contains(&order.order_type()), "order type unsupported on Bybit");

Type guard

fn is_bybit_supported_order_type(t: OrderType) -> bool {
    matches!(t, OrderType::Market | OrderType::Limit | OrderType::StopMarket
        | OrderType::MarketIfTouched | OrderType::StopLimit | OrderType::LimitIfTouched)
}

Try / catch

match exec_client.submit_order(order) {
    Err(e) if e.to_string().starts_with("unsupported order type for Bybit") => {
        // restructure the order (e.g. stop-market) or route to another venue
    }
    r => r?,
}

Prevention

When it happens

Trigger: Submitting (or modifying to) an order whose OrderType is not one of the supported variants — e.g. trailing-stop orders (TrailingStopMarket/TrailingStopLimit) or any newly added Nautilus order type not yet mapped in the adapter.

Common situations: Using trailing stops on Bybit through this adapter; strategy code written for another venue's richer order-type set; Nautilus version upgrade introducing new OrderType variants not yet handled by the Bybit adapter.

Related errors


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