{"record":{"id":"6616e8f126bf7d90","repo":"nautechsystems/nautilus_trader","slug":"execution-postonly-not-supported-for-order-type","errorCode":null,"errorMessage":"Execution PostOnly not supported for {order_type:?}","messagePattern":"Execution PostOnly not supported for (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/dydx/src/http/parse.rs","lineNumber":213,"sourceCode":"            DydxTimeInForce::Gtt => Ok(TimeInForce::Gtc),\n            DydxTimeInForce::Fok => Ok(TimeInForce::Fok),\n            DydxTimeInForce::Ioc => Ok(TimeInForce::Ioc),\n        },\n\n        DydxOrderType::StopLimit | DydxOrderType::TakeProfitLimit => match execution {\n            Some(DydxOrderExecution::PostOnly) => Ok(TimeInForce::Gtc), // Post-only is GTC with post_only flag\n            Some(DydxOrderExecution::Fok) => Ok(TimeInForce::Fok),\n            Some(DydxOrderExecution::Ioc) => Ok(TimeInForce::Ioc),\n            Some(DydxOrderExecution::Default) | None => Ok(TimeInForce::Gtc), // Default for conditional limit\n        },\n\n        DydxOrderType::StopMarket | DydxOrderType::TakeProfitMarket => match execution {\n            Some(DydxOrderExecution::Fok) => Ok(TimeInForce::Fok),\n            Some(DydxOrderExecution::Ioc | DydxOrderExecution::Default) | None => {\n                Ok(TimeInForce::Ioc)\n            }\n            Some(DydxOrderExecution::PostOnly) => {\n                anyhow::bail!(\"Execution PostOnly not supported for {order_type:?}\")\n            }\n        },\n\n        DydxOrderType::TrailingStop => Ok(TimeInForce::Gtc),\n    }\n}\n\n/// Validate conditional order parameters.\n///\n/// Ensures that trigger prices are set correctly relative to limit prices\n/// based on order type and side.\n///\n/// # Errors\n///\n/// Returns an error if:\n/// - Conditional order is missing trigger price.\n/// - Trigger price is on wrong side of limit price for the order type.\npub fn validate_conditional_order(","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/dydx/src/http/parse.rs#L195-L231","documentation":"PostOnly execution is only valid for plain limit orders on dYdX. `calculate_time_in_force` maps order type + execution to TimeInForce, and throws when a PostOnly execution is combined with StopMarket, TakeProfitMarket (and other non-limit order types).","triggerScenarios":"Submitting a stop-market or take-profit-market order with `DydxOrderExecution::PostOnly`, causing the time-in-force derivation to fail.","commonSituations":"Copying PostOnly options from limit order code into conditional/market order builders; user config enabling post-only globally for all order types.","solutions":["Use `Fok` or `Ioc` (or omit execution) for stop-market and take-profit-market orders","Reserve `PostOnly` for `Limit`/`StopLimit`/`TakeProfitLimit` order types only"],"exampleFix":"// before\nlet tif = calculate_time_in_force(DydxOrderType::StopMarket, Some(DydxOrderExecution::PostOnly))?;\n// after\nlet tif = calculate_time_in_force(DydxOrderType::StopMarket, Some(DydxOrderExecution::Ioc))?;","handlingStrategy":"validation","validationCode":"fn supports_post_only(t: DydxOrderType) -> bool {\n    matches!(t, DydxOrderType::Limit | DydxOrderType::StopLimit | DydxOrderType::TakeProfitLimit)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Model valid (order_type, execution) combinations in the type system or builder API","Never apply global post-only flags to conditional orders"],"tags":["rust","dydx","orders","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-14T00:17:10.932Z"}