{"record":{"id":"833c90eee361aa93","repo":"nautechsystems/nautilus_trader","slug":"unsupported-trailing-offset-type-for-okx-offset","errorCode":null,"errorMessage":"Unsupported trailing_offset_type for OKX: {offset_type:?}","messagePattern":"Unsupported trailing_offset_type for OKX: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/okx/src/execution.rs","lineNumber":904,"sourceCode":"            Some(is_reduce_only)\n        };\n\n        let (callback_ratio, callback_spread) = if order_type == OrderType::TrailingStopMarket {\n            let offset = trailing_offset\n                .ok_or_else(|| anyhow::anyhow!(\"TrailingStopMarket requires trailing_offset\"))?;\n            let offset_type = trailing_offset_type.ok_or_else(|| {\n                anyhow::anyhow!(\"TrailingStopMarket requires trailing_offset_type\")\n            })?;\n\n            match offset_type {\n                TrailingOffsetType::BasisPoints => {\n                    // Convert basis points to ratio (e.g., 100 bps = 0.01)\n                    let ratio = offset / Decimal::from(10000);\n                    (Some(ratio.to_string()), None)\n                }\n                TrailingOffsetType::Price => (None, Some(offset.to_string())),\n                _ => {\n                    anyhow::bail!(\"Unsupported trailing_offset_type for OKX: {offset_type:?}\");\n                }\n            }\n        } else {\n            (None, None)\n        };\n\n        self.ws_dispatch_state.track_order_context(context);\n        let dispatch_state = Arc::clone(&self.ws_dispatch_state);\n\n        self.spawn_task(\"submit_algo_order\", async move {\n            let result = http_client\n                .place_algo_order_with_domain_types(\n                    instrument_id,\n                    trade_mode,\n                    client_order_id,\n                    order_side,\n                    order_type,\n                    quantity,","sourceCodeStart":886,"sourceCodeEnd":922,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/okx/src/execution.rs#L886-L922","documentation":"When building an OKX trailing-stop algo order, the adapter maps `TrailingOffsetType` to OKX callback parameters. Only `BasisPoints`, `Price`, and (per surrounding code) ratio-based variants are supported; any other `TrailingOffsetType` (e.g. a type OKX has no analog for) causes `anyhow::bail!` in `submit_conditional_order`.","triggerScenarios":"Submitting a trailing-stop conditional order whose `TrailingOffsetType` is not one of the OKX-supported variants (e.g. a basis/price/percent type outside the matched arms, or a venue-specific offset type) — i.e. the `_` catch-all arm is reached.","commonSituations":"Configuring a trailing stop with an offset type taken from another adapter's docs; a generic strategy builder that exposes all `TrailingOffsetType` variants without venue filtering.","solutions":["Set the order's trailing offset type to `TrailingOffsetType::BasisPoints` or `TrailingOffsetType::Price`, which the adapter maps to OKX callback params.","Convert your desired offset into basis points before submitting (e.g. a percent offset as bps).","Guard in strategy config: validate the trailing offset type against OKX support before order construction."],"exampleFix":"// before\norder.trailing_offset_type = TrailingOffsetType::Ticks;\n// after\norder.trailing_offset_type = TrailingOffsetType::BasisPoints; // OKX-supported","handlingStrategy":"validation","validationCode":"const OKX_SUPPORTED: &[TrailingOffsetType] = &[TrailingOffsetType::BasisPoints, TrailingOffsetType::Price];\nif !OKX_SUPPORTED.contains(&order.trailing_offset_type()) {\n    return Err(anyhow::anyhow!(\"trailing_offset_type not supported by OKX\"));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only BasisPoints or Price trailing offset types for OKX.","Convert percent/tick offsets to basis points before order construction.","Validate trailing-stop config against venue support in strategy setup."],"tags":["okx","trailing-stop","invalid-enum-value","conditional-order"],"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"}