{"record":{"id":"756caceb4e1a97e1","repo":"nautechsystems/nautilus_trader","slug":"day-time-in-force-is-not-supported-by-hyperliquid","errorCode":null,"errorMessage":"DAY time in force is not supported by Hyperliquid","messagePattern":"DAY time in force is not supported by Hyperliquid","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/hyperliquid/src/common/converters.rs","lineNumber":256,"sourceCode":"/// Converts a Nautilus `TimeInForce` to a Hyperliquid time in force.\n///\n/// # Errors\n///\n/// Returns an error if the time in force is not supported (e.g. FOK).\npub fn nautilus_time_in_force_to_hyperliquid(\n    tif: TimeInForce,\n) -> anyhow::Result<HyperliquidTimeInForce> {\n    match tif {\n        TimeInForce::Gtc => Ok(HyperliquidTimeInForce::Gtc),\n        TimeInForce::Ioc => Ok(HyperliquidTimeInForce::Ioc),\n        TimeInForce::Fok => {\n            anyhow::bail!(\"FOK time in force is not supported by Hyperliquid\")\n        }\n        TimeInForce::Gtd => {\n            anyhow::bail!(\"GTD time in force is not supported by Hyperliquid\")\n        }\n        TimeInForce::Day => {\n            anyhow::bail!(\"DAY time in force is not supported by Hyperliquid\")\n        }\n        TimeInForce::AtTheOpen => {\n            anyhow::bail!(\"AT_THE_OPEN time in force is not supported by Hyperliquid\")\n        }\n        TimeInForce::AtTheClose => {\n            anyhow::bail!(\"AT_THE_CLOSE time in force is not supported by Hyperliquid\")\n        }\n    }\n}\n\n/// Converts a Hyperliquid time in force to a Nautilus `TimeInForce`.\npub fn hyperliquid_time_in_force_to_nautilus(hl_tif: HyperliquidTimeInForce) -> TimeInForce {\n    match hl_tif {\n        HyperliquidTimeInForce::Gtc => TimeInForce::Gtc,\n        HyperliquidTimeInForce::Ioc\n        | HyperliquidTimeInForce::FrontendMarket\n        | HyperliquidTimeInForce::LiquidationMarket => TimeInForce::Ioc,\n        HyperliquidTimeInForce::Alo => TimeInForce::Gtc,","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/hyperliquid/src/common/converters.rs#L238-L274","documentation":"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.","triggerScenarios":"Converting a Nautilus order with TimeInForce::Day via nautilus_time_in_force_to_hyperliquid when routing to Hyperliquid.","commonSituations":"Equities-style strategies using DAY orders by default; configs shared across equities and crypto venues.","solutions":["Use GTC for Hyperliquid (crypto venues are effectively always-on, so DAY adds little).","Cancel the order at your session close to emulate DAY behavior.","Set venue-appropriate defaults per venue instead of a shared TimeInForce."],"exampleFix":"// before\nlet tif = TimeInForce::Day;\n// after\nlet tif = TimeInForce::Gtc; // Hyperliquid-supported","handlingStrategy":"validation","validationCode":"fn hyperliquid_tif_ok(tif: TimeInForce) -> bool {\n    matches!(tif, TimeInForce::Gtc | TimeInForce::Ioc)\n}\nif !hyperliquid_tif_ok(tif) { tif = TimeInForce::Gtc; }","typeGuard":null,"tryCatchPattern":"let hl_tif = nautilus_time_in_force_to_hyperliquid(tif)\n    .map_err(|e| { log::warn!(\"{e}; defaulting to GTC\"); HyperliquidTimeInForce::Gtc })?;","preventionTips":["Default crypto venue orders to GTC.","Cancel at session close yourself if DAY semantics are needed.","Avoid sharing equity-style TIF defaults with crypto venues."],"tags":["hyperliquid","time-in-force","rust","order-routing"],"backgroundTag":"unsupported-enum-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}