{"record":{"id":"3caff1b4ceaf75b0","repo":"nautechsystems/nautilus_trader","slug":"post-only-derive-orders-only-support-gtc-time-in-f","errorCode":null,"errorMessage":"post-only Derive orders only support GTC time in force; received {tif:?}","messagePattern":"post-only Derive orders only support GTC time in force; received (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/derive/src/common/parse.rs","lineNumber":192,"sourceCode":"        ),\n        None => anyhow::bail!(\n            \"missing trigger price type for Derive trigger order; Derive trigger orders support only MarkPrice\"\n        ),\n    }\n}\n\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","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/derive/src/common/parse.rs#L174-L210","documentation":"On Derive, post-only execution is expressed via a PostOnly time-in-force, which is only compatible with GTC. `time_in_force_to_derive` therefore accepts Gtc + post_only -> PostOnly, but if the order is post-only and the TIF is Ioc or Fok (which are mutually exclusive with resting on the book), it fails with this message.","triggerScenarios":"Submitting, amending, or validating a Derive order (`order_to_derive_payload`, `order_replace_to_derive_payload`, `validate_order_support`) with `post_only = true` and `time_in_force` of Ioc or Fok — a contradictory combination since IOC/FOK imply immediate execution and cannot be post-only.","commonSituations":"Order builders that always set post_only=true from a default flag while the strategy sets IOC/FOK for aggressive fills; copying post-only Limit order templates into a FOK sweep strategy; multi-venue code where another exchange tolerates post_only with IOC/FOK.","solutions":["Drop post_only when using Ioc or Fok time in force (set post_only=false)","Switch the TIF to Gtc if post-only behavior (maker-only, never cross) is what the strategy actually needs","Add `validate_order_support` to pre-submission checks to reject this combination before hitting the venue"],"exampleFix":"// before\nlet tif = time_in_force_to_derive(TimeInForce::Ioc, true)?; // errors\n// after\nlet tif = time_in_force_to_derive(TimeInForce::Gtc, true)?; // PostOnly\n// or\nlet tif = time_in_force_to_derive(TimeInForce::Ioc, false)?; // Ioc, not post-only","handlingStrategy":"validation","validationCode":"fn valid_tif_post_only(tif: TimeInForce, post_only: bool) -> bool {\n    !post_only || matches!(tif, TimeInForce::Gtc)\n}","typeGuard":"fn valid_tif_post_only(tif: TimeInForce, post_only: bool) -> bool {\n    !post_only || matches!(tif, TimeInForce::Gtc)\n}","tryCatchPattern":"match time_in_force_to_derive(tif, post_only) {\n    Ok(t) => { /* build payload */ }\n    Err(e) => tracing::warn!(%e, \"post-only TIF conflict; falling back to GTC\"),\n}","preventionTips":["Never combine post_only=true with Ioc or Fok","Decide maker-only (GTC post-only) vs aggressive (IOC/FOK, no post-only) explicitly per order","Add validate_order_support to pre-submission checks"],"tags":["rust","derive","orders","time-in-force","validation"],"backgroundTag":"conflicting-config-options","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"}