{"record":{"id":"18ea6c9381647b86","repo":"nautechsystems/nautilus_trader","slug":"unknown-ib-time-in-force-value","errorCode":null,"errorMessage":"Unknown IB time in force: {value}","messagePattern":"Unknown IB time in force: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/interactive_brokers/src/common/enums/order.rs","lineNumber":540,"sourceCode":"            ibapi::orders::TimeInForce::Auction => Self::Auction,\n        }\n    }\n}\n\nimpl FromStr for IbTimeInForce {\n    type Err = anyhow::Error;\n\n    fn from_str(value: &str) -> Result<Self, Self::Err> {\n        match value {\n            \"DAY\" => Ok(Self::Day),\n            \"GTC\" => Ok(Self::GoodTilCanceled),\n            \"IOC\" => Ok(Self::ImmediateOrCancel),\n            \"GTD\" => Ok(Self::GoodTilDate),\n            \"OPG\" => Ok(Self::OnOpen),\n            \"FOK\" => Ok(Self::FillOrKill),\n            \"DTC\" => Ok(Self::DayTilCanceled),\n            \"AUC\" => Ok(Self::Auction),\n            _ => anyhow::bail!(\"Unknown IB time in force: {value}\"),\n        }\n    }\n}\n\nimpl Display for IbTimeInForce {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        f.write_str(match self {\n            Self::Day => \"DAY\",\n            Self::GoodTilCanceled => \"GTC\",\n            Self::ImmediateOrCancel => \"IOC\",\n            Self::GoodTilDate => \"GTD\",\n            Self::OnOpen => \"OPG\",\n            Self::FillOrKill => \"FOK\",\n            Self::DayTilCanceled => \"DTC\",\n            Self::Auction => \"AUC\",\n        })\n    }\n}","sourceCodeStart":522,"sourceCodeEnd":558,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/interactive_brokers/src/common/enums/order.rs#L522-L558","documentation":"IbTimeInForce::from_str in crates/adapters/interactive_brokers/src/common/enums/order.rs:540 rejects any string not matching a supported IB time-in-force code (DAY, GTC, IOC, GTD, OPG, FOK, DTC, AUC) via anyhow::bail!. Only exact wire codes are accepted.","triggerScenarios":"Parsing a time-in-force value that is not one of the listed codes: e.g. \"Gtc\", \"day\", \"GTDAY\", or a TIF from another adapter's vocabulary.","commonSituations":"Order config YAML/JSON with mixed-case TIF strings; users writing \"GoodTilDate\" or \"good_til_date\" instead of the IB code \"GTD\"; porting strategies from other brokers that use extended TIF names.","solutions":["Use the exact IB code: \"DAY\", \"GTC\", \"IOC\", \"GTD\", \"OPG\", \"FOK\", \"DTC\", or \"AUC\".","Normalize input with trim + to_ascii_uppercase before parsing.","Verify the configured TIF is supported by this adapter, not just by IB in general.","Extend the match arm list upstream if a new IB TIF code must be supported."],"exampleFix":"// before\nlet tif = \"gtc \".parse::<IbTimeInForce>()?; // bail!\n// after\nlet tif = \"gtc \".trim().to_ascii_uppercase().parse::<IbTimeInForce>()?; // Ok(GoodTilCanceled)","handlingStrategy":"validation","validationCode":"const IB_TIFS: &[&str] = &[\"DAY\",\"GTC\",\"IOC\",\"GTD\",\"OPG\",\"FOK\",\"DTC\",\"AUC\"];\nfn is_valid_ib_tif(s: &str) -> bool {\n    IB_TIFS.contains(&s.trim().to_ascii_uppercase().as_str())\n}","typeGuard":"fn as_ib_time_in_force(s: &str) -> Option<IbTimeInForce> {\n    s.trim().to_ascii_uppercase().parse::<IbTimeInForce>().ok()\n}","tryCatchPattern":"match value.parse::<IbTimeInForce>() {\n    Ok(tif) => submit(tif),\n    Err(e) => return Err(anyhow::anyhow!(\"invalid time_in_force '{value}': {e}\")),\n}","preventionTips":["Use the enum variant directly in code instead of raw strings where possible.","Normalize TIF strings (trim + uppercase) at the config boundary.","Do not assume TIF codes from other brokers are valid for IB."],"tags":["rust","enum-parsing","interactive-brokers","time-in-force"],"backgroundTag":"invalid-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"}