nautechsystems/nautilus_trader · error

missing trigger price type for Derive trigger order; Derive

Error message

missing trigger price type for Derive trigger order; Derive trigger orders support only MarkPrice

What it means

Derive trigger orders require an explicit trigger price source, and it must be Mark price. When `trigger_price_type_to_derive` is called with `trigger_type: None`, there is no source to map, so it fails with this message rather than silently defaulting.

Source

Thrown at crates/adapters/derive/src/common/parse.rs:175

/// Maps Nautilus trigger price source to Derive.
///
/// # Errors
///
/// Returns an error unless the trigger source maps to mark price, which is the
/// only source Derive currently accepts for trigger orders.
pub fn trigger_price_type_to_derive(
    trigger_type: Option<TriggerType>,
) -> anyhow::Result<DeriveTriggerPriceType> {
    match trigger_type {
        Some(TriggerType::Default | TriggerType::MarkPrice) => Ok(DeriveTriggerPriceType::Mark),
        Some(TriggerType::IndexPrice) => anyhow::bail!(
            "unsupported trigger price type for Derive: IndexPrice; Derive currently accepts only MarkPrice for trigger orders"
        ),
        Some(other) => anyhow::bail!(
            "unsupported trigger price type for Derive: {other:?}; Derive trigger orders support only MarkPrice"
        ),
        None => anyhow::bail!(
            "missing trigger price type for Derive trigger order; Derive trigger orders support only MarkPrice"
        ),
    }
}

/// Maps a Nautilus time-in-force flag to the Derive TIF.
///
/// # Errors
///
/// Returns an error for time-in-force flags Derive does not accept.
pub fn time_in_force_to_derive(
    tif: TimeInForce,
    post_only: bool,
) -> anyhow::Result<DeriveTimeInForce> {
    match tif {
        TimeInForce::Gtc if post_only => Ok(DeriveTimeInForce::PostOnly),
        TimeInForce::Ioc | TimeInForce::Fok if post_only => anyhow::bail!(
            "post-only Derive orders only support GTC time in force; received {tif:?}"

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Set `trigger_type` explicitly to `TriggerType::MarkPrice` (or `Default`) when constructing the trigger order
  2. Enforce trigger-type assignment in order-construction helpers before dispatching to Derive
  3. Pre-validate with `validate_trigger_order_support` to surface the missing field early

Example fix

// before
let order = order_builder.stop_market(...).build(); // trigger_type None
// after
let order = order_builder.stop_market(...).trigger(TriggerType::MarkPrice).build();
Defensive patterns

Strategy: validation

Validate before calling

fn has_trigger_type(t: Option<TriggerType>) -> bool { t.is_some() }

Type guard

fn trigger_type_set(t: Option<TriggerType>) -> bool { t.is_some() }

Try / catch

match trigger_price_type_to_derive(order.trigger_type()) {
    Ok(pt) => { /* build payload */ }
    Err(e) => tracing::warn!(%e, "trigger order missing required trigger type"),
}

Prevention

When it happens

Trigger: Creating Derive trigger fields (`DeriveTriggerFields`) or validating support for a trigger order whose Nautilus definition leaves `trigger_type` unset (None) — e.g. an order built without specifying its trigger source.

Common situations: Strategies that construct conditional orders without setting trigger type because another venue tolerated a default; Nautilus builder defaults that leave the trigger type as None.

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