nautechsystems/nautilus_trader · error · anyhow::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 path; use REST

What it means

build_add_order_params converts a Nautilus order command into Kraken Spot WS v2 addOrder parameters. Trailing stop orders (TrailingStopMarket/TrailingStopLimit) have no supported mapping on the WS path yet, so the builder explicitly bails and directs users to the Kraken REST execution path.

Source

Thrown at crates/adapters/kraken/src/common/order_params.rs:65

    cmd: &SubmitOrder,
    order: &OrderAny,
    token: SecretString,
    leverage: Option<u16>,
) -> anyhow::Result<KrakenWsAddOrderParams> {
    let order_type = order.order_type();
    let order_side = order.order_side();
    let time_in_force = order.time_in_force();

    let side = match 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 path; use REST",);
    }

    if order.display_qty().is_some() {
        anyhow::bail!(
            "Iceberg (display_qty) orders are not supported on the Kraken WS 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,
        _ => anyhow::bail!("Unsupported order type for Kraken WS: {order_type:?}"),
    };

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Route trailing stop orders through the Kraken REST execution path instead of the WS path.
  2. Change the strategy to use plain StopMarket/StopLimit orders if WS execution is required.
  3. Track adapter updates: WS support for trailing stops may be added later; feature-gate trailing stops off for Kraken WS until then.

Example fix

// before
exec_client.submit(order); // routed to WS, order type = TrailingStopMarket
// after
if matches!(order.order_type(), OrderType::TrailingStopMarket | OrderType::TrailingStopLimit) {
    rest_exec_client.submit(order); // use REST adapter for trailing stops
} else {
    ws_exec_client.submit(order);
}
Defensive patterns

Strategy: validation

Validate before calling

if matches!(order.order_type(), OrderType::TrailingStopMarket | OrderType::TrailingStopLimit) {
    // route to REST client or reject at strategy level before reaching WS
}

Try / catch

match ws_client.submit(order).await {
    Err(e) if e.to_string().contains("Trailing stop orders are not yet supported") => {
        // fall back to REST execution or disable trailing stops
    }
    result => result?,
}

Prevention

When it happens

Trigger: Submitting an order of type TrailingStopMarket or TrailingStopLimit through the Kraken WebSocket execution client (submit_via_ws -> build_add_order_params).

Common situations: A strategy config generates trailing-stop orders (e.g. trailing stop loss on positions) while the adapter's execution routing is set to WebSocket instead of REST.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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