nautechsystems/nautilus_trader · error

`TrailingOffsetType` {trailing_offset_type} not currently su

Error message

`TrailingOffsetType` {trailing_offset_type} not currently supported

What it means

In trailing_stop_calculate the offset computation match handles only TrailingOffsetType::Price, BasisPoints, and Ticks; any other TrailingOffsetType falls into the catch-all `_` arm which bails. The library has no offset conversion defined for that variant.

Source

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

            }
            _ => None,
        }
    };

    let better_trigger: fn(Price, Price) -> bool = match order_side {
        OrderSide::Buy => |c, p| c < p,
        OrderSide::Sell => |c, p| c > p,
    };
    let better_limit = better_trigger;

    let compute = |off: Decimal, basis: Price| -> anyhow::Result<Price> {
        let basis = basis.as_decimal();
        let offset = match trailing_offset_type {
            TrailingOffsetType::Price => off,
            TrailingOffsetType::BasisPoints => basis * off / Decimal::from(10_000),
            TrailingOffsetType::Ticks => off * price_increment.as_decimal(),
            _ => {
                anyhow::bail!("`TrailingOffsetType` {trailing_offset_type} not currently supported")
            }
        };
        let value = match order_side {
            OrderSide::Buy => basis + offset,
            OrderSide::Sell => basis - offset,
        };
        Price::from_decimal_dp(value, price_increment.precision).map_err(Into::into)
    };

    match trigger_type {
        TriggerType::LastPrice | TriggerType::MarkPrice => {
            let last = last.ok_or(OrderError::InvalidStateTransition)?;
            let cand_trigger = compute(trailing_offset, last)?;
            new_trigger_price = maybe_move(&mut trigger_price, cand_trigger, better_trigger);

            if order_type == OrderType::TrailingStopLimit {
                let limit_offset = order.limit_offset().ok_or_else(|| {
                    anyhow::anyhow!("Missing `limit_offset` for trailing stop limit calculation")

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Use TrailingOffsetType::Price, BasisPoints, or Ticks for the order's trailing offset.
  2. Add a conversion arm for the desired TrailingOffsetType in trailing.rs if support is required.
  3. Convert the unsupported offset into a supported unit (e.g. precompute a fixed Price offset) before submitting.

Example fix

// before
let order = factory.trailing_stop_market(TrailingOffsetType::Percentage, ...);
// after
let order = factory.trailing_stop_market(TrailingOffsetType::BasisPoints, ...);
Defensive patterns

Strategy: validation

Validate before calling

fn offset_supported(t: TrailingOffsetType) -> bool {
    matches!(t, TrailingOffsetType::Price | TrailingOffsetType::BasisPoints | TrailingOffsetType::Ticks)
}

Type guard

fn is_supported_offset(t: &TrailingOffsetType) -> bool {
    matches!(t, TrailingOffsetType::Price | TrailingOffsetType::BasisPoints | TrailingOffsetType::Ticks)
}

Prevention

When it happens

Trigger: Passing a trailing_offset_type other than Price/BasisPoints/Ticks (e.g. Percentage or BasisPointsPerSecond, depending on the enum) into trailing_stop_calculate via update_trailing_stop_order.

Common situations: Strategy config constructed a TrailingOffsetType variant not yet implemented in the Rust executor; config deserialized an unsupported variant from a template meant for the Python v1 engine.

Related errors


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