nautechsystems/nautilus_trader · error · anyhow::Error

DAY time in force is not supported by Hyperliquid

Error message

DAY time in force is not supported by Hyperliquid

What it means

nautilus_time_in_force_to_hyperliquid cannot map a Day time-in-force; Hyperliquid's ordering API only accepts GTC, IOC, and (in places) FOK/adapter-supported variants, so a DAY TIF has no Hyperliquid equivalent and the conversion fails.

Source

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

/// 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
        | HyperliquidTimeInForce::FrontendMarket
        | HyperliquidTimeInForce::LiquidationMarket => TimeInForce::Ioc,
        HyperliquidTimeInForce::Alo => TimeInForce::Gtc,

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Use GTC for Hyperliquid (crypto venues are effectively always-on, so DAY adds little).
  2. Cancel the order at your session close to emulate DAY behavior.
  3. Set venue-appropriate defaults per venue instead of a shared TimeInForce.

Example fix

// before
let tif = TimeInForce::Day;
// after
let tif = TimeInForce::Gtc; // Hyperliquid-supported
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

let hl_tif = nautilus_time_in_force_to_hyperliquid(tif)
    .map_err(|e| { log::warn!("{e}; defaulting to GTC"); HyperliquidTimeInForce::Gtc })?;

Prevention

When it happens

Trigger: Converting a Nautilus order with TimeInForce::Day via nautilus_time_in_force_to_hyperliquid when routing to Hyperliquid.

Common situations: Equities-style strategies using DAY orders by default; configs shared across equities and crypto venues.

Related errors


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