nautechsystems/nautilus_trader · error · anyhow::Error

trigger_price is required for conditional order type {order_

Error message

trigger_price is required for conditional order type {order_type:?}

What it means

Conditional order types on Kraken WS require a trigger price to build KrakenWsTriggerParams. If the order is conditional but order.trigger_price() is None, the resulting trigger struct is None and the builder bails with this message.

Source

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

    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: {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!("trigger_price is required for conditional order type {order_type:?}");
    }

    let symbol = cmd.instrument_id.symbol.inner().to_string();
    let cl_ord_id = Some(truncate_cl_ord_id(&order.client_order_id()));
    let post_only = order.is_post_only().then_some(true);
    let reduce_only = order.is_reduce_only().then_some(true);

    Ok(KrakenWsAddOrderParams {
        order_type: kraken_order_type,
        side,
        order_qty: order.quantity().as_decimal(),
        symbol,
        token,
        limit_price,
        time_in_force: ws_tif,
        expire_time,
        cl_ord_id,
        post_only,

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Pass a trigger_price when constructing the stop/conditional order in the order factory.
  2. Validate before submission that conditional orders have both trigger_type and trigger_price set.
  3. Fix any logic that clears or fails to populate the trigger price (e.g. defaulting to None on parse errors).

Example fix

// before
order_factory.stop_market(instrument_id, OrderSide::Buy, qty) // no trigger price
// after
order_factory.stop_market(instrument_id, OrderSide::Buy, qty, Some(trigger_price))
Defensive patterns

Strategy: validation

Validate before calling

const CONDITIONAL: &[OrderType] = &[OrderType::StopMarket, OrderType::StopLimit, OrderType::MarketIfTouched, OrderType::LimitIfTouched];
if CONDITIONAL.contains(&order.order_type()) && order.trigger_price().is_none() {
    return Err(anyhow::anyhow!("conditional order {} needs trigger_price", order.order_type()));
}

Prevention

When it happens

Trigger: Submitting a StopMarket/StopLimit/MarketIfTouched/LimitIfTouched order via Kraken WS without a trigger price set on the order (trigger.is_none() while is_conditional is true).

Common situations: Order built without the trigger_price argument, trigger price computation returning None/zero and being skipped, or converting a plain order into a conditional one without adding the trigger.

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/f180c1da7728a8d1. Report an issue: GitHub.