{"record":{"id":"8dbb3bab51665191","repo":"nautechsystems/nautilus_trader","slug":"binance-spot-does-not-support-native-gtd-set-use","errorCode":null,"errorMessage":"Binance Spot does not support native GTD; set use_gtd=false and enable manage_gtd_expiry on the submitting strategy","messagePattern":"Binance Spot does not support native GTD; set use_gtd=false and enable manage_gtd_expiry on the submitting strategy","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/spot/enums.rs","lineNumber":141,"sourceCode":"///\n/// # Errors\n///\n/// Returns an error if the time in force is not supported on Binance Spot.\npub fn time_in_force_to_binance_spot(\n    tif: TimeInForce,\n    use_gtd: bool,\n) -> anyhow::Result<BinanceTimeInForce> {\n    match tif {\n        TimeInForce::Gtc => Ok(BinanceTimeInForce::Gtc),\n        TimeInForce::Ioc => Ok(BinanceTimeInForce::Ioc),\n        TimeInForce::Fok => Ok(BinanceTimeInForce::Fok),\n        TimeInForce::Gtd if !use_gtd => {\n            log::warn!(\n                \"Binance Spot does not support GTD; submitting as GTC because use_gtd=false. Enable manage_gtd_expiry on the submitting strategy\"\n            );\n            Ok(BinanceTimeInForce::Gtc)\n        }\n        TimeInForce::Gtd => anyhow::bail!(\n            \"Binance Spot does not support native GTD; set use_gtd=false and enable manage_gtd_expiry on the submitting strategy\"\n        ),\n        _ => anyhow::bail!(\"Unsupported time in force for Binance Spot: {tif:?}\"),\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use rstest::rstest;\n\n    use super::*;\n\n    #[rstest]\n    #[case(OrderType::Market, false, BinanceSpotOrderType::Market)]\n    #[case(OrderType::Limit, false, BinanceSpotOrderType::Limit)]\n    #[case(OrderType::Limit, true, BinanceSpotOrderType::LimitMaker)]\n    #[case(OrderType::StopMarket, false, BinanceSpotOrderType::StopLoss)]\n    #[case(OrderType::StopLimit, false, BinanceSpotOrderType::StopLossLimit)]","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/spot/enums.rs#L123-L159","documentation":"Binance Spot does not support native GTD (Good-Til-Date) time-in-force. `time_in_force_to_binance_spot` rejects `TimeInForce::Gtd` when `use_gtd` is true, telling the caller to disable native GTD (`use_gtd=false`, so GTD is downgraded to GTC) and enable `manage_gtd_expiry` on the submitting strategy so expiry is enforced locally.","triggerScenarios":"Submitting, modifying, or building params for an order with `TimeInForce::Gtd` via `submit_order` / `modify_order` / `build_new_order_params` / `build_cancel_replace_params` while the exec client's `use_gtd` option is enabled (default true).","commonSituations":"Reusing a strategy written for Binance Futures (which supports native GTD) on Spot; leaving adapter `use_gtd` at its default while the strategy sets GTD expiry; porting crypto strategies that rely on exchange-side order expiry.","solutions":["Set `use_gtd=false` on the Binance Spot exec client config so GTD orders are submitted as GTC with a warning","Enable `manage_gtd_expiry` on the submitting strategy so it cancels the order at expiry locally","Change the strategy to use `TimeInForce::Gtc` or `Ioc`/`Fok` directly instead of Gtd on Spot","Route GTD-dependent strategies to Binance USDT-M Futures, which supports native GTD"],"exampleFix":"// before\nExecClientConfig { use_gtd: true, /* strategy submits TimeInForce::Gtd */ }\n// after\nExecClientConfig { use_gtd: false }; // + strategy config: manage_gtd_expiry=True","handlingStrategy":"validation","validationCode":"fn validate_spot_tif(tif: TimeInForce, use_gtd: bool) -> Result<(), String> {\n    if tif == TimeInForce::Gtd && use_gtd {\n        return Err(\"Binance Spot needs use_gtd=false plus manage_gtd_expiry for GTD orders\".into());\n    }\n    Ok(())\n}","typeGuard":"fn is_spot_supported_tif(tif: TimeInForce) -> bool {\n    matches!(tif, TimeInForce::Gtc | TimeInForce::Ioc | TimeInForce::Fok\n        | TimeInForce::Gtd /* only with use_gtd=false */)\n}","tryCatchPattern":"match exec_client.submit_order(order) {\n    Err(e) if e.to_string().contains(\"does not support native GTD\") => {\n        log::warn!(\"resubmitting GTD order as GTC with local expiry management\");\n        exec_client.set_use_gtd(false);\n        strategy.manage_gtd_expiry = true;\n        exec_client.submit_order(order)?;\n    }\n    other => other?,\n}","preventionTips":["Set use_gtd=false in the Binance Spot exec client config when strategies use GTD","Enable manage_gtd_expiry on any strategy that submits GTD orders","Prefer GTC/IOC/FOK time-in-force for Spot strategies","Avoid sharing strategy configs between Binance Futures and Spot without auditing time-in-force usage"],"tags":["rust","time-in-force","gtd","binance","config"],"backgroundTag":"unsupported-config-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}