{"record":{"id":"6f72d3c8aee14ae8","repo":"nautechsystems/nautilus_trader","slug":"binance-futures-does-not-support-gtd-for-order-typ","errorCode":null,"errorMessage":"Binance Futures does not support GTD for order type {order_type:?}","messagePattern":"Binance Futures does not support GTD for order type (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/futures/execution.rs","lineNumber":1172,"sourceCode":") -> anyhow::Result<FuturesOrderLifetime> {\n    if time_in_force != TimeInForce::Gtd {\n        return Ok(FuturesOrderLifetime {\n            time_in_force,\n            good_till_date: None,\n        });\n    }\n\n    if !use_gtd {\n        log::warn!(\n            \"Binance Futures GTD submitted as GTC because use_gtd=false. Enable manage_gtd_expiry on the submitting strategy\"\n        );\n        return Ok(FuturesOrderLifetime {\n            time_in_force: TimeInForce::Gtc,\n            good_till_date: None,\n        });\n    }\n\n    anyhow::ensure!(\n        matches!(\n            order_type,\n            OrderType::Limit | OrderType::StopLimit | OrderType::LimitIfTouched\n        ),\n        \"Binance Futures does not support GTD for order type {order_type:?}\"\n    );\n    anyhow::ensure!(!post_only, \"Binance Futures GTD cannot be post-only\");\n\n    anyhow::ensure!(\n        product_type == BinanceProductType::UsdM,\n        \"Binance {product_type:?} Futures does not support native GTD\"\n    );\n\n    let expire_time = expire_time.context(\"Binance Futures GTD requires an expire_time\")?;\n    let expire_ns = expire_time.as_u64();\n    anyhow::ensure!(\n        expire_ns.is_multiple_of(NANOSECONDS_IN_SECOND),\n        \"Binance Futures goodTillDate requires whole-second precision\"","sourceCodeStart":1154,"sourceCodeEnd":1190,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/futures/execution.rs#L1154-L1190","documentation":"When resolving the order lifetime for a native GTD (good-till-date) order, the Binance futures client only accepts Limit, StopLimit, and LimitIfTouched order types — the venue's goodTillDate applies to resting limit-family orders only. The guard fires when time_in_force is Gtd, the submitting strategy enabled manage_gtd_expiry (use_gtd=true), and the order type is anything else (Market, StopMarket, MarketIfTouched). With manage_gtd_expiry=false the client instead downgrades GTD to GTC with a warning, never reaching this error.","triggerScenarios":"Submitting a Market, StopMarket, or MarketIfTouched order with TimeInForce::Gtd and an expire_time set, while the submitting strategy has manage_gtd_expiry enabled.","commonSituations":"A generic execution algorithm that stamps Gtd plus an expiry onto every order regardless of type; strategies ported from venues that accept GTD on market-type orders.","solutions":["Submit GTD only with Limit, StopLimit, or LimitIfTouched orders","Use Gtc for market-type orders (their lifetime is inherently immediate)","Alternatively leave manage_gtd_expiry=false so GTD is downgraded to GTC with a warning instead of erroring"],"exampleFix":"// before\nlet order = Order::market(instrument_id, side, qty).time_in_force(TimeInForce::Gtd)\n    .expire_time(expiry); // manage_gtd_expiry=true on the strategy\n\n// after\nlet order = Order::market(instrument_id, side, qty).time_in_force(TimeInForce::Gtc);\n// or keep Gtd but submit a Limit order instead of Market","handlingStrategy":"validation","validationCode":"use nautilus_model::enums::{OrderType, TimeInForce};\n\nif order.time_in_force() == TimeInForce::Gtd && strategy.manage_gtd_expiry {\n    anyhow::ensure!(\n        matches!(order.order_type(), OrderType::Limit | OrderType::StopLimit | OrderType::LimitIfTouched),\n        \"GTD unsupported for {}\",\n        order.order_type()\n    );\n}","typeGuard":"fn gtd_supported_for(order_type: OrderType) -> bool {\n    matches!(order_type, OrderType::Limit | OrderType::StopLimit | OrderType::LimitIfTouched)\n}","tryCatchPattern":null,"preventionTips":["Encode the type matrix in the execution algorithm: Gtd only on limit-family orders","Default market-type orders to Gtc","Decide once whether manage_gtd_expiry is on, and test both paths"],"tags":["binance-futures","gtd","time-in-force","order-type","rust"],"backgroundTag":"good-till-date-validation","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}