nautechsystems/nautilus_trader · error

Conditional order type {order_type:?} requires trigger_price

Error message

Conditional order type {order_type:?} requires trigger_price for Kraken WS batch

What it means

Conditional Kraken Spot WS batch orders (stop/take-profit variants) must carry a trigger price. If, after building trigger parameters, trigger is None — i.e. the order is conditional but order.trigger_price() is None — build_batch_order bails with this error rather than sending an invalid batch message.

Source

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

    let trigger = if is_conditional {
        let trigger_ref = match order.trigger_type() {
            Some(TriggerType::IndexPrice) => KrakenSpotTrigger::Index,
            Some(TriggerType::LastPrice | TriggerType::Default) | None => KrakenSpotTrigger::Last,
            Some(other) => anyhow::bail!(
                "Unsupported trigger type for Kraken Spot WS batch: {other:?} (only LastPrice and IndexPrice supported)",
            ),
        };
        order.trigger_price().map(|tp| KrakenWsTriggerParams {
            reference: trigger_ref,
            price: tp.as_decimal(),
            price_type: None,
        })
    } else {
        None
    };

    if is_conditional && trigger.is_none() {
        anyhow::bail!(
            "Conditional order type {order_type:?} requires trigger_price for Kraken WS batch",
        );
    }

    Ok(KrakenWsBatchAddOrder {
        order_type: kraken_order_type,
        side,
        order_qty: order.quantity().as_decimal(),
        limit_price: order.price().map(|p| p.as_decimal()),
        cl_ord_id: Some(truncate_cl_ord_id(&order.client_order_id())),
        time_in_force: ws_tif,
        expire_time,
        post_only: order.is_post_only().then_some(true),
        reduce_only: order.is_reduce_only().then_some(true),
        leverage,
        trigger,
    })
}

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Set trigger_price on the order before batch submission.
  2. Guard with order.trigger_price().is_some() for conditional order types prior to calling batch_add_via_ws.
  3. Use a non-conditional order type (Limit/Market) if no trigger is desired.

Example fix

// before
OrderBuilder::stop_limit(instrument_id, side, qty).limit_price(lp).build()
// after
OrderBuilder::stop_limit(instrument_id, side, qty)
    .trigger_price(Price::from("26500.00"))
    .limit_price(lp)
    .build()
Defensive patterns

Strategy: validation

Validate before calling

fn conditional_has_trigger(t: OrderType, tp: Option<Price>) -> bool {
    let conditional = matches!(t, OrderType::StopMarket | OrderType::StopLimit | OrderType::MarketIfTouched | OrderType::LimitIfTouched);
    !conditional || tp.is_some()
}

Type guard

fn has_trigger_price(order: &OrderAny) -> bool { order.trigger_price().is_some() }

Prevention

When it happens

Trigger: Calling batch_add_via_ws with an OrderType such as StopMarket/StopLimit where no trigger price was set on the order.

Common situations: Copy-pasting a plain limit order construction and changing only the order type without adding trigger_price; orders deserialized from config where trigger fields were omitted.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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