{"record":{"id":"ebb4e63e369239e3","repo":"nautechsystems/nautilus_trader","slug":"orders-require-a-trigger-price","errorCode":null,"errorMessage":"{:?} orders require a trigger_price","messagePattern":"(.+?) orders require a trigger_price","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/execution.rs","lineNumber":1636,"sourceCode":"                    .core\n                    .cache()\n                    .quote(&instrument_id)\n                    .copied()\n                    .ok_or_else(|| {\n                        anyhow::anyhow!(\n                            \"no cached quote for {instrument_id}: subscribe to quotes before submitting MARKET orders\",\n                        )\n                    })?;\n                let base = if is_buy {\n                    quote.ask_price.as_decimal()\n                } else {\n                    quote.bid_price.as_decimal()\n                };\n                derive_market_order_price_ticks(base, is_buy, price_precision, slippage_bps)?\n            }\n            OrderType::StopMarket | OrderType::MarketIfTouched => {\n                let trigger = order.trigger_price().ok_or_else(|| {\n                    anyhow::anyhow!(\"{:?} orders require a trigger_price\", order.order_type(),)\n                })?;\n                derive_market_order_price_ticks(\n                    trigger.as_decimal(),\n                    is_buy,\n                    price_precision,\n                    slippage_bps,\n                )?\n            }\n            _ => order\n                .price()\n                .map(|p| price_to_ticks(&p, price_precision))\n                .transpose()?\n                .unwrap_or(0),\n        };\n\n        let trigger_price_ticks = order\n            .trigger_price()\n            .map(|p| price_to_ticks(&p, price_precision))","sourceCodeStart":1618,"sourceCodeEnd":1654,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/execution.rs#L1618-L1654","documentation":"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.","triggerScenarios":"submit_order/submit_order_list with OrderType::StopMarket or OrderType::MarketIfTouched where order.trigger_price() returns None (factory call omitted trigger_price).","commonSituations":"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.","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."],"exampleFix":"// before\nlet order = order_factory.market_if_touched(instrument_id, Side::Sell, qty); // no trigger\n// after\nlet order = order_factory.market_if_touched(\n    instrument_id,\n    Side::Sell,\n    qty,\n    Price::from(\"2500.00\"), // trigger_price\n);","handlingStrategy":"validation","validationCode":"// Rust\nanyhow::ensure!(\n    !matches!(order_type, OrderType::StopMarket | OrderType::MarketIfTouched) || trigger_price.is_some(),\n    \"{order_type:?} requires a trigger_price\"\n);","typeGuard":null,"tryCatchPattern":"if let Err(e) = adapter.submit_order(order) {\n    if e.to_string().contains(\"require a trigger_price\") {\n        log::error!(\"order factory call missing trigger_price for {:?}\", order.order_type());\n    }\n    return Err(e);\n}","preventionTips":["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"],"tags":["validation","orders","missing-field","trading"],"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-14T00:17:10.932Z"}