nautechsystems/nautilus_trader · error

Trailing stop orders are not yet supported on the Kraken WS…

Error message

Trailing stop orders are not yet supported on the Kraken WS batch path; use REST

What it means

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.

Solutions

  1. Submit the trailing stop order via REST instead of the WS batch path
  2. Split the batch: send trailing stops individually over REST and the rest via WS batch
  3. Change the order type (e.g. regular stop) if trailing behavior is not essential

Example fix

// before
batch_add_via_ws(vec![trailing_stop_order]);
// after
client.submit_order_via_rest(trailing_stop_order); // or exclude it from the WS batch
Defensive patterns

Strategy: validation

Validate before calling

if matches!(order.order_type(), OrderType::TrailingStopMarket | OrderType::TrailingStopLimit) {
    submit_via_rest(order); // WS batch cannot carry trailing stops
} else {
    batch_add_via_ws(vec![order])?;
}

Type guard

fn is_ws_batch_compatible(order: &OrderAny) -> bool {
    !matches!(order.order_type(), OrderType::TrailingStopMarket | OrderType::TrailingStopLimit)
        && order.display_qty().is_none()
        && matches!(order.order_type(), OrderType::Market | OrderType::Limit | OrderType::StopMarket | OrderType::StopLimit | OrderType::MarketIfTouched | OrderType::LimitIfTouched)
}

Try / catch

match batch_result {
    Err(e) if e.to_string().contains("Trailing stop") => submit_via_rest(order),
    r => r?,
}

Prevention

When it happens

Trigger: Submitting a batch order add via WebSocket containing an order with OrderType::TrailingStopMarket or OrderType::TrailingStopLimit on Kraken Spot.

Common situations: Strategies using trailing stops configured to route all orders through the WS batch API; batching mixed order types where one is a trailing stop.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/13ecd7f31eba8193. Report an issue: GitHub.

Appendix: source

Thrown at crates/adapters/kraken/src/execution/spot.rs:1000

    Option<Quantity>,
    Option<u16>,
);

fn build_batch_order(
    order: &OrderAny,
    leverage: Option<u16>,
) -> anyhow::Result<KrakenWsBatchAddOrder> {
    let order_type = order.order_type();
    let side = match order.order_side() {
        OrderSide::Buy => KrakenOrderSide::Buy,
        OrderSide::Sell => KrakenOrderSide::Sell,
    };

    if matches!(
        order_type,
        OrderType::TrailingStopMarket | OrderType::TrailingStopLimit
    ) {
        anyhow::bail!(
            "Trailing stop orders are not yet supported on the Kraken WS batch path; use REST",
        );
    }

    if order.display_qty().is_some() {
        anyhow::bail!(
            "Iceberg (display_qty) orders are not supported on the Kraken WS batch path; use REST",
        );
    }

    let kraken_order_type = match order_type {
        OrderType::Market => KrakenOrderType::Market,
        OrderType::Limit => KrakenOrderType::Limit,
        OrderType::StopMarket => KrakenOrderType::StopLoss,
        OrderType::StopLimit => KrakenOrderType::StopLossLimit,
        OrderType::MarketIfTouched => KrakenOrderType::TakeProfit,
        OrderType::LimitIfTouched => KrakenOrderType::TakeProfitLimit,
        ty => anyhow::bail!("Unsupported order type for Kraken WS batch: {ty:?}"),

View on GitHub (pinned to 18893faf8b)