{"record":{"id":"ded7eeca509edb72","repo":"nautechsystems/nautilus_trader","slug":"take-profit-limit-order-missing-trigger-price","errorCode":null,"errorMessage":"Take profit limit order missing trigger_price","messagePattern":"Take profit limit order missing trigger_price","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/dydx/src/execution/mod.rs","lineNumber":1527,"sourceCode":"                            anyhow::anyhow!(\"Take profit market order missing trigger_price\")\n                        })?;\n                        let cond_expire = order.expire_time().map(nanos_to_secs_i64);\n                        let msg = order_builder.build_take_profit_market_order(\n                            instrument_id,\n                            client_id_u32,\n                            client_metadata,\n                            order.order_side(),\n                            trigger_price,\n                            order.quantity(),\n                            order.is_reduce_only(),\n                            cond_expire,\n                        )?;\n                        (msg, \"take_profit_market\")\n                    }\n                    // dYdX TakeProfitLimit maps to Nautilus LimitIfTouched\n                    OrderType::LimitIfTouched => {\n                        let trigger_price = order.trigger_price().ok_or_else(|| {\n                            anyhow::anyhow!(\"Take profit limit order missing trigger_price\")\n                        })?;\n                        let limit_price = order.price().ok_or_else(|| {\n                            anyhow::anyhow!(\"Take profit limit order missing limit price\")\n                        })?;\n                        let cond_expire = order.expire_time().map(nanos_to_secs_i64);\n                        let msg = order_builder.build_take_profit_limit_order(\n                            instrument_id,\n                            client_id_u32,\n                            client_metadata,\n                            order.order_side(),\n                            trigger_price,\n                            limit_price,\n                            order.quantity(),\n                            order.time_in_force(),\n                            order.is_post_only(),\n                            order.is_reduce_only(),\n                            cond_expire,\n                        )?;","sourceCodeStart":1509,"sourceCodeEnd":1545,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/dydx/src/execution/mod.rs#L1509-L1545","documentation":"Nautilus LimitIfTouched orders map to dYdX TAKE_PROFIT_LIMIT conditional orders, which require both a trigger_price and a limit price. The client checks order.trigger_price() first and throws this error when it is None.","triggerScenarios":"Submitting a LimitIfTouched order whose trigger_price was never set (factory call omitted it, or a plain limit order converted to LIT).","commonSituations":"order_factory.limit_if_touched call missing trigger_price; migrating from Limit to LimitIfTouched without adding the trigger; strategy supplying only the limit price.","solutions":["Pass trigger_price to the limit_if_touched factory call","Validate trigger_price and price are both present before submit","Use plain Limit if no trigger condition is intended"],"exampleFix":"// before\nlet order = factory.limit_if_touched(id, side, qty, price, None); // trigger missing\n// after\nlet order = factory.limit_if_touched(id, side, qty, price, Some(trigger_price));","handlingStrategy":"validation","validationCode":"if order.order_type() == OrderType::LimitIfTouched {\n    if order.trigger_price().is_none() {\n        return Err(\"LimitIfTouched (dYdX take-profit limit) requires a trigger_price\".into());\n    }\n    if order.price().is_none() {\n        return Err(\"LimitIfTouched (dYdX take-profit limit) requires a limit price\".into());\n    }\n}","typeGuard":"fn limit_if_touched_complete(order: &OrderAny) -> bool {\n    order.trigger_price().is_some() && order.price().is_some()\n}","tryCatchPattern":"if let Err(e) = client.submit_order(order).await {\n    if e.to_string().contains(\"Take profit limit order missing\") {\n        // rebuild with trigger and limit prices\n    }\n}","preventionTips":["Pass both trigger_price and price to limit_if_touched factory calls","Use a shared pre-submit validator for all dYdX-supported order types","Keep unit tests asserting required fields for Limit/Stop/IfTouched variants"],"tags":["rust","orders","conditional-orders","dydx"],"backgroundTag":"missing-required-argument","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}