nautechsystems/nautilus_trader · error
{:?} orders require a trigger_price
Error message
{:?} orders require a trigger_price What it means
StopMarket and MarketIfTouched orders are conditional on a trigger price, which the adapter uses to derive the market price ticks for Lighter. The order was created without a trigger_price, so it cannot be translated to a Lighter conditional order.
Source
Thrown at crates/adapters/lighter/src/execution.rs:1636
.core
.cache()
.quote(&instrument_id)
.copied()
.ok_or_else(|| {
anyhow::anyhow!(
"no cached quote for {instrument_id}: subscribe to quotes before submitting MARKET orders",
)
})?;
let base = if is_buy {
quote.ask_price.as_decimal()
} else {
quote.bid_price.as_decimal()
};
derive_market_order_price_ticks(base, is_buy, price_precision, slippage_bps)?
}
OrderType::StopMarket | OrderType::MarketIfTouched => {
let trigger = order.trigger_price().ok_or_else(|| {
anyhow::anyhow!("{:?} orders require a trigger_price", order.order_type(),)
})?;
derive_market_order_price_ticks(
trigger.as_decimal(),
is_buy,
price_precision,
slippage_bps,
)?
}
_ => order
.price()
.map(|p| price_to_ticks(&p, price_precision))
.transpose()?
.unwrap_or(0),
};
let trigger_price_ticks = order
.trigger_price()
.map(|p| price_to_ticks(&p, price_precision))View on GitHub (pinned to 18893faf8b)
Solutions
- Set trigger_price when constructing StopMarket/MarketIfTouched orders via the OrderFactory.
- Validate order fields before submission in the strategy layer.
- Refactor order-construction helpers to require trigger parameters for trigger-based order types.
- If the intent was a plain market order, change the order type instead.
Example fix
// before
let order = order_factory.market_if_touched(instrument_id, Side::Sell, qty); // no trigger
// after
let order = order_factory.market_if_touched(
instrument_id,
Side::Sell,
qty,
Price::from("2500.00"), // trigger_price
); Defensive patterns
Strategy: validation
Validate before calling
// Rust
anyhow::ensure!(
!matches!(order_type, OrderType::StopMarket | OrderType::MarketIfTouched) || trigger_price.is_some(),
"{order_type:?} requires a trigger_price"
); Try / catch
if let Err(e) = adapter.submit_order(order) {
if e.to_string().contains("require a trigger_price") {
log::error!("order factory call missing trigger_price for {:?}", order.order_type());
}
return Err(e);
} Prevention
- Use type-safe OrderFactory methods that require trigger params for trigger order types
- Centralize order construction so trigger fields cannot be omitted
- Unit-test order builders for each OrderType
When it happens
Trigger: submit_order/submit_order_list with OrderType::StopMarket or OrderType::MarketIfTouched where order.trigger_price() returns None (factory call omitted trigger_price).
Common situations: Using a market-order factory method that doesn't set trigger_price; copying order-construction code between order types; strategy logic building stop orders dynamically and skipping the trigger.
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/ebb4e63e369239e3.
Report an issue: GitHub.