{"record":{"id":"55aa55f5306a3843","repo":"nautechsystems/nautilus_trader","slug":"conditional-order-type-order-type-requires-tri","errorCode":null,"errorMessage":"Conditional order type {order_type:?} requires trigger_price for Kraken WS batch","messagePattern":"Conditional order type (.+?) requires trigger_price for Kraken WS batch","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/kraken/src/execution/spot.rs","lineNumber":1063,"sourceCode":"    let trigger = if is_conditional {\n        let trigger_ref = match order.trigger_type() {\n            Some(TriggerType::IndexPrice) => KrakenSpotTrigger::Index,\n            Some(TriggerType::LastPrice | TriggerType::Default) | None => KrakenSpotTrigger::Last,\n            Some(other) => anyhow::bail!(\n                \"Unsupported trigger type for Kraken Spot WS batch: {other:?} (only LastPrice and IndexPrice supported)\",\n            ),\n        };\n        order.trigger_price().map(|tp| KrakenWsTriggerParams {\n            reference: trigger_ref,\n            price: tp.as_decimal(),\n            price_type: None,\n        })\n    } else {\n        None\n    };\n\n    if is_conditional && trigger.is_none() {\n        anyhow::bail!(\n            \"Conditional order type {order_type:?} requires trigger_price for Kraken WS batch\",\n        );\n    }\n\n    Ok(KrakenWsBatchAddOrder {\n        order_type: kraken_order_type,\n        side,\n        order_qty: order.quantity().as_decimal(),\n        limit_price: order.price().map(|p| p.as_decimal()),\n        cl_ord_id: Some(truncate_cl_ord_id(&order.client_order_id())),\n        time_in_force: ws_tif,\n        expire_time,\n        post_only: order.is_post_only().then_some(true),\n        reduce_only: order.is_reduce_only().then_some(true),\n        leverage,\n        trigger,\n    })\n}","sourceCodeStart":1045,"sourceCodeEnd":1081,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/kraken/src/execution/spot.rs#L1045-L1081","documentation":"Conditional Kraken Spot WS batch orders (stop/take-profit variants) must carry a trigger price. If, after building trigger parameters, trigger is None — i.e. the order is conditional but order.trigger_price() is None — build_batch_order bails with this error rather than sending an invalid batch message.","triggerScenarios":"Calling batch_add_via_ws with an OrderType such as StopMarket/StopLimit where no trigger price was set on the order.","commonSituations":"Copy-pasting a plain limit order construction and changing only the order type without adding trigger_price; orders deserialized from config where trigger fields were omitted.","solutions":["Set trigger_price on the order before batch submission.","Guard with order.trigger_price().is_some() for conditional order types prior to calling batch_add_via_ws.","Use a non-conditional order type (Limit/Market) if no trigger is desired."],"exampleFix":"// before\nOrderBuilder::stop_limit(instrument_id, side, qty).limit_price(lp).build()\n// after\nOrderBuilder::stop_limit(instrument_id, side, qty)\n    .trigger_price(Price::from(\"26500.00\"))\n    .limit_price(lp)\n    .build()","handlingStrategy":"validation","validationCode":"fn conditional_has_trigger(t: OrderType, tp: Option<Price>) -> bool {\n    let conditional = matches!(t, OrderType::StopMarket | OrderType::StopLimit | OrderType::MarketIfTouched | OrderType::LimitIfTouched);\n    !conditional || tp.is_some()\n}","typeGuard":"fn has_trigger_price(order: &OrderAny) -> bool { order.trigger_price().is_some() }","tryCatchPattern":null,"preventionTips":["Set trigger_price whenever using stop/take-profit order types.","Validate orders at the factory level before queuing for batch submission.","Avoid hand-editing order configs; use builders that enforce trigger prices."],"tags":["kraken","orders","validation","trigger"],"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"}