{"record":{"id":"d96e9d3a51ba92cf","repo":"nautechsystems/nautilus_trader","slug":"stop-sell-trigger-price-trigger-price-must-be","errorCode":null,"errorMessage":"Stop sell trigger_price ({trigger_price}) must be <= limit price ({price})","messagePattern":"Stop sell trigger_price \\((.+?)\\) must be <= limit price \\((.+?)\\)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/dydx/src/http/parse.rs","lineNumber":255,"sourceCode":"    if !order_type.is_conditional() {\n        return Ok(());\n    }\n\n    let trigger_price = trigger_price\n        .ok_or_else(|| anyhow::anyhow!(\"trigger_price required for {order_type:?}\"))?;\n\n    // Validate trigger price relative to limit price\n    match order_type {\n        DydxOrderType::StopLimit | DydxOrderType::StopMarket => {\n            // Stop orders: trigger when price falls (sell) or rises (buy)\n            match side {\n                OrderSide::Buy if trigger_price < price => {\n                    anyhow::bail!(\n                        \"Stop buy trigger_price ({trigger_price}) must be >= limit price ({price})\"\n                    );\n                }\n                OrderSide::Sell if trigger_price > price => {\n                    anyhow::bail!(\n                        \"Stop sell trigger_price ({trigger_price}) must be <= limit price ({price})\"\n                    );\n                }\n                _ => {}\n            }\n        }\n        DydxOrderType::TakeProfitLimit | DydxOrderType::TakeProfitMarket => {\n            // Take profit: trigger when price rises (sell) or falls (buy)\n            match side {\n                OrderSide::Buy if trigger_price > price => {\n                    anyhow::bail!(\n                        \"Take profit buy trigger_price ({trigger_price}) must be <= limit price ({price})\"\n                    );\n                }\n                OrderSide::Sell if trigger_price < price => {\n                    anyhow::bail!(\n                        \"Take profit sell trigger_price ({trigger_price}) must be >= limit price ({price})\"\n                    );","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/dydx/src/http/parse.rs#L237-L273","documentation":"For dYdX stop orders (StopLimit/StopMarket) on the sell side, the trigger price must be at or below the limit/price — a sell stop triggers on downward movement. `validate_conditional_order` throws this error when `trigger_price > price` for a sell stop order.","triggerScenarios":"Calling `validate_conditional_order` via order submission with a StopLimit or StopMarket sell order whose trigger price is above the limit price, e.g. trigger 60_000 with price 50_000.","commonSituations":"Reusing buy-side stop parameters for a sell order; misreading trigger-vs-limit price semantics; automated strategies generating inverted stop levels.","solutions":["Lower the trigger price so it is <= the limit price for sell stop orders","Swap the order side if an upward-triggering order was intended (use Buy)","Verify price/trigger argument order at the call site"],"exampleFix":"// before\nvalidate_conditional_order(DydxOrderType::StopLimit, OrderSide::Sell, price_50k, trigger_60k)?;\n// after\nvalidate_conditional_order(DydxOrderType::StopLimit, OrderSide::Sell, price_50k, trigger_45k)?;","handlingStrategy":"validation","validationCode":"fn valid_stop_sell(price: f64, trigger: f64) -> bool { trigger <= price }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Compute trigger prices from strategy logic with side-aware assertions","Log the intended trigger direction when constructing stop orders"],"tags":["rust","dydx","orders","validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}