{"record":{"id":"f52d5509a80dc69c","repo":"nautechsystems/nautilus_trader","slug":"bitmex-only-supports-price-trailing-offset-type-w","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/execution.rs","lineNumber":1306,"sourceCode":"\nfn validate_order_for_bitmex_submit(\n    order: &OrderAny,\n    peg_price_type: Option<BitmexPegPriceType>,\n    peg_offset_value: Option<f64>,\n) -> anyhow::Result<()> {\n    BitmexOrderType::try_from_order_type(order.order_type())?;\n    BitmexTimeInForce::try_from_time_in_force(order.time_in_force())?;\n\n    let is_trailing_stop = matches!(\n        order.order_type(),\n        OrderType::TrailingStopMarket | OrderType::TrailingStopLimit\n    );\n\n    if is_trailing_stop\n        && let Some(offset_type) = order.trailing_offset_type()\n        && offset_type != TrailingOffsetType::Price\n    {\n        anyhow::bail!(\"BitMEX only supports PRICE trailing offset type, was {offset_type:?}\");\n    }\n\n    if peg_price_type.is_none() && peg_offset_value.is_some() {\n        anyhow::bail!(\"`peg_offset_value` requires `peg_price_type`\");\n    }\n\n    if peg_price_type.is_some() && order.order_type() != OrderType::Limit {\n        let order_type = order.order_type();\n        anyhow::bail!(\"Pegged orders only supported for LIMIT order type, was {order_type:?}\");\n    }\n\n    if let Some(contingency_type) = order.contingency_type() {\n        BitmexContingencyType::try_from(contingency_type)?;\n    }\n\n    Ok(())\n}\n","sourceCodeStart":1288,"sourceCodeEnd":1324,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bitmex/src/execution.rs#L1288-L1324","documentation":"validate_order_for_bitmex_submit checks trailing stop orders before submission: BitMEX pegged (trailing) orders only support a Price-based trailing offset. If the order's trailing_offset_type is anything other than TrailingOffsetType::Price, validation bails with this error naming the offending offset type.","triggerScenarios":"Submitting a trailing stop market/limit order to BitMEX whose trailing_offset_type is e.g. Basis, Percent, or Ticks instead of Price.","commonSituations":"Strategies configured with percentage or tick trailing offsets (portable across other venues) routed to BitMEX, which only accepts absolute price offsets via its pegged order mechanism.","solutions":["Configure the trailing stop order with trailing_offset_type = TrailingOffsetType::Price","Convert percentage/tick offsets to absolute price offsets in strategy logic before submit","Route non-price trailing offset orders to a venue that supports them"],"exampleFix":"// before\nlet order = factory.trailing_stop_market(..., trailing_offset_type=TrailingOffsetType::Percent);\n// after\nlet order = factory.trailing_stop_market(..., trailing_offset_type=TrailingOffsetType::Price, trailing_offset=Price::new(abs_offset));","handlingStrategy":"validation","validationCode":"if order.order_type().is_trailing_stop()\n    && order.trailing_offset_type() != TrailingOffsetType::Price {\n    return Err(\"BitMEX trailing stops require TrailingOffsetType::Price\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Configure trailing stops with absolute price offsets for BitMEX","Convert percent/tick offsets to price offsets before submit","Add per-venue trailing order validation in strategy pre-trade checks"],"tags":["bitmex","trailing-stop","validation"],"backgroundTag":"invalid-argument-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"}