{"record":{"id":"13ecd7f31eba8193","repo":"nautechsystems/nautilus_trader","slug":"trailing-stop-orders-are-not-yet-supported-on-the-13ecd7","errorCode":null,"errorMessage":"Trailing stop orders are not yet supported on the Kraken WS batch path; use REST","messagePattern":"Trailing stop orders are not yet supported on the Kraken WS batch path; use REST","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/kraken/src/execution/spot.rs","lineNumber":1000,"sourceCode":"    Option<Quantity>,\n    Option<u16>,\n);\n\nfn build_batch_order(\n    order: &OrderAny,\n    leverage: Option<u16>,\n) -> anyhow::Result<KrakenWsBatchAddOrder> {\n    let order_type = order.order_type();\n    let side = match order.order_side() {\n        OrderSide::Buy => KrakenOrderSide::Buy,\n        OrderSide::Sell => KrakenOrderSide::Sell,\n    };\n\n    if matches!(\n        order_type,\n        OrderType::TrailingStopMarket | OrderType::TrailingStopLimit\n    ) {\n        anyhow::bail!(\n            \"Trailing stop orders are not yet supported on the Kraken WS batch path; use REST\",\n        );\n    }\n\n    if order.display_qty().is_some() {\n        anyhow::bail!(\n            \"Iceberg (display_qty) orders are not supported on the Kraken WS batch path; use REST\",\n        );\n    }\n\n    let kraken_order_type = match order_type {\n        OrderType::Market => KrakenOrderType::Market,\n        OrderType::Limit => KrakenOrderType::Limit,\n        OrderType::StopMarket => KrakenOrderType::StopLoss,\n        OrderType::StopLimit => KrakenOrderType::StopLossLimit,\n        OrderType::MarketIfTouched => KrakenOrderType::TakeProfit,\n        OrderType::LimitIfTouched => KrakenOrderType::TakeProfitLimit,\n        ty => anyhow::bail!(\"Unsupported order type for Kraken WS batch: {ty:?}\"),","sourceCodeStart":982,"sourceCodeEnd":1018,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/kraken/src/execution/spot.rs#L982-L1018","documentation":"Kraken's WebSocket batch-order add endpoint does not support trailing stop orders, so `build_batch_order` (used by `batch_add_via_ws`) rejects TrailingStopMarket and TrailingStopLimit orders up front and tells the caller to use the REST path instead.","triggerScenarios":"Submitting a batch order add via WebSocket containing an order with OrderType::TrailingStopMarket or OrderType::TrailingStopLimit on Kraken Spot.","commonSituations":"Strategies using trailing stops configured to route all orders through the WS batch API; batching mixed order types where one is a trailing stop.","solutions":["Submit the trailing stop order via REST instead of the WS batch path","Split the batch: send trailing stops individually over REST and the rest via WS batch","Change the order type (e.g. regular stop) if trailing behavior is not essential"],"exampleFix":"// before\nbatch_add_via_ws(vec![trailing_stop_order]);\n// after\nclient.submit_order_via_rest(trailing_stop_order); // or exclude it from the WS batch","handlingStrategy":"validation","validationCode":"if matches!(order.order_type(), OrderType::TrailingStopMarket | OrderType::TrailingStopLimit) {\n    submit_via_rest(order); // WS batch cannot carry trailing stops\n} else {\n    batch_add_via_ws(vec![order])?;\n}","typeGuard":"fn is_ws_batch_compatible(order: &OrderAny) -> bool {\n    !matches!(order.order_type(), OrderType::TrailingStopMarket | OrderType::TrailingStopLimit)\n        && order.display_qty().is_none()\n        && matches!(order.order_type(), OrderType::Market | OrderType::Limit | OrderType::StopMarket | OrderType::StopLimit | OrderType::MarketIfTouched | OrderType::LimitIfTouched)\n}","tryCatchPattern":"match batch_result {\n    Err(e) if e.to_string().contains(\"Trailing stop\") => submit_via_rest(order),\n    r => r?,\n}","preventionTips":["Filter trailing stops out of WS batches before submitting","Route trailing stops through the REST submission path permanently","Keep a compatibility matrix of order types vs submission paths for Kraken Spot"],"tags":["rust","kraken-spot","orders","batch","trailing-stop"],"backgroundTag":"operation-not-supported","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"}