nautechsystems/nautilus_trader · error · anyhow::Error

Limit orders require a limit price for Hyperliquid

Error message

Limit orders require a limit price for Hyperliquid: {order.order_type():?}

What it means

Limit-style orders on Hyperliquid (Limit, StopLimit, LimitIfTouched) must carry a limit price. If order.price() is None for one of these types, the adapter rejects the order with this error naming the order type.

Solutions

  1. Set the price when constructing the Limit/StopLimit/LimitIfTouched order.
  2. Validate in the strategy before submission that price().is_some() for limit-style orders.
  3. Derive the price from the current book/mid if the strategy intends a passive limit.
  4. Fix order-builder helpers so the price parameter is required for limit-style types.

Example fix

// before
let order = factory.limit_if_touched(instrument_id, side, qty, trigger_price); // price missing
exec_client.submit_order(&order).await?;
// after
let order = factory.limit_if_touched(instrument_id, side, qty, limit_price, trigger_price);
exec_client.submit_order(&order).await?;
Defensive patterns

Strategy: validation

Validate before calling

fn has_limit_price(order: &OrderAny) -> bool {
    !matches!(order.order_type(), OrderType::Limit | OrderType::StopLimit
        | OrderType::LimitIfTouched)
        || order.price().is_some()
}

Prevention

When it happens

Trigger: submit_order with OrderType in {Limit, StopLimit, LimitIfTouched} where order.price() is None — the order was constructed without setting its price.

Common situations: Building a limit order via a factory call that omitted the price; converting orders from another venue representation that dropped the price; strategy code that sets only a trigger price for a StopLimit and forgets the limit price.

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/eaca8e4c61bfc327. Report an issue: GitHub.

Appendix: source

Thrown at crates/adapters/hyperliquid/src/execution.rs:2753

        order.order_type(),
        OrderType::StopMarket
            | OrderType::StopLimit
            | OrderType::MarketIfTouched
            | OrderType::LimitIfTouched
    ) && order.trigger_price().is_none()
    {
        anyhow::bail!(
            "Conditional orders require a trigger price for Hyperliquid: {:?}",
            order.order_type()
        );
    }

    if matches!(
        order.order_type(),
        OrderType::Limit | OrderType::StopLimit | OrderType::LimitIfTouched
    ) && order.price().is_none()
    {
        anyhow::bail!(
            "Limit orders require a limit price for Hyperliquid: {:?}",
            order.order_type()
        );
    }

    Ok(())
}

fn can_fast_cancel_order(order_type: Option<OrderType>) -> bool {
    matches!(order_type, Some(OrderType::Market | OrderType::Limit))
}

fn cancel_status_count_mismatch_reason(
    label: &str,
    expected_count: usize,
    actual_count: usize,
) -> Option<String> {
    (actual_count != 0 && actual_count != expected_count).then(|| {

View on GitHub (pinned to 18893faf8b)