{"record":{"id":"31d7edde575c6903","repo":"nautechsystems/nautilus_trader","slug":"fok-time-in-force-is-not-supported-by-hyperliquid-31d7ed","errorCode":null,"errorMessage":"FOK time in force is not supported by Hyperliquid","messagePattern":"FOK 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":250,"sourceCode":"pub fn nautilus_to_hyperliquid_conditional(\n    order_type: OrderType,\n) -> HyperliquidConditionalOrderType {\n    HyperliquidConditionalOrderType::from(order_type)\n}\n\n/// 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 {","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/hyperliquid/src/common/converters.rs#L232-L268","documentation":"Time-in-force conversion guard in nautilus_time_in_force_to_hyperliquid: Hyperliquid orders are either GTC or IOC; a fill-or-kill (FOK) time in force has no Hyperliquid equivalent so the conversion bails.","triggerScenarios":"Converting a Nautilus order with TimeInForce::Fok via nautilus_time_in_force_to_hyperliquid (invoked from nautilus_order_type_to_hyperliquid) when submitting to Hyperliquid.","commonSituations":"Strategies configured with FOK defaults reused across venues; order templates from other exchanges; fixtures in tests exercising all TimeInForce values.","solutions":["Change the order's time in force to GTC or IOC before routing to Hyperliquid.","Emulate FOK client-side: submit IOC and cancel any residual, or pre-check liquidity.","Filter venue capability at order construction so FOK orders are never created for Hyperliquid."],"exampleFix":"// before\nlet order = limit_order(tif: TimeInForce::Fok);\nsubmit_to_hyperliquid(order)?;\n// after\nlet order = limit_order(tif: TimeInForce::Ioc); // Hyperliquid supports Gtc/Ioc\nsubmit_to_hyperliquid(order)?;","handlingStrategy":"validation","validationCode":"fn hyperliquid_tif_ok(tif: TimeInForce) -> bool {\n    matches!(tif, TimeInForce::Gtc | TimeInForce::Ioc)\n}\nassert!(hyperliquid_tif_ok(order.time_in_force()));","typeGuard":null,"tryCatchPattern":"let hl_tif = nautilus_time_in_force_to_hyperliquid(tif)\n    .unwrap_or(HyperliquidTimeInForce::Gtc); // or surface the error to the strategy","preventionTips":["Restrict TimeInForce to GTC/IOC in strategy config for Hyperliquid.","Emulate FOK client-side (IOC + cancel residual) if needed.","Document venue TIF limits next to your venue capability matrix."],"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-14T05:17:10.506Z"}