nautechsystems/nautilus_trader · error · anyhow::Error

Unsupported order type for Binance Spot

Error message

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

What it means

`order_type_to_binance_spot` maps Nautilus order types to Binance Spot order types and throws when the input order type has no Binance Spot equivalent. Only Limit (incl. post-only LimitMaker), Market, StopMarket (StopLoss), StopLimit (StopLossLimit), MarketIfTouched (TakeProfit), and LimitIfTouched (TakeProfitLimit) are supported; anything else (e.g. trailing or iceberg-only variants) falls into the catch-all bail.

Solutions

  1. Change the strategy to only submit order types supported by Binance Spot (Limit, Market, StopMarket, StopLimit, MarketIfTouched, LimitIfTouched)
  2. Route unsupported order types to a different venue (e.g. Binance Futures) that supports them
  3. Emulate the desired order type in the strategy (e.g. implement trailing logic locally with stop orders)
  4. Check the mapping table in crates/adapters/binance/src/spot/enums.rs to confirm which types are supported before submitting

Example fix

// before
let order = order_factory.trailing_stop_market(...);
exec_client.submit_order(order);
// after
let order = order_factory.stop_market(...); // TrailingStop unsupported on Spot
exec_client.submit_order(order);
Defensive patterns

Strategy: validation

Validate before calling

fn is_spot_supported_order_type(t: OrderType) -> bool {
    matches!(t,
        OrderType::Market | OrderType::Limit | OrderType::StopMarket
        | OrderType::StopLimit | OrderType::MarketIfTouched | OrderType::LimitIfTouched)
}
// call before submit_order; reject or reroute otherwise

Type guard

fn order_type_supported_on_spot(t: OrderType) -> bool {
    is_spot_supported_order_type(t)
}

Try / catch

match exec_client.submit_order(order) {
    Err(e) if e.to_string().starts_with("Unsupported order type for Binance Spot") => {
        log::warn!("rerouting unsupported order type {:?} to futures venue", order.order_type());
        futures_exec_client.submit_order(order)?;
    }
    other => other?,
}

Prevention

When it happens

Trigger: Submitting, modifying, or building params for (via `submit_order`, `modify_order`, `build_new_order_params`, `build_cancel_replace_params`) an order whose `OrderType` is not one of the mapped variants, e.g. `OrderType::TrailingStopMarket` or any future/unmapped type.

Common situations: A strategy configured with trailing-stop orders on Spot; generic execution logic that issues the same order type across venues; upgrading Nautilus and using a newly added OrderType that the Spot mapper does not yet handle.

Related errors


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

Appendix: source

Thrown at crates/adapters/binance/src/spot/enums.rs:115

/// Converts a Nautilus order type to Binance Spot order type.
///
/// # Errors
///
/// Returns an error if the order type is not supported on Binance Spot.
pub fn order_type_to_binance_spot(
    order_type: OrderType,
    post_only: bool,
) -> anyhow::Result<BinanceSpotOrderType> {
    match (order_type, post_only) {
        (OrderType::Market, _) => Ok(BinanceSpotOrderType::Market),
        (OrderType::Limit, true) => Ok(BinanceSpotOrderType::LimitMaker),
        (OrderType::Limit, false) => Ok(BinanceSpotOrderType::Limit),
        (OrderType::StopMarket, _) => Ok(BinanceSpotOrderType::StopLoss),
        (OrderType::StopLimit, _) => Ok(BinanceSpotOrderType::StopLossLimit),
        (OrderType::MarketIfTouched, _) => Ok(BinanceSpotOrderType::TakeProfit),
        (OrderType::LimitIfTouched, _) => Ok(BinanceSpotOrderType::TakeProfitLimit),
        _ => anyhow::bail!("Unsupported order type for Binance Spot: {order_type:?}"),
    }
}

/// Converts a Nautilus time in force to Binance Spot time in force.
///
/// Binance Spot only supports GTC, IOC, and FOK. When native GTD is disabled,
/// GTD maps to GTC so a Nautilus strategy can manage expiry locally.
///
/// # Errors
///
/// Returns an error if the time in force is not supported on Binance Spot.
pub fn time_in_force_to_binance_spot(
    tif: TimeInForce,
    use_gtd: bool,
) -> anyhow::Result<BinanceTimeInForce> {
    match tif {
        TimeInForce::Gtc => Ok(BinanceTimeInForce::Gtc),
        TimeInForce::Ioc => Ok(BinanceTimeInForce::Ioc),

View on GitHub (pinned to 18893faf8b)