{"record":{"id":"498c221db9dd4d71","repo":"nautechsystems/nautilus_trader","slug":"bitmex-only-supports-price-trailing-offset-type-w-498c22","errorCode":null,"errorMessage":"BitMEX only supports PRICE trailing offset type, was {offset_type:?}","messagePattern":"BitMEX only supports PRICE trailing offset type, was (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/bitmex/src/http/client.rs","lineNumber":1704,"sourceCode":"\n        if let Some(display_qty) = display_qty {\n            params.display_qty(quantity_to_u32(&display_qty, &instrument));\n        }\n\n        if let Some(order_list_id) = order_list_id {\n            params.cl_ord_link_id(order_list_id.as_str());\n        }\n\n        let is_trailing_stop = matches!(\n            order_type,\n            OrderType::TrailingStopMarket | OrderType::TrailingStopLimit\n        );\n\n        if is_trailing_stop && let Some(offset) = trailing_offset {\n            if let Some(offset_type) = trailing_offset_type\n                && offset_type != TrailingOffsetType::Price\n            {\n                anyhow::bail!(\n                    \"BitMEX only supports PRICE trailing offset type, was {offset_type:?}\"\n                );\n            }\n\n            params.peg_price_type(BitmexPegPriceType::TrailingStopPeg);\n\n            // BitMEX requires negative offset for stop-sell orders\n            let signed_offset = match order_side {\n                OrderSide::Sell => -offset.abs(),\n                OrderSide::Buy => offset.abs(),\n            };\n            params.peg_offset_value(signed_offset);\n        }\n\n        // Pegged orders (BBO) via params override\n        if peg_price_type.is_none() && peg_offset_value.is_some() {\n            anyhow::bail!(\"`peg_offset_value` requires `peg_price_type`\");\n        }","sourceCodeStart":1686,"sourceCodeEnd":1722,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bitmex/src/http/client.rs#L1686-L1722","documentation":"submit_order rejects trailing stop orders whose TrailingOffsetType is anything but PRICE: BitMEX pegs the order with an absolute trailing-stop offset (TrailingStopPeg) and cannot express basis-point or tick offsets.","triggerScenarios":"Calling submit_order with a trailing-stop order whose trailing_offset_type is Some(t) where t != TrailingOffsetType::Price.","commonSituations":"Reusing a strategy configured for another venue that defaults to percent or tick trailing offsets; constructing orders from config that names a different TrailingOffsetType.","solutions":["Set TrailingOffsetType::Price on the trailing stop order","Configure the strategy/venue defaults to use PRICE offsets for BitMEX","Translate percent/tick offsets into price offsets before submitting"],"exampleFix":"// before\n.trailing_offset_type(TrailingOffsetType::Percent)\n// after\n.trailing_offset_type(TrailingOffsetType::Price)","handlingStrategy":"validation","validationCode":"if order.trailing_offset_type().is_some_and(|t| t != TrailingOffsetType::Price) {\n    return Err(anyhow::anyhow!(\"BitMEX trailing stops require TrailingOffsetType::Price\"));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use TrailingOffsetType::Price for all BitMEX trailing orders","Set venue defaults in strategy config","Convert percent/tick offsets to price offsets upstream"],"tags":["rust","bitmex","trailing-stop","validation"],"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-14T05:17:10.506Z"}