{"record":{"id":"ff7d3b6c00eb1241","repo":"nautechsystems/nautilus_trader","slug":"unsupported-timeinforce-for-polymarket-market-or","errorCode":null,"errorMessage":"Unsupported `TimeInForce` for Polymarket market order: {value:?}","messagePattern":"Unsupported `TimeInForce` for Polymarket market order: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/polymarket/src/common/enums.rs","lineNumber":323,"sourceCode":"    type Error = anyhow::Error;\n\n    fn try_from(value: TimeInForce) -> anyhow::Result<Self> {\n        match value {\n            TimeInForce::Gtc => Ok(Self::GTC),\n            TimeInForce::Gtd => Ok(Self::GTD),\n            TimeInForce::Fok => Ok(Self::FOK),\n            TimeInForce::Ioc => Ok(Self::FAK),\n            _ => anyhow::bail!(\"Unsupported `TimeInForce` for Polymarket: {value:?}\"),\n        }\n    }\n}\n\nimpl PolymarketOrderType {\n    pub(crate) fn from_market_time_in_force(value: TimeInForce) -> anyhow::Result<Self> {\n        match value {\n            TimeInForce::Fok => Ok(Self::FOK),\n            TimeInForce::Ioc => Ok(Self::FAK),\n            _ => anyhow::bail!(\"Unsupported `TimeInForce` for Polymarket market order: {value:?}\"),\n        }\n    }\n}\n\nimpl From<PolymarketOrderStatus> for OrderStatus {\n    fn from(value: PolymarketOrderStatus) -> Self {\n        match value {\n            PolymarketOrderStatus::Invalid => Self::Rejected,\n            PolymarketOrderStatus::Live => Self::Accepted,\n            PolymarketOrderStatus::Delayed => Self::Accepted,\n            PolymarketOrderStatus::Matched => Self::Filled,\n            // Placement failure (never became live), treat as rejected\n            PolymarketOrderStatus::Unmatched => Self::Rejected,\n            PolymarketOrderStatus::Canceled => Self::Canceled,\n            // Market resolved = order expired due to market settlement\n            PolymarketOrderStatus::CanceledMarketResolved => Self::Expired,\n        }\n    }","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/polymarket/src/common/enums.rs#L305-L341","documentation":"Polymarket market orders only accept FOK or IOC time-in-force (mapped to FOK and FAK respectively). from_market_time_in_force bails for any other value because Polymarket market orders cannot be GTC/GTD.","triggerScenarios":"Submitting a MARKET order to Polymarket with time_in_force set to Gtc, Gtd, or any non-FOK/IOC value.","commonSituations":"Reusing a limit-order TIF (e.g. GTC) when constructing a market order; default order builders that set GTC regardless of order type.","solutions":["Use TimeInForce::Fok or TimeInForce::Ioc when creating Polymarket market orders","Adjust order-construction code to pick TIF based on OrderType (FOK/IOC for market, GTC/GTD for limit)","Validate TIF at order-build time before reaching the adapter"],"exampleFix":"// before\nOrderRequestBuilder::market().time_in_force(TimeInForce::Gtc) // bails\n// after\nOrderRequestBuilder::market().time_in_force(TimeInForce::Ioc) // or Fok","handlingStrategy":"validation","validationCode":"fn valid_market_tif(tif: TimeInForce) -> bool {\n    matches!(tif, TimeInForce::Fok | TimeInForce::Ioc)\n}","typeGuard":"fn is_market_order_tif(tif: TimeInForce) -> bool {\n    matches!(tif, TimeInForce::Fok | TimeInForce::Ioc)\n}","tryCatchPattern":"match PolymarketOrderType::from_market_time_in_force(tif) {\n    Ok(t) => submit(t),\n    Err(e) => return Err(format!(\"market order needs FOK/IOC: {e}\")),\n}","preventionTips":["Always pair market orders with FOK or IOC","Derive TIF from order type in a single builder helper","Add unit tests asserting market-order TIF constraints"],"tags":["polymarket","market-order","time-in-force","enum-conversion"],"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-14T00:17:10.932Z"}