{"record":{"id":"463eee459212b8af","repo":"nautechsystems/nautilus_trader","slug":"fok-time-in-force-only-supported-for-limit-orders","errorCode":null,"errorMessage":"FOK time in force only supported for LIMIT orders on Kraken Spot","messagePattern":"FOK time in force only supported for LIMIT orders on Kraken Spot","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/kraken/src/http/spot/client.rs","lineNumber":3042,"sourceCode":"            OrderType::StopLimit => KrakenOrderType::StopLossLimit,\n            OrderType::MarketIfTouched => KrakenOrderType::TakeProfit,\n            OrderType::LimitIfTouched => KrakenOrderType::TakeProfitLimit,\n            OrderType::TrailingStopMarket => KrakenOrderType::TrailingStop,\n            OrderType::TrailingStopLimit => KrakenOrderType::TrailingStopLimit,\n            _ => anyhow::bail!(\"Unsupported order type: {order_type:?}\"),\n        };\n\n        let mut oflags = Vec::new();\n        let is_limit_order = matches!(\n            order_type,\n            OrderType::Limit\n                | OrderType::StopLimit\n                | OrderType::LimitIfTouched\n                | OrderType::TrailingStopLimit\n        );\n\n        if time_in_force == TimeInForce::Fok && order_type != OrderType::Limit {\n            anyhow::bail!(\"FOK time in force only supported for LIMIT orders on Kraken Spot\");\n        }\n\n        let (timeinforce, expiretm) =\n            compute_time_in_force(is_limit_order, time_in_force, expire_time)?;\n\n        if post_only {\n            oflags.push(KRAKEN_OFLAG_POST_ONLY);\n        }\n\n        if quote_quantity {\n            oflags.push(KRAKEN_OFLAG_QUOTE_QUANTITY);\n        }\n\n        let mut builder = KrakenSpotAddOrderParamsBuilder::default();\n        builder\n            .cl_ord_id(truncate_cl_ord_id(&client_order_id))\n            .broker(NAUTILUS_KRAKEN_BROKER_ID)\n            .pair(raw_symbol)","sourceCodeStart":3024,"sourceCodeEnd":3060,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/kraken/src/http/spot/client.rs#L3024-L3060","documentation":"Kraken Spot only honors FOK (fill-or-kill) time in force on LIMIT orders. The client validates the combination and bails if TimeInForce::Fok is paired with any non-Limit order type (market, stop, trailing, etc.), since the venue would reject it.","triggerScenarios":"Submitting a MARKET, STOP_MARKET, TRAILING_STOP_MARKET (or any non-LIMIT) order with time_in_force = TimeInForce::Fok.","commonSituations":"Strategies that uniformly set FOK on all orders; ported code from venues where FOK applies to market orders; configuration-driven TIF applied without regard to order type.","solutions":["Use OrderType::Limit when TimeInForce::Fok is required.","For market orders use TimeInForce::Gtc (or the venue's supported TIF) instead of FOK.","Validate order_type/time_in_force combinations in strategy config before submission."],"exampleFix":"// before\nlet order = order_factory.market(instrument_id, side, qty, TimeInForce::Fok, ...);\n\n// after\nlet order = order_factory.market(instrument_id, side, qty, TimeInForce::Gtc, ...);","handlingStrategy":"validation","validationCode":"if time_in_force == TimeInForce::Fok && order_type != OrderType::Limit {\n    return Err(\"FOK requires OrderType::Limit on Kraken Spot\");\n}","typeGuard":"fn fok_is_valid(tif: &TimeInForce, ot: &OrderType) -> bool {\n    *tif != TimeInForce::Fok || *ot == OrderType::Limit\n}","tryCatchPattern":"match client.submit_order(order).await {\n    Err(e) if e.to_string().contains(\"FOK time in force only supported\") => {\n        log::error!(\"resubmit as LIMIT or switch TIF to GTC\");\n    }\n    Err(e) => return Err(e),\n    Ok(r) => r,\n}","preventionTips":["Pair FOK only with LIMIT orders in strategy configuration","Default market orders to GTC on Kraken Spot","Validate order_type/TIF combinations in a pre-trade config check"],"tags":["time-in-force","unsupported-combination","kraken-spot","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-14T05:17:10.506Z"}