{"record":{"id":"acc78243d8141e26","repo":"nautechsystems/nautilus_trader","slug":"unsupported-time-in-force-time-in-force","errorCode":null,"errorMessage":"Unsupported time in force: {time_in_force:?}","messagePattern":"Unsupported time in force: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/kraken/src/common/order_params.rs","lineNumber":234,"sourceCode":"    expire_time: Option<UnixNanos>,\n) -> anyhow::Result<Option<KrakenTimeInForce>> {\n    if !is_limit_order {\n        return Ok(None);\n    }\n\n    match time_in_force {\n        TimeInForce::Gtc => Ok(None),\n        TimeInForce::Ioc => Ok(Some(KrakenTimeInForce::ImmediateOrCancel)),\n        TimeInForce::Fok => {\n            anyhow::bail!(\"FOK time in force is not supported on Kraken WS v2; use REST\")\n        }\n        TimeInForce::Gtd => {\n            expire_time.ok_or_else(|| {\n                anyhow::anyhow!(\"GTD time in force requires expire_time parameter\")\n            })?;\n            Ok(Some(KrakenTimeInForce::GoodTilDate))\n        }\n        _ => anyhow::bail!(\"Unsupported time in force: {time_in_force:?}\"),\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use nautilus_core::{UUID4, UnixNanos};\n    use nautilus_model::identifiers::{\n        ClientOrderId, InstrumentId, StrategyId, TraderId, VenueOrderId,\n    };\n    use rstest::rstest;\n    use rust_decimal_macros::dec;\n\n    use super::*;\n\n    fn make_cancel_order(client_order_id: &str, venue_order_id: Option<&str>) -> CancelOrder {\n        CancelOrder {\n            trader_id: TraderId::from(\"TESTER-001\"),\n            client_id: None,","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/kraken/src/common/order_params.rs#L216-L252","documentation":"compute_ws_time_in_force only recognizes Gtc, Ioc, Fok, and Gtd; any other TimeInForce variant hits the catch-all arm and bails. This catches TIF values with no Kraken WS mapping (e.g. Day, AtTheOpen, or other venue-specific variants).","triggerScenarios":"Submitting a Kraken WS order whose time_in_force is a variant outside the handled set, such as TimeInForce::Day or another exchange-specific TIF carried over from another adapter.","commonSituations":"Strategies configured for equities/futures venues (Day orders, auction TIFs) reused against Kraken; also hit when new TimeInForce variants are added upstream before the Kraken adapter maps them.","solutions":["Use Gtc, Ioc, or Gtd time in force for orders sent over Kraken WS.","For Gtd, also ensure expire_time is set (otherwise a separate error fires).","Audit the strategy/executor config so venue-specific TIF values are not sent to the Kraken adapter."],"exampleFix":"// before\norder_factory.limit(instrument_id, side, qty, price, TimeInForce::Day, None)\n// after\norder_factory.limit(instrument_id, side, qty, price, TimeInForce::Gtc, None)","handlingStrategy":"validation","validationCode":"const WS_TIFS: &[TimeInForce] = &[TimeInForce::Gtc, TimeInForce::Ioc, TimeInForce::Fok, TimeInForce::Gtd];\nif !WS_TIFS.contains(&order.time_in_force()) {\n    // remap to Gtc or reject before Kraken WS submission\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only Gtc/Ioc/Gtd for Kraken WS orders; supply expire_time for Gtd.","Remap venue-specific TIFs (Day, auction variants) at the strategy/config layer.","Re-check TIF mappings when upgrading NautilusTrader in case new variants appear."],"tags":["rust","kraken","websocket","time-in-force","unsupported-enum-value"],"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"}