nautechsystems/nautilus_trader · error · anyhow::Error

Stop market orders require a trigger price

Error message

Stop market orders require a trigger price

What it means

StopMarket orders on Hyperliquid are expressed as trigger orders and therefore require a trigger_px; the adapter bails with this message when order.trigger_price() is None for a StopMarket order. Without a trigger price the exchange request cannot be built.

Source

Thrown at crates/adapters/hyperliquid/src/common/parse.rs:575

        }
        OrderType::StopMarket => {
            if let Some(trigger_price) = order.trigger_price() {
                let raw = trigger_price.as_decimal();
                let trigger_price_decimal = if should_normalize_prices {
                    normalize_price(raw, price_decimals).normalize()
                } else {
                    raw.normalize()
                };
                let tpsl = determine_tpsl_type(order_type, order_side, trigger_price_decimal, None);
                HyperliquidExchangeOrderKind::Trigger {
                    trigger: HyperliquidExchangeTriggerParams {
                        is_market: true,
                        trigger_px: trigger_price_decimal,
                        tpsl,
                    },
                }
            } else {
                anyhow::bail!("Stop market orders require a trigger price")
            }
        }
        OrderType::StopLimit => {
            if let Some(trigger_price) = order.trigger_price() {
                let raw = trigger_price.as_decimal();
                let trigger_price_decimal = if should_normalize_prices {
                    normalize_price(raw, price_decimals).normalize()
                } else {
                    raw.normalize()
                };
                let tpsl = determine_tpsl_type(order_type, order_side, trigger_price_decimal, None);
                HyperliquidExchangeOrderKind::Trigger {
                    trigger: HyperliquidExchangeTriggerParams {
                        is_market: false,
                        trigger_px: trigger_price_decimal,
                        tpsl,
                    },
                }

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Provide a trigger price when constructing the StopMarket order (e.g. order_factory.stop_market(..., trigger_price)).
  2. Audit the code path that sets trigger_price — ensure it runs before submission and that the source price was valid, not NaN/None.
  3. Add pre-submit validation that all trigger-type orders carry Some(trigger_price).
  4. If no trigger was intended, submit a plain Market order instead.

Example fix

// before
let order = order_factory.stop_market(instrument_id, side, qty, None); // no trigger
// after
let trigger = Price::from("41000.0");
let order = order_factory.stop_market(instrument_id, side, qty, Some(trigger));
Defensive patterns

Strategy: validation

Validate before calling

if order.order_type() == OrderType::StopMarket && order.trigger_price().is_none() {
    return Err(anyhow::anyhow!("stop market {} missing trigger price", order.client_order_id()));
}

Prevention

When it happens

Trigger: Submitting or modifying a StopMarket order via submit_order, submit_orders, order_request, or modify_order where the order was created without a trigger price (order_factory.market(...).to_stop... style construction that skipped the trigger), e.g. risk-module stop generation with an unset trigger.

Common situations: Stop orders created from templates where the trigger is attached in a later step that never ran; risk-management code deriving stops from prices that were unavailable (NaN/None) at build time; orders reconstructed from persistence losing the optional 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/f5b194559dd03799. Report an issue: GitHub.