{"record":{"id":"ab6264134b976a12","repo":"nautechsystems/nautilus_trader","slug":"conditional-order-missing-is-market-flag","errorCode":null,"errorMessage":"Conditional order missing is_market flag","messagePattern":"Conditional order missing is_market flag","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/hyperliquid/src/common/parse.rs","lineNumber":900,"sourceCode":"///\n/// `Ok(())` if parameters are valid, `Err` with description otherwise.\npub fn validate_conditional_order_params(\n    trigger_px: Option<&str>,\n    tpsl: Option<&HyperliquidTpSl>,\n    is_market: Option<bool>,\n) -> anyhow::Result<()> {\n    if trigger_px.is_none() {\n        anyhow::bail!(\"Conditional order missing trigger price\");\n    }\n\n    if tpsl.is_none() {\n        anyhow::bail!(\"Conditional order missing tpsl indicator\");\n    }\n\n    // No need to validate tpsl value - the enum type guarantees it's either Tp or Sl\n\n    if is_market.is_none() {\n        anyhow::bail!(\"Conditional order missing is_market flag\");\n    }\n\n    Ok(())\n}\n\n/// Parses trigger price from string to Decimal.\n///\n/// # Returns\n///\n/// Parsed Decimal value or error.\npub fn parse_trigger_price(trigger_px: &str) -> anyhow::Result<Decimal> {\n    Decimal::from_str_exact(trigger_px)\n        .with_context(|| format!(\"Failed to parse trigger price: {trigger_px}\"))\n}\n\n/// Parses Hyperliquid clearinghouse state into Nautilus account balances and margins.\n///\n/// Uses the same field selection as the HTTP account-state path","sourceCodeStart":882,"sourceCodeEnd":918,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/hyperliquid/src/common/parse.rs#L882-L918","documentation":"validate_conditional_order_params requires is_market to be present because Hyperliquid trigger requests encode whether the triggered order executes as a market or a limit order. A None is_market leaves the request under-specified, so validation fails before the order is sent.","triggerScenarios":"Calling validate_conditional_order_params with is_market: None — typically when assembling the conditional request fields from optional parsed values and the is_market flag was never populated.","commonSituations":"Mapping a Nautilus order type to Hyperliquid's is_market flag and missing the MarketIfTouched→true / LimitIfTouched→false conversion; constructing raw JSON exchange requests by hand with omitted fields.","solutions":["Pass Some(true) for market-style triggers (MarketIfTouched) or Some(false) for limit-style triggers (LimitIfTouched).","Derive is_market from the Nautilus order type in the mapping code instead of passing an Option through.","Construct conditional requests via the adapter's typed request structs rather than hand-built raw params."],"exampleFix":"// before\nvalidate_conditional_order_params(Some(trigger_px), Some(&tpsl), None)?;\n// after\nvalidate_conditional_order_params(Some(trigger_px), Some(&tpsl), Some(true))?;","handlingStrategy":"validation","validationCode":"let is_market = Some(matches!(order_type, OrderType::MarketIfTouched));\nvalidate_conditional_order_params(trigger_px, Some(&tpsl), is_market)?;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Derive is_market directly from the order type at the mapping boundary.","Never construct conditional requests from raw optional fields by hand.","Validate all three conditional fields together before calling the venue layer."],"tags":["conditional-order","missing-parameter","hyperliquid","validation"],"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"}