{"record":{"id":"562c2966bae29c45","repo":"nautechsystems/nautilus_trader","slug":"unsupported-order-type-for-bybit-order-type","errorCode":null,"errorMessage":"unsupported order type for Bybit: {order_type}","messagePattern":"unsupported order type for Bybit: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/bybit/src/execution.rs","lineNumber":539,"sourceCode":"            return true;\n        }\n        !code.is_empty() && msg.contains(code)\n    }\n\n    fn is_low_margin_error<E: std::fmt::Display>(err: &E) -> bool {\n        err.to_string()\n            .contains(\"needs to be equal to or greater than\")\n    }\n\n    fn map_order_type(order_type: OrderType) -> anyhow::Result<(BybitOrderType, bool)> {\n        match order_type {\n            OrderType::Market => Ok((BybitOrderType::Market, false)),\n            OrderType::Limit => Ok((BybitOrderType::Limit, false)),\n            OrderType::StopMarket | OrderType::MarketIfTouched => {\n                Ok((BybitOrderType::Market, true))\n            }\n            OrderType::StopLimit | OrderType::LimitIfTouched => Ok((BybitOrderType::Limit, true)),\n            _ => anyhow::bail!(\"unsupported order type for Bybit: {order_type}\"),\n        }\n    }\n\n    fn map_time_in_force(tif: TimeInForce, is_post_only: bool) -> BybitTimeInForce {\n        if is_post_only {\n            return BybitTimeInForce::PostOnly;\n        }\n\n        match tif {\n            TimeInForce::Gtc => BybitTimeInForce::Gtc,\n            TimeInForce::Ioc => BybitTimeInForce::Ioc,\n            TimeInForce::Fok => BybitTimeInForce::Fok,\n            _ => BybitTimeInForce::Gtc,\n        }\n    }\n\n    fn validate_bbo_params(\n        order: &OrderAny,","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bybit/src/execution.rs#L521-L557","documentation":"Raised by map_order_type when converting a Nautilus OrderType to a Bybit order type and the variant has no mapping. Market, Limit, StopMarket, MarketIfTouched, StopLimit and LimitIfTouched are supported; everything else is rejected.","triggerScenarios":"Submitting (or modifying to) an order whose OrderType is not one of the supported variants — e.g. trailing-stop orders (TrailingStopMarket/TrailingStopLimit) or any newly added Nautilus order type not yet mapped in the adapter.","commonSituations":"Using trailing stops on Bybit through this adapter; strategy code written for another venue's richer order-type set; Nautilus version upgrade introducing new OrderType variants not yet handled by the Bybit adapter.","solutions":["Use only supported order types: Market, Limit, StopMarket, MarketIfTouched, StopLimit, LimitIfTouched","Emulate unsupported types (e.g. trailing stops) client-side or with stop-market plus manual adjustment","Check adapter release notes/changelog for added order-type support and upgrade the adapter"],"exampleFix":"// before\nlet order = order_factory.trailing_stop_market(...); // unsupported on Bybit adapter\n// after\nlet order = order_factory.stop_market(...); // supported: maps to Market + trigger_flag","handlingStrategy":"validation","validationCode":"const SUPPORTED: &[OrderType] = &[\n    OrderType::Market, OrderType::Limit, OrderType::StopMarket,\n    OrderType::MarketIfTouched, OrderType::StopLimit, OrderType::LimitIfTouched,\n];\nassert!(SUPPORTED.contains(&order.order_type()), \"order type unsupported on Bybit\");","typeGuard":"fn is_bybit_supported_order_type(t: OrderType) -> bool {\n    matches!(t, OrderType::Market | OrderType::Limit | OrderType::StopMarket\n        | OrderType::MarketIfTouched | OrderType::StopLimit | OrderType::LimitIfTouched)\n}","tryCatchPattern":"match exec_client.submit_order(order) {\n    Err(e) if e.to_string().starts_with(\"unsupported order type for Bybit\") => {\n        // restructure the order (e.g. stop-market) or route to another venue\n    }\n    r => r?,\n}","preventionTips":["Restrict order factories for Bybit strategies to supported variants","Add a pre-submit validation layer mapping desired order types to venue support","Watch adapter changelogs for newly supported order types"],"tags":["bybit","order-type","unsupported","order-submission"],"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"}