{"record":{"id":"5273a110e497d8c7","repo":"nautechsystems/nautilus_trader","slug":"gtd-time-in-force-is-not-supported-for-bitmex-orde","errorCode":null,"errorMessage":"GTD time in force is not supported for BitMEX order submit; use GTC, Day, IOC, or FOK","messagePattern":"GTD time in force is not supported for BitMEX order submit; use GTC, Day, IOC, or FOK","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/bitmex/src/common/enums.rs","lineNumber":357,"sourceCode":"            TimeInForce::Gtc => Ok(Self::GoodTillCancel),\n            TimeInForce::Gtd => Ok(Self::GoodTillDate),\n            TimeInForce::Ioc => Ok(Self::ImmediateOrCancel),\n            TimeInForce::Fok => Ok(Self::FillOrKill),\n            TimeInForce::AtTheOpen => Ok(Self::AtTheOpening),\n            TimeInForce::AtTheClose => Ok(Self::AtTheClose),\n        }\n    }\n}\n\nimpl BitmexTimeInForce {\n    /// Try to convert from Nautilus TimeInForce with anyhow::Result.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the time in force is not supported by BitMEX.\n    pub fn try_from_time_in_force(value: TimeInForce) -> anyhow::Result<Self> {\n        if value == TimeInForce::Gtd {\n            anyhow::bail!(\n                \"GTD time in force is not supported for BitMEX order submit; use GTC, Day, IOC, or FOK\"\n            );\n        }\n\n        Self::try_from(value)\n    }\n}\n\n/// Represents the available contingency types on BitMEX.\n#[derive(\n    Copy,\n    Clone,\n    Debug,\n    Display,\n    PartialEq,\n    Eq,\n    AsRefStr,\n    EnumIter,","sourceCodeStart":339,"sourceCodeEnd":375,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bitmex/src/common/enums.rs#L339-L375","documentation":"BitmexOrderType::try_from_time_in_force explicitly rejects TimeInForce::Gtd for order submission because BitMEX does not support good-til-date on order submit. The message directs users to GTC, Day, IOC, or FOK instead.","triggerScenarios":"Building a BitMEX order submit (BitmexOrderType::try_from_time_in_force) with an order whose TimeInForce is Gtd.","commonSituations":"Strategies ported from venues that support GTD (e.g. futures with expiry-based orders) run against BitMEX without adjusting TIF; Nautilus defaults some bracket/repeat orders to GTD with an expiry.","solutions":["Change the order's time_in_force to Gtc, Day, Ioc, or Fok before submitting to BitMEX","If expiry semantics are needed, emulate GTD by scheduling a cancel at the expiry time with a GTC order","Add a pre-submit guard that rewrites Gtd to Gtc for the BitMEX venue"],"exampleFix":"// before\nlet order = factory.limit(..., time_in_force=GTD, expire_time=...);\n// after\nlet order = factory.limit(..., time_in_force=GTC, expire_time=None);\n// plus scheduled cancel at the desired expiry","handlingStrategy":"validation","validationCode":"if order.time_in_force() == TimeInForce::Gtd {\n    return Err(\"rewrite Gtd to Gtc for BitMEX and schedule a cancel at expiry\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Map GTD semantics to GTC + scheduled cancel for BitMEX","Set venue-aware TIF defaults in strategy configuration","Review TIF usage when porting strategies from other venues"],"tags":["bitmex","time-in-force","unsupported"],"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"}