nautechsystems/nautilus_trader · error

`TriggerType` {trigger_type} not currently supported

Error message

`TriggerType` {trigger_type} not currently supported

What it means

In trailing_stop_calculate the trigger-type computation match handles only the implemented TriggerType variants and ends with a `_ => bail!` arm. A TriggerType the trailing-stop logic does not implement cannot drive trigger price updates, so the library refuses the calculation.

Source

Thrown at crates/execution/src/trailing.rs:176

                if updated.is_some() {
                    new_trigger_price = updated;
                }

                if order_type == OrderType::TrailingStopLimit {
                    let limit_offset = order.limit_offset().ok_or_else(|| {
                        anyhow::anyhow!(
                            "Missing `limit_offset` for trailing stop limit calculation"
                        )
                    })?;
                    let cand_limit = compute(limit_offset, last)?;
                    let updated = maybe_move(&mut limit_price, cand_limit, better_limit);
                    if updated.is_some() {
                        new_limit_price = updated;
                    }
                }
            }
        }
        _ => anyhow::bail!("`TriggerType` {trigger_type} not currently supported"),
    }

    Ok((new_trigger_price, new_limit_price))
}

/// Calculates the trailing stop price using the last traded price.
///
/// # Errors
///
/// Returns an error if the offset type is unsupported or the calculated price cannot be
/// represented as a [`Price`].
pub fn trailing_stop_calculate_with_last(
    price_increment: Price,
    trailing_offset_type: TrailingOffsetType,
    side: OrderSide,
    offset: Decimal,
    last: Price,
) -> anyhow::Result<Price> {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Set the order's trigger_type to a variant supported by the trailing calculator (e.g. DefaultTriggerType/Last/Bid/Ask as covered by the match).
  2. Extend the match in trailing.rs to implement the missing TriggerType if needed.
  3. Skip trailing updates for unsupported trigger types in the caller instead of invoking the calculator.

Example fix

// before
let order = order_with_trigger_type(TriggerType::InversePrice);
let px = trailing_stop_calculate(&order, ...)?;
// after
let order = order_with_trigger_type(TriggerType::Default);
let px = trailing_stop_calculate(&order, ...)?;
Defensive patterns

Strategy: validation

Validate before calling

if !matches!(order.trigger_type(), TriggerType::Default | TriggerType::Last | TriggerType::Bid | TriggerType::Ask) {
    return Err(anyhow::anyhow!("unsupported trigger type for trailing stop"));
}

Type guard

fn trailing_trigger_supported(t: &TriggerType) -> bool { !matches!(t, TriggerType::InversePrice | _) } // restrict to variants covered by the match

Prevention

When it happens

Trigger: Calling trailing_stop_calculate for an order whose trigger_type is one of the unsupported variants (e.g. a Bid/Ask/Last variant not covered in the match arms in trailing.rs around line 176).

Common situations: Order configured with an exotic trigger type (e.g. inverse-price or cross-venue triggers) that the Rust trailing calculator has not implemented; test with an unsupported trigger type accidentally run against production code paths.

Related errors


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