{"record":{"id":"e3a7e3f77b4edc69","repo":"nautechsystems/nautilus_trader","slug":"unsupported-time-in-force-time-in-force-e3a7e3","errorCode":null,"errorMessage":"Unsupported time in force: {time_in_force:?}","messagePattern":"Unsupported time in force: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/kraken/src/http/spot/client.rs","lineNumber":3257,"sourceCode":"    time_in_force: TimeInForce,\n    expire_time: Option<UnixNanos>,\n) -> anyhow::Result<(Option<String>, Option<String>)> {\n    if !is_limit_order {\n        return Ok((None, None));\n    }\n\n    match time_in_force {\n        TimeInForce::Gtc => Ok((None, None)),\n        TimeInForce::Ioc => Ok((Some(\"IOC\".to_string()), None)),\n        TimeInForce::Fok => Ok((Some(\"FOK\".to_string()), None)),\n        TimeInForce::Gtd => {\n            let expire = expire_time.ok_or_else(|| {\n                anyhow::anyhow!(\"GTD time in force requires expire_time parameter\")\n            })?;\n            let expire_secs = expire.as_u64() / NANOSECONDS_IN_SECOND;\n            Ok((Some(\"GTD\".to_string()), Some(expire_secs.to_string())))\n        }\n        _ => anyhow::bail!(\"Unsupported time in force: {time_in_force:?}\"),\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use std::{sync::Arc, time::Duration};\n\n    use nautilus_model::instruments::CurrencyPair;\n    use rstest::rstest;\n\n    use super::*;\n\n    #[rstest]\n    fn test_raw_client_creation() {\n        let client = KrakenSpotRawHttpClient::default();\n        assert!(client.credential.is_none());\n    }\n","sourceCodeStart":3239,"sourceCodeEnd":3275,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/kraken/src/http/spot/client.rs#L3239-L3275","documentation":"The Kraken Spot order-request builder supports only a limited set of time-in-force values (with GTD additionally requiring an expire_time). Any other TimeInForce variant reaching this match arm is rejected, since there is no Kraken Spot mapping for it.","triggerScenarios":"Submitting a Kraken Spot order with time_in_force set to an unsupported variant (falling into the catch-all _ arm) — e.g. TimeInForce::AtTheOpen, Day variants without a mapping, or other exchange-specific TIF values.","commonSituations":"Strategy defaults carrying a TIF configured for another venue; recently added TimeInForce enum variants not yet mapped in the Kraken adapter; typo-level mismatches between enum variants across versions.","solutions":["Use a supported time in force (GTC, IOC, FOK, or GTD with expire_time set) for Kraken Spot orders.","When using GTD, also pass expire_time — it is required and converted to seconds.","Omit time_in_force to use the venue default.","If the variant should be supported, check adapter version/CHANGELOG for added Kraken TIF mappings or file an upstream feature request."],"exampleFix":"// before\ntime_in_force: TimeInForce::AtTheOpen\n// after\ntime_in_force: TimeInForce::Gtc","handlingStrategy":"validation","validationCode":"const SUPPORTED_TIF: &[TimeInForce] = &[TimeInForce::Gtc, TimeInForce::Ioc, TimeInForce::Fok, TimeInForce::Gtd];\nif let Some(tif) = time_in_force {\n    if !SUPPORTED_TIF.contains(tif) {\n        return Err(format!(\"Kraken Spot unsupported TIF: {tif:?}\"));\n    }\n    if *tif == TimeInForce::Gtd && expire_time.is_none() {\n        return Err(\"GTD requires expire_time\");\n    }\n}","typeGuard":null,"tryCatchPattern":"match submit_result {\n    Err(e) if e.to_string().contains(\"Unsupported time in force\") => {\n        // retry with TimeInForce::Gtc or venue default\n    }\n    r => r?,\n}","preventionTips":["Whitelist TIF values per venue in order-construction code.","Always pair GTD with expire_time.","Check adapter release notes when upgrading enum variants."],"tags":["kraken","spot","time-in-force","order-submission"],"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"}