{"record":{"id":"f0189318926926af","repo":"nautechsystems/nautilus_trader","slug":"binance-futures-goodtilldate-must-be-strictly-grea","errorCode":null,"errorMessage":"Binance Futures goodTillDate must be strictly greater than current time plus {BINANCE_GTD_MIN_LEAD_SECS} seconds","messagePattern":"Binance Futures goodTillDate must be strictly greater than current time plus (.+?) seconds","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/futures/execution.rs","lineNumber":1197,"sourceCode":"    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\"\n    );\n\n    let minimum_ns = ts_now\n        .as_u64()\n        .checked_add(BINANCE_GTD_MIN_LEAD_SECS * NANOSECONDS_IN_SECOND)\n        .context(\"Binance Futures GTD minimum timestamp overflow\")?;\n    anyhow::ensure!(\n        expire_ns > minimum_ns,\n        \"Binance Futures goodTillDate must be strictly greater than current time plus {BINANCE_GTD_MIN_LEAD_SECS} seconds\"\n    );\n\n    let good_till_date = expire_ns / NANOSECONDS_IN_MILLISECOND;\n    anyhow::ensure!(\n        good_till_date < BINANCE_GTD_MAX_MILLIS,\n        \"Binance Futures goodTillDate must be smaller than {BINANCE_GTD_MAX_MILLIS}\"\n    );\n\n    Ok(FuturesOrderLifetime {\n        time_in_force,\n        good_till_date: Some(i64::try_from(good_till_date)?),\n    })\n}\n\nfn is_grouped_order(order: &OrderAny) -> bool {\n    matches!(","sourceCodeStart":1179,"sourceCodeEnd":1215,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/futures/execution.rs#L1179-L1215","documentation":"Binance enforces a minimum lead time on goodTillDate: the expiry must be strictly greater than the current time plus 600 seconds (BINANCE_GTD_MIN_LEAD_SECS, execution.rs:139). The client computes now + 600s in nanoseconds (checked, so extreme clock values surface as an overflow context error instead) and rejects expiries at or below it, because the venue would reject them as too soon.","triggerScenarios":"Submitting a GTD order whose expire_time is less than ~10 minutes in the future, exactly now+600s (not strictly greater), or in the past — e.g. a session-end expiry submitted late, or a fixed expiry timestamp whose submission was delayed.","commonSituations":"End-of-session expiries submitted within the final 10 minutes of the session; delayed order submission (queueing, retries) making a previously valid expiry too close; timezone math producing a past timestamp.","solutions":["Set the expiry strictly more than 600 seconds (10 minutes) in the future at submission time","Recompute the expiry relative to the current clock right before (re)submission rather than reusing a stale timestamp","If the desired expiry is closer than the lead time, submit GTC and cancel at the desired time instead"],"exampleFix":"// before\nlet expire = UnixNanos::now().checked_add(5 * 60 * 1_000_000_000)?; // only 5 min ahead\n\n// after\nlet expire = UnixNanos::now().checked_add(15 * 60 * 1_000_000_000)?; // > now + 600s","handlingStrategy":"validation","validationCode":"const MIN_LEAD_SECS: u64 = 600;\nlet now = clock.get_time_ns().as_u64();\nanyhow::ensure!(\n    expire.as_u64() > now + MIN_LEAD_SECS * 1_000_000_000,\n    \"expiry must be more than 10 minutes out\"\n);","typeGuard":"fn expiry_has_min_lead(expire_ns: u64, now_ns: u64) -> bool {\n    expire_ns > now_ns.saturating_add(600 * 1_000_000_000)\n}","tryCatchPattern":null,"preventionTips":["Compute expiries relative to the clock at submission time, not at signal time","For sub-10-minute horizons use GTC plus a timed cancel","Guard session-end expiries so late submissions skip GTD"],"tags":["binance-futures","gtd","expire-time","minimum-lead","rust"],"backgroundTag":"good-till-date-validation","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}