nautechsystems/nautilus_trader · error

Unsupported order type: {order_type:?}

Error message

Unsupported order type: {order_type:?}

What it means

The Bybit adapter only maps a subset of NautilusTrader OrderType values to Bybit order types. Market, Limit, StopMarket/MarketIfTouched, and StopLimit/LimitIfTouched are supported; any other order type (e.g. trailing stop variants) hits the catch-all arm and bails via anyhow before building the request.

Source

Thrown at crates/adapters/bybit/src/http/client.rs:2532

        bbo_level: Option<String>,
        smp_type: Option<BybitOrderSmpType>,
        native_tp_sl: Option<&BybitNativeTpSlParams>,
    ) -> anyhow::Result<OrderStatusReport> {
        let instrument = self.instrument_from_cache(&instrument_id.symbol)?;
        let bybit_symbol = BybitSymbol::new(instrument_id.symbol.as_str())?;

        let bybit_side = match order_side {
            OrderSide::Buy => BybitOrderSide::Buy,
            OrderSide::Sell => BybitOrderSide::Sell,
        };

        // For stop/conditional orders, Bybit uses Market/Limit with trigger parameters
        let (bybit_order_type, is_stop_order) = match order_type {
            OrderType::Market => (BybitOrderType::Market, false),
            OrderType::Limit => (BybitOrderType::Limit, false),
            OrderType::StopMarket | OrderType::MarketIfTouched => (BybitOrderType::Market, true),
            OrderType::StopLimit | OrderType::LimitIfTouched => (BybitOrderType::Limit, true),
            _ => anyhow::bail!("Unsupported order type: {order_type:?}"),
        };

        let bybit_tif = map_time_in_force(bybit_order_type, time_in_force, post_only)
            .map_err(|tif| anyhow::anyhow!("Unsupported time in force: {tif:?}"))?;
        let market_unit = spot_market_unit(product_type, bybit_order_type, is_quote_quantity);
        let trigger_dir = trigger_direction(order_type, order_side, is_stop_order);

        let mut order_entry = BybitBatchPlaceOrderEntryBuilder::default();
        order_entry.symbol(bybit_symbol.raw_symbol().to_string());
        order_entry.side(bybit_side);
        order_entry.order_type(bybit_order_type);
        order_entry.qty(quantity.to_string());
        order_entry.time_in_force(bybit_tif);
        order_entry.order_link_id(client_order_id.to_string());
        order_entry.market_unit(market_unit);
        order_entry.trigger_direction(trigger_dir);

        if bbo_side_type.is_none()

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Check the order type before submitting and convert unsupported types into supported equivalents (e.g. implement trailing behavior client-side with trigger orders)
  2. Filter or guard orders in the strategy so only supported OrderType values are routed to the Bybit adapter
  3. Extend the match in client.rs to map the needed OrderType to a Bybit order type if the venue supports it

Example fix

// before
match order_type { ... _ => anyhow::bail!("Unsupported order type: {order_type:?}") }
// after
match order_type {
    OrderType::TrailingStopMarket => (BybitOrderType::Market, true), // map to trigger market
    ... 
}
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED: &[OrderType] = &[OrderType::Market, OrderType::Limit, OrderType::StopMarket, OrderType::MarketIfTouched, OrderType::StopLimit, OrderType::LimitIfTouched];
fn is_supported(t: &OrderType) -> bool { SUPPORTED.contains(t) }
if !is_supported(&order.order_type()) { return Err(anyhow!("order type {:?} not routable to Bybit", order.order_type())); }

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)
}

Prevention

When it happens

Trigger: Calling the Bybit order submission path (submit_order on the Bybit execution client) with an OrderType other than Market, Limit, StopMarket, MarketIfTouched, StopLimit, or LimitIfTouched.

Common situations: Routing strategy orders to Bybit that use order types the adapter has not implemented (e.g. trailing-stop order types); a generic strategy that emits multiple order types being pointed at a Bybit venue without type filtering.

Related errors


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