nautechsystems/nautilus_trader · error · anyhow::Error

Conditional order missing is_market flag

Error message

Conditional order missing is_market flag

What it means

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.

Source

Thrown at crates/adapters/hyperliquid/src/common/parse.rs:900

///
/// `Ok(())` if parameters are valid, `Err` with description otherwise.
pub fn validate_conditional_order_params(
    trigger_px: Option<&str>,
    tpsl: Option<&HyperliquidTpSl>,
    is_market: Option<bool>,
) -> anyhow::Result<()> {
    if trigger_px.is_none() {
        anyhow::bail!("Conditional order missing trigger price");
    }

    if tpsl.is_none() {
        anyhow::bail!("Conditional order missing tpsl indicator");
    }

    // No need to validate tpsl value - the enum type guarantees it's either Tp or Sl

    if is_market.is_none() {
        anyhow::bail!("Conditional order missing is_market flag");
    }

    Ok(())
}

/// Parses trigger price from string to Decimal.
///
/// # Returns
///
/// Parsed Decimal value or error.
pub fn parse_trigger_price(trigger_px: &str) -> anyhow::Result<Decimal> {
    Decimal::from_str_exact(trigger_px)
        .with_context(|| format!("Failed to parse trigger price: {trigger_px}"))
}

/// Parses Hyperliquid clearinghouse state into Nautilus account balances and margins.
///
/// Uses the same field selection as the HTTP account-state path

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Pass Some(true) for market-style triggers (MarketIfTouched) or Some(false) for limit-style triggers (LimitIfTouched).
  2. Derive is_market from the Nautilus order type in the mapping code instead of passing an Option through.
  3. Construct conditional requests via the adapter's typed request structs rather than hand-built raw params.

Example fix

// before
validate_conditional_order_params(Some(trigger_px), Some(&tpsl), None)?;
// after
validate_conditional_order_params(Some(trigger_px), Some(&tpsl), Some(true))?;
Defensive patterns

Strategy: validation

Validate before calling

let is_market = Some(matches!(order_type, OrderType::MarketIfTouched));
validate_conditional_order_params(trigger_px, Some(&tpsl), is_market)?;

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/ab6264134b976a12. Report an issue: GitHub.