nautechsystems/nautilus_trader · error

Unsupported OrderType for conditional orders: {value:?}

Error message

Unsupported OrderType for conditional orders: {value:?}

What it means

This From<OrderType> conversion maps nautilus OrderType values to Hyperliquid conditional (trigger) order types. Variants without a Hyperliquid conditional equivalent (e.g. Market, Limit, or other non-trigger types) fall into a catch-all that panics. It means you passed an order type that cannot be expressed as a Hyperliquid conditional order.

Source

Thrown at crates/adapters/hyperliquid/src/common/enums.rs:312

            HyperliquidConditionalOrderType::StopLimit => Self::StopLimit,
            HyperliquidConditionalOrderType::TakeProfitMarket => Self::MarketIfTouched,
            HyperliquidConditionalOrderType::TakeProfitLimit => Self::LimitIfTouched,
            HyperliquidConditionalOrderType::TrailingStopMarket => Self::TrailingStopMarket,
            HyperliquidConditionalOrderType::TrailingStopLimit => Self::TrailingStopLimit,
        }
    }
}

impl From<OrderType> for HyperliquidConditionalOrderType {
    fn from(value: OrderType) -> Self {
        match value {
            OrderType::StopMarket => Self::StopMarket,
            OrderType::StopLimit => Self::StopLimit,
            OrderType::MarketIfTouched => Self::TakeProfitMarket,
            OrderType::LimitIfTouched => Self::TakeProfitLimit,
            OrderType::TrailingStopMarket => Self::TrailingStopMarket,
            OrderType::TrailingStopLimit => Self::TrailingStopLimit,
            _ => panic!("Unsupported OrderType for conditional orders: {value:?}"),
        }
    }
}

/// Represents trailing offset types for trailing stop orders.
///
/// Trailing stops adjust dynamically based on market movement:
/// - Price: Fixed price offset (e.g., $100)
/// - Percentage: Percentage offset (e.g., 5%)
/// - BasisPoints: Basis points offset (e.g., 250 bps = 2.5%)
#[derive(
    Copy,
    Clone,
    Debug,
    Display,
    PartialEq,
    Eq,
    Hash,

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Only pass conditional-capable OrderTypes (StopMarket, StopLimit, MarketIfTouched, LimitIfTouched, TrailingStop*) through this conversion
  2. Route Market/Limit orders through the standard (non-conditional) Hyperliquid order submission path
  3. Extend the match with a mapping if Hyperliquid added support for the missing type
  4. Pre-validate the OrderType before calling the conversion and reject unsupported values cleanly

Example fix

// before
let hl_type = OKXHyperliquidConditionalType::from(OrderType::Market);
// after
assert!(matches!(order_type, OrderType::StopMarket | OrderType::StopLimit | ...));
let hl_type = ConditionalType::from(order_type);
Defensive patterns

Strategy: validation

Validate before calling

const CONDITIONAL: &[OrderType] = &[
    OrderType::StopMarket, OrderType::StopLimit,
    OrderType::MarketIfTouched, OrderType::LimitIfTouched,
    OrderType::TrailingStopMarket, OrderType::TrailingStopLimit,
];
fn is_conditional(t: &OrderType) -> bool { CONDITIONAL.contains(t) }

Type guard

fn supports_conditional(t: &OrderType) -> bool {
    !matches!(t, OrderType::Market | OrderType::Limit)
}

Prevention

When it happens

Trigger: Converting an OrderType such as OrderType::Market or OrderType::Limit into the Hyperliquid conditional enum (e.g. while submitting a trigger/conditional order request) with a variant not listed in the match arms.

Common situations: Strategy code submits conditional orders but builds the order type dynamically from a config or signal; a new OrderType variant was added to the core enum but not mapped in the Hyperliquid adapter; order routing sends non-conditional orders down the conditional-order path.

Related errors


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