nautechsystems/nautilus_trader · error

Take profit market order missing trigger_price

Error message

Take profit market order missing trigger_price

What it means

Nautilus MarketIfTouched orders map to dYdX TAKE_PROFIT_MARKET conditional orders, which require a trigger_price. When building the take-profit-market message the client reads order.trigger_price() and throws this error if it is None, since the exchange cannot activate the order without a trigger level.

Source

Thrown at crates/adapters/dydx/src/execution/mod.rs:1509

                        let msg = order_builder.build_stop_limit_order(
                            instrument_id,
                            client_id_u32,
                            client_metadata,
                            order.order_side(),
                            trigger_price,
                            limit_price,
                            order.quantity(),
                            order.time_in_force(),
                            order.is_post_only(),
                            order.is_reduce_only(),
                            cond_expire,
                        )?;
                        (msg, "stop_limit")
                    }
                    // dYdX TakeProfitMarket maps to Nautilus MarketIfTouched
                    OrderType::MarketIfTouched => {
                        let trigger_price = order.trigger_price().ok_or_else(|| {
                            anyhow::anyhow!("Take profit market order missing trigger_price")
                        })?;
                        let cond_expire = order.expire_time().map(nanos_to_secs_i64);
                        let msg = order_builder.build_take_profit_market_order(
                            instrument_id,
                            client_id_u32,
                            client_metadata,
                            order.order_side(),
                            trigger_price,
                            order.quantity(),
                            order.is_reduce_only(),
                            cond_expire,
                        )?;
                        (msg, "take_profit_market")
                    }
                    // dYdX TakeProfitLimit maps to Nautilus LimitIfTouched
                    OrderType::LimitIfTouched => {
                        let trigger_price = order.trigger_price().ok_or_else(|| {
                            anyhow::anyhow!("Take profit limit order missing trigger_price")

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Set trigger_price when creating the MarketIfTouched order
  2. Validate trigger_price is present before submit
  3. Remember the mapping: Nautilus MarketIfTouched == dYdX TakeProfitMarket, both need a trigger

Example fix

// before
let order = factory.market_if_touched(id, side, qty, None); // trigger missing
// after
let order = factory.market_if_touched(id, side, qty, Some(trigger_price));
Defensive patterns

Strategy: validation

Validate before calling

if order.order_type() == OrderType::MarketIfTouched && order.trigger_price().is_none() {
    return Err("MarketIfTouched (dYdX take-profit market) requires a trigger_price".into());
}

Type guard

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

Try / catch

if let Err(e) = client.submit_order(order).await {
    if e.to_string().contains("missing trigger_price") {
        // repair the order construction; retry is futile
    }
}

Prevention

When it happens

Trigger: Submitting a MarketIfTouched order whose trigger_price was never set (factory call omitted trigger_price, or a plain market order repurposed as MIT).

Common situations: order_factory.market_if_touched call missing trigger_price; strategy computing the trigger conditionally and passing None; orders deserialized without the trigger field.

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