nautechsystems/nautilus_trader · error · anyhow::Error
Stop buy trigger_price ({trigger_price}) must be >= limit pr
Error message
Stop buy trigger_price ({trigger_price}) must be >= limit price ({price}) What it means
For dYdX stop orders (StopLimit/StopMarket) on the buy side, the trigger price must be at or above the limit/order price — a buy stop triggers on upward movement. `validate_conditional_order` throws this error when `trigger_price < price` for a buy stop order.
Source
Thrown at crates/adapters/dydx/src/http/parse.rs:250
order_type: DydxOrderType,
trigger_price: Option<Decimal>,
price: Decimal,
side: OrderSide,
) -> anyhow::Result<()> {
if !order_type.is_conditional() {
return Ok(());
}
let trigger_price = trigger_price
.ok_or_else(|| anyhow::anyhow!("trigger_price required for {order_type:?}"))?;
// Validate trigger price relative to limit price
match order_type {
DydxOrderType::StopLimit | DydxOrderType::StopMarket => {
// Stop orders: trigger when price falls (sell) or rises (buy)
match side {
OrderSide::Buy if trigger_price < price => {
anyhow::bail!(
"Stop buy trigger_price ({trigger_price}) must be >= limit price ({price})"
);
}
OrderSide::Sell if trigger_price > price => {
anyhow::bail!(
"Stop sell trigger_price ({trigger_price}) must be <= limit price ({price})"
);
}
_ => {}
}
}
DydxOrderType::TakeProfitLimit | DydxOrderType::TakeProfitMarket => {
// Take profit: trigger when price rises (sell) or falls (buy)
match side {
OrderSide::Buy if trigger_price > price => {
anyhow::bail!(
"Take profit buy trigger_price ({trigger_price}) must be <= limit price ({price})"
);View on GitHub (pinned to 18893faf8b)
Solutions
- Raise the trigger price so it is >= the limit price for buy stop orders
- Swap the order side if a downward-triggering order was intended (use Sell)
- Re-check the ordering of `price` and `trigger_price` arguments at the call site
Example fix
// before validate_conditional_order(DydxOrderType::StopLimit, OrderSide::Buy, price_50k, trigger_40k)?; // after validate_conditional_order(DydxOrderType::StopLimit, OrderSide::Buy, price_50k, trigger_55k)?;
Defensive patterns
Strategy: validation
Validate before calling
fn valid_stop_buy(price: f64, trigger: f64) -> bool { trigger >= price } Prevention
- Unit-test conditional order builders for both sides with boundary trigger prices
- Document trigger-direction rules for stop vs take-profit per side
When it happens
Trigger: Calling `validate_conditional_order` (via order submission) with a StopLimit or StopMarket buy order whose trigger price is below the limit price, e.g. trigger 40_000 with limit price 50_000.
Common situations: Confusing stop-buy semantics with stop-sell semantics; building conditional orders with swapped price arguments; porting logic from venues with different stop conventions.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Stop sell trigger_price ({trigger_price}) must be <= limit p
- Take profit buy trigger_price ({trigger_price}) must be <= l
- Limit order missing price
- trigger_price required for {order_type:?}
- {FAILED}: {e}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/9c43455144a0a5b4.
Report an issue: GitHub.