{"record":{"id":"a229263f3ac64b6b","repo":"nautechsystems/nautilus_trader","slug":"unsupported-order-type-order-type","errorCode":null,"errorMessage":"Unsupported order type: {order_type:?}","messagePattern":"Unsupported order type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/bybit/src/http/client.rs","lineNumber":2532,"sourceCode":"        bbo_level: Option<String>,\n        smp_type: Option<BybitOrderSmpType>,\n        native_tp_sl: Option<&BybitNativeTpSlParams>,\n    ) -> anyhow::Result<OrderStatusReport> {\n        let instrument = self.instrument_from_cache(&instrument_id.symbol)?;\n        let bybit_symbol = BybitSymbol::new(instrument_id.symbol.as_str())?;\n\n        let bybit_side = match order_side {\n            OrderSide::Buy => BybitOrderSide::Buy,\n            OrderSide::Sell => BybitOrderSide::Sell,\n        };\n\n        // For stop/conditional orders, Bybit uses Market/Limit with trigger parameters\n        let (bybit_order_type, is_stop_order) = match order_type {\n            OrderType::Market => (BybitOrderType::Market, false),\n            OrderType::Limit => (BybitOrderType::Limit, false),\n            OrderType::StopMarket | OrderType::MarketIfTouched => (BybitOrderType::Market, true),\n            OrderType::StopLimit | OrderType::LimitIfTouched => (BybitOrderType::Limit, true),\n            _ => anyhow::bail!(\"Unsupported order type: {order_type:?}\"),\n        };\n\n        let bybit_tif = map_time_in_force(bybit_order_type, time_in_force, post_only)\n            .map_err(|tif| anyhow::anyhow!(\"Unsupported time in force: {tif:?}\"))?;\n        let market_unit = spot_market_unit(product_type, bybit_order_type, is_quote_quantity);\n        let trigger_dir = trigger_direction(order_type, order_side, is_stop_order);\n\n        let mut order_entry = BybitBatchPlaceOrderEntryBuilder::default();\n        order_entry.symbol(bybit_symbol.raw_symbol().to_string());\n        order_entry.side(bybit_side);\n        order_entry.order_type(bybit_order_type);\n        order_entry.qty(quantity.to_string());\n        order_entry.time_in_force(bybit_tif);\n        order_entry.order_link_id(client_order_id.to_string());\n        order_entry.market_unit(market_unit);\n        order_entry.trigger_direction(trigger_dir);\n\n        if bbo_side_type.is_none()","sourceCodeStart":2514,"sourceCodeEnd":2550,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bybit/src/http/client.rs#L2514-L2550","documentation":"The Bybit adapter only maps a subset of NautilusTrader OrderType values to Bybit order types. Market, Limit, StopMarket/MarketIfTouched, and StopLimit/LimitIfTouched are supported; any other order type (e.g. trailing stop variants) hits the catch-all arm and bails via anyhow before building the request.","triggerScenarios":"Calling the Bybit order submission path (submit_order on the Bybit execution client) with an OrderType other than Market, Limit, StopMarket, MarketIfTouched, StopLimit, or LimitIfTouched.","commonSituations":"Routing strategy orders to Bybit that use order types the adapter has not implemented (e.g. trailing-stop order types); a generic strategy that emits multiple order types being pointed at a Bybit venue without type filtering.","solutions":["Check the order type before submitting and convert unsupported types into supported equivalents (e.g. implement trailing behavior client-side with trigger orders)","Filter or guard orders in the strategy so only supported OrderType values are routed to the Bybit adapter","Extend the match in client.rs to map the needed OrderType to a Bybit order type if the venue supports it"],"exampleFix":"// before\nmatch order_type { ... _ => anyhow::bail!(\"Unsupported order type: {order_type:?}\") }\n// after\nmatch order_type {\n    OrderType::TrailingStopMarket => (BybitOrderType::Market, true), // map to trigger market\n    ... \n}","handlingStrategy":"validation","validationCode":"const SUPPORTED: &[OrderType] = &[OrderType::Market, OrderType::Limit, OrderType::StopMarket, OrderType::MarketIfTouched, OrderType::StopLimit, OrderType::LimitIfTouched];\nfn is_supported(t: &OrderType) -> bool { SUPPORTED.contains(t) }\nif !is_supported(&order.order_type()) { return Err(anyhow!(\"order type {:?} not routable to Bybit\", order.order_type())); }","typeGuard":"fn is_bybit_supported_order_type(t: &OrderType) -> bool {\n    matches!(t, OrderType::Market | OrderType::Limit | OrderType::StopMarket | OrderType::MarketIfTouched | OrderType::StopLimit | OrderType::LimitIfTouched)\n}","tryCatchPattern":null,"preventionTips":["Only route Market/Limit/conditional stop orders to Bybit","Convert unsupported order types into supported equivalents in strategy logic","Test order submission with every order type your strategies emit"],"tags":["bybit","order-type","unsupported-operation"],"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-14T00:17:10.932Z"}