nautechsystems/nautilus_trader · error · anyhow::Error
FOK time in force is not supported by Hyperliquid
Error message
FOK time in force is not supported by Hyperliquid
What it means
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.
Source
Thrown at crates/adapters/hyperliquid/src/common/converters.rs:250
pub fn nautilus_to_hyperliquid_conditional(
order_type: OrderType,
) -> HyperliquidConditionalOrderType {
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 {View on GitHub (pinned to 18893faf8b)
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.
Example fix
// before let order = limit_order(tif: TimeInForce::Fok); submit_to_hyperliquid(order)?; // after let order = limit_order(tif: TimeInForce::Ioc); // Hyperliquid supports Gtc/Ioc submit_to_hyperliquid(order)?;
Defensive patterns
Strategy: validation
Validate before calling
fn hyperliquid_tif_ok(tif: TimeInForce) -> bool {
matches!(tif, TimeInForce::Gtc | TimeInForce::Ioc)
}
assert!(hyperliquid_tif_ok(order.time_in_force())); Try / catch
let hl_tif = nautilus_time_in_force_to_hyperliquid(tif)
.unwrap_or(HyperliquidTimeInForce::Gtc); // or surface the error to the strategy Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Strategies configured with FOK defaults reused across venues; order templates from other exchanges; fixtures in tests exercising all TimeInForce values.
Related errors
- GTD time in force is not supported by Hyperliquid
- DAY time in force is not supported by Hyperliquid
- AT_THE_OPEN time in force is not supported by Hyperliquid
- AT_THE_CLOSE time in force is not supported by Hyperliquid
- FOK time in force is not supported by Hyperliquid
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/31d7edde575c6903.
Report an issue: GitHub.