nautechsystems/nautilus_trader · error · anyhow::Error

`bbo_side_type` and `bbo_level` are only supported for Bybit

Error message

`bbo_side_type` and `bbo_level` are only supported for Bybit linear and inverse products

What it means

Bybit's BBO (best-bid-or-offer) order trigger parameters are only defined for derivatives. validate_bbo_params rejects TP/SL params containing bbo_side_type/bbo_level when the instrument's product type is Spot or anything other than Linear/Inverse.

Source

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

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

    fn validate_bbo_params(
        order: &OrderAny,
        product_type: BybitProductType,
        tp_sl: &BybitTpSlParams,
    ) -> anyhow::Result<()> {
        if !tp_sl.has_bbo() {
            return Ok(());
        }

        anyhow::ensure!(
            matches!(
                product_type,
                BybitProductType::Linear | BybitProductType::Inverse
            ),
            "`bbo_side_type` and `bbo_level` are only supported for Bybit linear and inverse products"
        );

        let order_type = order.order_type();
        anyhow::ensure!(
            matches!(
                order_type,
                OrderType::Limit | OrderType::StopLimit | OrderType::LimitIfTouched
            ),
            "`bbo_side_type` and `bbo_level` are not supported for order type {order_type:?}"
        );

        Ok(())
    }

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Remove bbo_side_type/bbo_level for spot instruments
  2. Use the correct instrument with BybitProductType::Linear or Inverse when BBO behavior is required
  3. Check the product type of your instrument definition before attaching BBO params

Example fix

// before
validate_bbo_params(BybitProductType::Spot, &order, &tp_sl)?; // panics/bails
// after
validate_bbo_params(BybitProductType::Linear, &order, &tp_sl)?;
Defensive patterns

Strategy: validation

Validate before calling

if tp_sl.has_bbo() && !matches!(product_type, BybitProductType::Linear | BybitProductType::Inverse) {
    // strip BBO params or switch instruments before submission
}

Try / catch

if let Err(e) = validate_bbo_params(product_type, &order, &tp_sl) {
    tracing::warn!("BBO params rejected: {e}; resubmitting without BBO");
    tp_sl.bbo_side_type = None;
    tp_sl.bbo_level = None;
}

Prevention

When it happens

Trigger: Submitting or validating an order with bbo_side_type+bbo_level set while product_type is Spot (or Option, etc.).

Common situations: Reusing a TP/SL params template across spot and futures instruments; misconfigured instrument definition.

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/d78bc460451b7fc6. Report an issue: GitHub.