nautechsystems/nautilus_trader · error · anyhow::Error

GTD time in force is not supported by Hyperliquid

Error message

GTD time in force is not supported by Hyperliquid

What it means

Conversion branch in nautilus_time_in_force_to_hyperliquid: Hyperliquid orders support only GTC and IOC time in force, so a GTD order cannot be represented and conversion fails before order submission.

Source

Thrown at crates/adapters/hyperliquid/src/common/converters.rs:253

    HyperliquidConditionalOrderType::from(order_type)
}

/// Converts a Nautilus `TimeInForce` to a Hyperliquid time in force.
///
/// # Errors
///
/// Returns an error if the time in force is not supported (e.g. FOK).
pub fn nautilus_time_in_force_to_hyperliquid(
    tif: TimeInForce,
) -> anyhow::Result<HyperliquidTimeInForce> {
    match tif {
        TimeInForce::Gtc => Ok(HyperliquidTimeInForce::Gtc),
        TimeInForce::Ioc => Ok(HyperliquidTimeInForce::Ioc),
        TimeInForce::Fok => {
            anyhow::bail!("FOK time in force is not supported by Hyperliquid")
        }
        TimeInForce::Gtd => {
            anyhow::bail!("GTD time in force is not supported by Hyperliquid")
        }
        TimeInForce::Day => {
            anyhow::bail!("DAY time in force is not supported by Hyperliquid")
        }
        TimeInForce::AtTheOpen => {
            anyhow::bail!("AT_THE_OPEN time in force is not supported by Hyperliquid")
        }
        TimeInForce::AtTheClose => {
            anyhow::bail!("AT_THE_CLOSE time in force is not supported by Hyperliquid")
        }
    }
}

/// Converts a Hyperliquid time in force to a Nautilus `TimeInForce`.
pub fn hyperliquid_time_in_force_to_nautilus(hl_tif: HyperliquidTimeInForce) -> TimeInForce {
    match hl_tif {
        HyperliquidTimeInForce::Gtc => TimeInForce::Gtc,
        HyperliquidTimeInForce::Ioc

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Switch the order to GTC and cancel it yourself at the intended expiry time.
  2. Use IOC/GTC depending on desired aggressiveness instead of GTD.
  3. Guard at the strategy layer: if venue is Hyperliquid, translate GTD to GTC plus a scheduled cancel.

Example fix

// before
let order = limit_order(tif: TimeInForce::Gtd, expire: expire_time);
// after
let order = limit_order(tif: TimeInForce::Gtc);
schedule_cancel(order_id, expire_time); // emulate expiry client-side
Defensive patterns

Strategy: fallback

Validate before calling

fn hyperliquid_tif_ok(tif: TimeInForce) -> bool {
    matches!(tif, TimeInForce::Gtc | TimeInForce::Ioc)
}

Try / catch

let hl_tif = nautilus_time_in_force_to_hyperliquid(tif)
    .unwrap_or(HyperliquidTimeInForce::Gtc); // pair with client-side scheduled cancel

Prevention

When it happens

Trigger: Converting a Nautilus order with TimeInForce::Gtd (with an expire time) through nautilus_time_in_force_to_hyperliquid for a Hyperliquid submission.

Common situations: Strategies that schedule order expiry per session/day and are ported to Hyperliquid; GTD defaults set in venue-agnostic config.

Related errors


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