{"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/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/spot/enums.rs#L97-L133","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Change the strategy to only submit order types supported by Binance Spot (Limit, Market, StopMarket, StopLimit, MarketIfTouched, LimitIfTouched)","Route unsupported order types to a different venue (e.g. Binance Futures) that supports them","Emulate the desired order type in the strategy (e.g. implement trailing logic locally with stop orders)","Check the mapping table in crates/adapters/binance/src/spot/enums.rs to confirm which types are supported before submitting"],"exampleFix":"// before\nlet order = order_factory.trailing_stop_market(...);\nexec_client.submit_order(order);\n// after\nlet order = order_factory.stop_market(...); // TrailingStop unsupported on Spot\nexec_client.submit_order(order);","handlingStrategy":"validation","validationCode":"fn is_spot_supported_order_type(t: OrderType) -> bool {\n    matches!(t,\n        OrderType::Market | OrderType::Limit | OrderType::StopMarket\n        | OrderType::StopLimit | OrderType::MarketIfTouched | OrderType::LimitIfTouched)\n}\n// call before submit_order; reject or reroute otherwise","typeGuard":"fn order_type_supported_on_spot(t: OrderType) -> bool {\n    is_spot_supported_order_type(t)\n}","tryCatchPattern":"match exec_client.submit_order(order) {\n    Err(e) if e.to_string().starts_with(\"Unsupported order type for Binance Spot\") => {\n        log::warn!(\"rerouting unsupported order type {:?} to futures venue\", order.order_type());\n        futures_exec_client.submit_order(order)?;\n    }\n    other => other?,\n}","preventionTips":["Restrict Spot strategies to Limit/Market/StopMarket/StopLimit/MarketIfTouched/LimitIfTouched","Validate order templates at strategy startup, before any live submission","Route trailing or exotic order types to venues that support them (e.g. Binance Futures)","Re-check the mapping in spot/enums.rs after upgrading NautilusTrader versions"],"tags":["rust","order-type","binance","unsupported-enum-value"],"backgroundTag":"unsupported-enum-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}