{"record":{"id":"ea0b8142f3baab3c","repo":"nautechsystems/nautilus_trader","slug":"pegged-orders-only-supported-for-limit-order-type","errorCode":null,"errorMessage":"Pegged orders only supported for LIMIT order type, was {order_type:?}","messagePattern":"Pegged orders only supported for LIMIT order type, was (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/bitmex/src/execution.rs","lineNumber":1315,"sourceCode":"    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\nfn is_definitive_bitmex_submit_rejection(err: &anyhow::Error) -> bool {\n    if is_bitmex_duplicate_clordid_submit_failure(err) {\n        return false;\n    }\n\n    if has_bitmex_api_refusal(err) {\n        return true;\n    }\n","sourceCodeStart":1297,"sourceCodeEnd":1333,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bitmex/src/execution.rs#L1297-L1333","documentation":"BitMEX pegged orders are only allowed on LIMIT order types. If the order specifies a peg_price_type but its order type is not Limit (e.g. Market), validate_order_for_bitmex_submit bails with this message before any request reaches the venue.","triggerScenarios":"Calling validate_order_for_bitmex_submit (or submit_cached_order) with peg_price_type=Some(...) on a Market, Stop, StopLimit non-limit, or otherwise non-Limit order.","commonSituations":"Converting a market order to a pegged order; applying peg parameters generically across a strategy that also sends market orders.","solutions":["Change the order type to OrderType::Limit when pegging","Remove peg_price_type from non-limit orders","Branch the submit path so peg parameters are only applied for limit orders"],"exampleFix":"// before\nOrderType::Market with peg_price_type Some(PrimaryPeg)\n// after\nOrderType::Limit with peg_price_type Some(PrimaryPeg)","handlingStrategy":"validation","validationCode":"if peg_price_type.is_some() && order.order_type() != OrderType::Limit {\n    return Err(anyhow::anyhow!(\"pegged orders require OrderType::Limit\"));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only attach peg parameters to Limit orders","Match on order type before applying venue-specific params","Test pegged submits with both limit and market orders"],"tags":["rust","bitmex","validation","pegged-orders"],"backgroundTag":"unsupported-operation","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"}