nautechsystems/nautilus_trader · error

Conditional orders require a trigger price

Error message

Conditional orders require a trigger price

What it means

`build_new_order_params` determines whether the mapped Binance Spot order type is conditional (StopLoss, StopLimit, MarketIfTouched, LimitIfTouched / stop-loss variants) and bails if the order carries no trigger price, since Binance requires stopPrice for these order types.

Solutions

  1. Set a trigger_price on the order before submission (e.g. via order_factory.stop_limit(..., trigger_price=...))
  2. Validate order.trigger_price().is_some() for conditional types in the strategy before submit
  3. If a plain limit/market order was intended, change the order type instead of leaving a conditional type without a trigger

Example fix

// before
let order = order_factory.stop_limit(
    instrument_id, Side::Sell, qty, price,
    TimeInForce::Gtc, None, None, // no trigger
);
// after
let order = order_factory.stop_limit(
    instrument_id, Side::Sell, qty, price,
    TimeInForce::Gtc, None, Some(trigger_price),
);
Defensive patterns

Strategy: validation

Validate before calling

fn conditional_needs_trigger(order: &OrderAny) -> bool {
    matches!(order.order_type(), OrderType::StopMarket | OrderType::StopLimit | OrderType::MarketIfTouched | OrderType::LimitIfTouched)
        && order.trigger_price().is_none()
}

Prevention

When it happens

Trigger: Submitting (via `submit_order_internal`) or building a spot OCO (`build_spot_oco_order_list_params`) with an order of type StopMarket, StopLimit, MarketIfTouched, or LimitIfTouched whose `trigger_price()` is None.

Common situations: Constructing stop orders with a factory that leaves trigger_price unset; porting strategy code from venues that derive the trigger from price; forgetting to set the trigger when converting a plain limit order into a stop-limit.

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

Appendix: source

Thrown at crates/adapters/binance/src/spot/execution.rs:2730

    order: &impl Order,
    client_order_id: ClientOrderId,
    is_post_only: bool,
    is_quote_quantity: bool,
    use_gtd: bool,
) -> anyhow::Result<NewOrderParams> {
    let binance_side = BinanceSide::try_from(order.order_side())?;
    let binance_order_type = order_type_to_binance_spot(order.order_type(), is_post_only)?;

    let requires_trigger = matches!(
        order.order_type(),
        OrderType::StopMarket
            | OrderType::StopLimit
            | OrderType::MarketIfTouched
            | OrderType::LimitIfTouched
    );

    if requires_trigger && order.trigger_price().is_none() {
        anyhow::bail!("Conditional orders require a trigger price");
    }

    let supports_tif = matches!(
        binance_order_type,
        BinanceSpotOrderType::Limit
            | BinanceSpotOrderType::StopLossLimit
            | BinanceSpotOrderType::TakeProfitLimit
    );
    let binance_tif = time_in_force_to_binance_spot(order.time_in_force(), use_gtd)?;
    let binance_tif = if supports_tif {
        Some(binance_tif)
    } else {
        None
    };

    let qty_str = order.quantity().to_string();
    let (base_qty, quote_qty) = if is_quote_quantity {
        (None, Some(qty_str))

View on GitHub (pinned to 18893faf8b)