nautechsystems/nautilus_trader · error · anyhow::Error

Unsupported order type for Binance Futures

Error message

Unsupported order type for Binance Futures: {order_type:?}

What it means

When building a Binance Futures order submission, the adapter maps nautilus OrderType variants to BinanceFuturesOrderType. The wildcard arm rejects any order type Binance Futures does not support natively (e.g. MarketToLimit, MarketToLimit variants, or futures-unsupported spot types).

Solutions

  1. Use a supported order type: Limit, Market, StopMarket, StopLimit, MarketIfTouched, LimitIfTouched, TrailingStopMarket.
  2. If market-to-limit semantics are needed, emulate them in the strategy or use a different venue.
  3. Check the strategy/config that constructs orders and restrict allowed order types for this venue.

Example fix

// before
instrument_provider.orders.push(Order::limit_if_touched(...)) // unsupported on futures
// after
instrument_provider.orders.push(Order::limit(...)) // or stop_limit with trigger
Defensive patterns

Strategy: validation

Validate before calling

const FUTURES_SUPPORTED: &[OrderType] = &[
    OrderType::Market, OrderType::Limit, OrderType::StopMarket, OrderType::StopLimit,
    OrderType::MarketIfTouched, OrderType::LimitIfTouched, OrderType::TrailingStopMarket,
];
assert!(FUTURES_SUPPORTED.contains(&order.order_type()), "unsupported: {:?}", order.order_type());

Try / catch

match client.submit_order(order).await {
    Err(e) if e.to_string().contains("Unsupported order type") => {
        tracing::warn!("order type {:?} not supported on Binance Futures, skipping", order.order_type());
    }
    r => r?,
}

Prevention

When it happens

Trigger: Submitting an order (e.g. via generate_order_submission commands or the HTTP client) whose OrderType falls through the explicit match arms — any variant other than Limit, StopMarket, StopLimit, MarketIfTouched, LimitIfTouched, TrailingStopMarket, and the other explicitly handled variants (Market, TrailingStopLimit if mapped).

Common situations: A strategy configured with avenue order types like MARKET_TO_LIMIT; an order-execution engine routing to Binance Futures with order types valid only on spot or other venues; a config typo or default producing an unmapped order type.

Related errors


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

Appendix: source

Thrown at crates/adapters/binance/src/futures/http/client.rs:3453

            | OrderType::MarketIfTouched
            | OrderType::LimitIfTouched
            | OrderType::TrailingStopMarket
    )
}

/// Converts a Nautilus order type to a Binance Futures order type.
pub(crate) fn order_type_to_binance_futures(
    order_type: OrderType,
) -> anyhow::Result<BinanceFuturesOrderType> {
    match order_type {
        OrderType::Market => Ok(BinanceFuturesOrderType::Market),
        OrderType::Limit => Ok(BinanceFuturesOrderType::Limit),
        OrderType::StopMarket => Ok(BinanceFuturesOrderType::StopMarket),
        OrderType::StopLimit => Ok(BinanceFuturesOrderType::Stop),
        OrderType::MarketIfTouched => Ok(BinanceFuturesOrderType::TakeProfitMarket),
        OrderType::LimitIfTouched => Ok(BinanceFuturesOrderType::TakeProfit),
        OrderType::TrailingStopMarket => Ok(BinanceFuturesOrderType::TrailingStopMarket),
        _ => anyhow::bail!("Unsupported order type for Binance Futures: {order_type:?}"),
    }
}

#[cfg(test)]
mod tests {
    use nautilus_core::time::get_atomic_clock_realtime;
    use nautilus_network::http::{HttpStatus, StatusCode};
    use rstest::rstest;
    use tokio_util::bytes::Bytes;

    use super::*;
    use crate::common::enums::BinanceTradingStatus;

    #[rstest]
    fn test_rate_limit_config_usdm_has_request_weight_and_orders() {
        let config = BinanceRawFuturesHttpClient::rate_limit_config(BinanceProductType::UsdM);

        assert_eq!(config.request_quota.burst_size().get(), 2_400);

View on GitHub (pinned to 18893faf8b)