{"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/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/spot/enums.rs#L123-L159","documentation":"Binance Spot has no native GTD (good-til-date) time in force. When the execution client is configured with use_gtd=true (the default), submitting a TimeInForce::Gtd order bails here with a pointer to the two supported alternatives; with use_gtd=false, GTD is instead downgraded to GTC with a warning and the strategy is expected to cancel the order itself at expiry via manage_gtd_expiry.","triggerScenarios":"Submitting an order with TimeInForce::Gtd while BinanceExecClientConfig.use_gtd == true. submit_order at spot/execution.rs:1505 calls this conversion explicitly to fail fast before any venue dispatch.","commonSituations":"Running with default adapter config and reusing expiry-aware orders from another venue; enabling use_gtd to deliberately catch GTD usage; porting futures strategies where GTD handling differed.","solutions":["Set use_gtd=false in the Binance execution client config and enable manage_gtd_expiry on the submitting strategy so expiry is handled locally","Or change the order to GTC/IOC/FOK and manage cancellation yourself","Keep use_gtd=true only as a fail-fast lint when you want GTD usage to be an error"],"exampleFix":"# before: default config (use_gtd=True) + GTD order -> error\nconfig = BinanceExecClientConfig()\n\n# after: downgrade GTD to GTC, strategy cancels at expiry\nconfig = BinanceExecClientConfig(use_gtd=False)\nstrategy_config = MyStrategyConfig(manage_gtd_expiry=True)","handlingStrategy":"validation","validationCode":"// before building the order\nlet use_gtd = exec_config.use_gtd;\nif order_spec.time_in_force == TimeInForce::Gtd && use_gtd {\n    // either flip the config or downgrade the order\n    return Err(anyhow::anyhow!(\n        \"GTD requires use_gtd=false + manage_gtd_expiry, or use GTC\"\n    ));\n}","typeGuard":"fn spot_tif_needs_downgrade(tif: TimeInForce, use_gtd: bool) -> bool {\n    tif == TimeInForce::Gtd && !use_gtd\n}","tryCatchPattern":null,"preventionTips":["Standardize Binance Spot configs on use_gtd=false plus manage_gtd_expiry=True on strategies","Treat use_gtd=true as a deliberate tripwire that makes any GTD order a hard error","Prefer GTC + strategy-side expiry scheduling for full control of cancel timing"],"tags":["binance","spot","time-in-force","gtd","config","execution"],"backgroundTag":"unsupported-time-in-force","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}