{"record":{"id":"993a51a0c3406626","repo":"nautechsystems/nautilus_trader","slug":"unsupported-time-in-force-for-derive-other","errorCode":null,"errorMessage":"unsupported time in force for Derive: {other:?}","messagePattern":"unsupported time in force for Derive: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/derive/src/common/parse.rs","lineNumber":198,"sourceCode":"\n/// Maps a Nautilus time-in-force flag to the Derive TIF.\n///\n/// # Errors\n///\n/// Returns an error for time-in-force flags Derive does not accept.\npub fn time_in_force_to_derive(\n    tif: TimeInForce,\n    post_only: bool,\n) -> anyhow::Result<DeriveTimeInForce> {\n    match tif {\n        TimeInForce::Gtc if post_only => Ok(DeriveTimeInForce::PostOnly),\n        TimeInForce::Ioc | TimeInForce::Fok if post_only => anyhow::bail!(\n            \"post-only Derive orders only support GTC time in force; received {tif:?}\"\n        ),\n        TimeInForce::Gtc => Ok(DeriveTimeInForce::Gtc),\n        TimeInForce::Ioc => Ok(DeriveTimeInForce::Ioc),\n        TimeInForce::Fok => Ok(DeriveTimeInForce::Fok),\n        other => anyhow::bail!(\"unsupported time in force for Derive: {other:?}\"),\n    }\n}\n\n/// Maps a Derive order side back to Nautilus.\n#[must_use]\npub fn derive_order_side_to_nautilus(side: DeriveOrderSide) -> OrderSide {\n    match side {\n        DeriveOrderSide::Buy => OrderSide::Buy,\n        DeriveOrderSide::Sell => OrderSide::Sell,\n    }\n}\n\n/// Maps a Derive order type back to Nautilus.\n///\n/// Unmodeled venue order types decode as [`DeriveOrderType::Unknown`] and map\n/// to [`OrderType::Limit`] so the order stays visible to reconciliation.\n#[must_use]\npub fn derive_order_type_to_nautilus(order_type: DeriveOrderType) -> OrderType {","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/derive/src/common/parse.rs#L180-L216","documentation":"This error is raised by `time_in_force_to_derive` when a Nautilus `TimeInForce` value cannot be mapped to a Derive time-in-force. Derive only supports GTC, IOC, and FOK; post-only orders additionally must use GTC. Any other variant (e.g. GTD, DAY, AT_THE_OPEN) falls into the catch-all `other` arm and is rejected.","triggerScenarios":"Passing a TimeInForce other than Gtc/Ioc/Fok to order_to_derive_payload, trigger_order_to_derive_payload, order_replace_to_derive_payload, or validate_order_support. Note that Ioc/Fok combined with post_only fail earlier with a different message; this error fires only for genuinely unmapped variants (e.g. TimeInForce::Gtd or Day).","commonSituations":"Configuring orders with GTD expiry (common for futures strategies) and submitting them through the Derive adapter; using default time-in-force settings from another adapter that Derive does not support; porting order templates across venues.","solutions":["Change the order's time_in_force to Gtc, Ioc, or Fok before submitting to Derive.","If an expiry is required, emulate GTD by cancelling the order client-side at expiry instead of using TimeInForce::Gtd.","Run validate_order_support before submission to fail fast with the same check.","Check post_only orders are explicitly Gtc (Ioc/Fok + post_only are rejected separately)."],"exampleFix":"// before\nlet order = builder.time_in_force(TimeInForce::Gtd(expiry)).build();\n// after\nlet order = builder.time_in_force(TimeInForce::Gtc).build();","handlingStrategy":"validation","validationCode":"fn derive_supported_tif(tif: &TimeInForce, post_only: bool) -> Result<(), String> {\n    match tif {\n        TimeInForce::Gtc => Ok(()),\n        TimeInForce::Ioc | TimeInForce::Fok if !post_only => Ok(()),\n        _ => Err(format!(\"{tif:?} not supported by Derive\")),\n    }\n}","typeGuard":null,"tryCatchPattern":"match time_in_force_to_derive(tif, post_only) {\n    Ok(dtif) => submit(dtif),\n    Err(e) => { log::warn!(\"falling back to GTC: {e}\"); submit_gtc(); }\n}","preventionTips":["Restrict strategy configs to GTC/IOC/FOK for Derive venues.","Call validate_order_support before every submission.","Document that post-only orders must be GTC."],"tags":["order-submission","time-in-force","unsupported-value","derive"],"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"}