{"record":{"id":"4bb9efd914ef8917","repo":"nautechsystems/nautilus_trader","slug":"unsupported-algo-order-type","errorCode":null,"errorMessage":"Unsupported algo order type: {:?}","messagePattern":"Unsupported algo order type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/okx/src/websocket/parse.rs","lineNumber":1695,"sourceCode":"                        OrderType::LimitIfTouched\n                    },\n                    trigger_px: msg.tp_trigger_px.as_str(),\n                    trigger_px_type: msg.tp_trigger_px_type,\n                    ord_px,\n                })\n            }\n        }\n        OKXAlgoOrderType::Trigger => Ok(AlgoOrderFields {\n            order_type: if is_market_price(&msg.ord_px) {\n                OrderType::StopMarket\n            } else {\n                OrderType::StopLimit\n            },\n            trigger_px: msg.trigger_px.as_str(),\n            trigger_px_type: msg.trigger_px_type,\n            ord_px: msg.ord_px.as_str(),\n        }),\n        _ => anyhow::bail!(\"Unsupported algo order type: {:?}\", msg.ord_type),\n    }\n}\n\nfn parse_algo_order_quantity(\n    msg: &OKXAlgoOrderMsg,\n    instrument: &InstrumentAny,\n) -> anyhow::Result<Quantity> {\n    if !msg.sz.is_empty() {\n        return parse_quantity(msg.sz.as_str(), instrument.size_precision());\n    }\n\n    if !msg.close_fraction.is_empty()\n        || !msg.sl_trigger_px.is_empty()\n        || !msg.tp_trigger_px.is_empty()\n    {\n        return Ok(Quantity::zero(instrument.size_precision()));\n    }\n","sourceCodeStart":1677,"sourceCodeEnd":1713,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/okx/src/websocket/parse.rs#L1677-L1713","documentation":"parse_algo_order_fields maps OKX algo order ord_type values to Nautilus OrderType variants; anything outside the supported set (e.g. unexpected or newly added OKX algo types) hits the catch-all arm and bails. The library cannot represent that algo order type.","triggerScenarios":"Receiving an OKX algo order update whose ord_type is not one of the handled values (e.g. 'oco', 'twap', 'iceberg', or a newly introduced OKX type) while parsing an algo order status report.","commonSituations":"OKX adds a new algo order type; user places algo orders via OKX web UI or another client that the adapter doesn't support; typos in manually crafted test messages.","solutions":["Check the msg.ord_type value in the error and confirm it is an OKX-supported algo type the adapter handles","Place only supported algo order types (trigger/stop-limit style) through this adapter","If OKX added a new type, update parse_algo_order_fields to map it or filter those channels out"],"exampleFix":"// before\n\"twap\" => anyhow::bail!(\"Unsupported algo order type: {:?}\", msg.ord_type),\n// after (in parse_algo_order_fields)\nOKXAlgoOrdType::Conditional => OrderType::StopMarket,\nOKXAlgoOrdType::Trigger => OrderType::StopMarket,","handlingStrategy":"try-catch","validationCode":"let supported = [\"conditional\", \"trigger\", \"oco\", \"\"];\nif let Some(t) = &msg.ord_type && !supported.contains(&t.as_str()) {\n    tracing::warn!(\"skipping unsupported algo ord_type {t}\");\n    return Ok(None);\n}","typeGuard":null,"tryCatchPattern":"match parse_algo_order_status_report(msg, instrument) {\n    Ok(r) => handle(r),\n    Err(e) if e.to_string().starts_with(\"Unsupported algo order type\") => {\n        tracing::warn!(\"ignoring unsupported algo type: {e}\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Keep the OKX algo ord_type mapping in sync with OKX API docs","Only place algo orders via the adapter's supported types","Log-and-skip unknown enum values at the serde layer"],"tags":["okx","parsing","websocket","order-type"],"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"}