{"record":{"id":"233f49f7c50a0bf2","repo":"nautechsystems/nautilus_trader","slug":"unsupported-order-type-for-binance-spot-order-ty","errorCode":null,"errorMessage":"Unsupported order type for Binance Spot: {order_type:?}","messagePattern":"Unsupported order type for Binance Spot: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/spot/enums.rs","lineNumber":115,"sourceCode":"\n/// Converts a Nautilus order type to Binance Spot order type.\n///\n/// # Errors\n///\n/// Returns an error if the order type is not supported on Binance Spot.\npub fn order_type_to_binance_spot(\n    order_type: OrderType,\n    post_only: bool,\n) -> anyhow::Result<BinanceSpotOrderType> {\n    match (order_type, post_only) {\n        (OrderType::Market, _) => Ok(BinanceSpotOrderType::Market),\n        (OrderType::Limit, true) => Ok(BinanceSpotOrderType::LimitMaker),\n        (OrderType::Limit, false) => Ok(BinanceSpotOrderType::Limit),\n        (OrderType::StopMarket, _) => Ok(BinanceSpotOrderType::StopLoss),\n        (OrderType::StopLimit, _) => Ok(BinanceSpotOrderType::StopLossLimit),\n        (OrderType::MarketIfTouched, _) => Ok(BinanceSpotOrderType::TakeProfit),\n        (OrderType::LimitIfTouched, _) => Ok(BinanceSpotOrderType::TakeProfitLimit),\n        _ => anyhow::bail!(\"Unsupported order type for Binance Spot: {order_type:?}\"),\n    }\n}\n\n/// Converts a Nautilus time in force to Binance Spot time in force.\n///\n/// Binance Spot only supports GTC, IOC, and FOK. When native GTD is disabled,\n/// GTD maps to GTC so a Nautilus strategy can manage expiry locally.\n///\n/// # Errors\n///\n/// Returns an error if the time in force is not supported on Binance Spot.\npub fn time_in_force_to_binance_spot(\n    tif: TimeInForce,\n    use_gtd: bool,\n) -> anyhow::Result<BinanceTimeInForce> {\n    match tif {\n        TimeInForce::Gtc => Ok(BinanceTimeInForce::Gtc),\n        TimeInForce::Ioc => Ok(BinanceTimeInForce::Ioc),","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/spot/enums.rs#L97-L133","documentation":"order_type_to_binance_spot maps Nautilus OrderType values onto the limited set Binance Spot supports: Market, Limit (post-only becomes LIMIT_MAKER), StopMarket->STOP_LOSS, StopLimit->STOP_LOSS_LIMIT, MarketIfTouched->TAKE_PROFIT and LimitIfTouched->TAKE_PROFIT_LIMIT. Every other variant has no Binance Spot equivalent and the conversion bails.","triggerScenarios":"Submitting, modifying, or listing an order whose OrderType is MarketToLimit, TrailingStopMarket, TrailingStopLimit, or any other unmapped variant — build_spot_order_params and the WS/HTTP param builders all route through this function.","commonSituations":"Strategies written for futures or equities venues that use trailing stops on spot; ported signal libraries that emit MarketToLimit; shared order factories reused across adapters without venue filtering.","solutions":["Replace trailing stops with StopMarket/StopLimit and manage the trailing logic in the strategy","Use Market or Limit (with post_only where maker behavior is required)","Pre-validate the order type against the supported set before creating the order"],"exampleFix":"# before: unsupported on Binance Spot\norder = self.order_factory.trailing_stop_market(\n    instrument_id, order_side=OrderSide.BUY, quantity=qty, trailing_offset=..., trailing_offset_type=...,\n)\n\n# after: emulate with a strategy-managed stop\norder = self.order_factory.stop_market(\n    instrument_id, order_side=OrderSide.BUY, quantity=qty, trigger_price=stop_price,\n)\n# strategy updates the trigger price as the market moves","handlingStrategy":"type-guard","validationCode":"fn ensure_supported_spot_order_type(order_type: OrderType) -> anyhow::Result<()> {\n    anyhow::ensure!(\n        matches!(\n            order_type,\n            OrderType::Market\n                | OrderType::Limit\n                | OrderType::StopMarket\n                | OrderType::StopLimit\n                | OrderType::MarketIfTouched\n                | OrderType::LimitIfTouched\n        ),\n        \"order type {order_type:?} is not available on Binance Spot\"\n    );\n    Ok(())\n}","typeGuard":"fn is_supported_binance_spot_order_type(order_type: OrderType) -> bool {\n    matches!(\n        order_type,\n        OrderType::Market\n            | OrderType::Limit\n            | OrderType::StopMarket\n            | OrderType::StopLimit\n            | OrderType::MarketIfTouched\n            | OrderType::LimitIfTouched\n    )\n}","tryCatchPattern":"match submit_order(cmd) {\n    Ok(_) => {}\n    Err(e) if e.to_string().contains(\"Unsupported order type for Binance Spot\") => {\n        // deny locally: no venue call was possible\n        self.emitter.emit_order_denied(&order, &e.to_string());\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Filter order creation at the strategy layer by venue capability table","Emulate trailing orders with StopMarket/StopLimit plus strategy-managed trigger updates","Post-only is supported only on Limit orders (LIMIT_MAKER) — do not combine it with other types"],"tags":["binance","spot","order-type","execution","validation"],"backgroundTag":"unsupported-order-type","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}