{"record":{"id":"f11db8bcf8d5403b","repo":"nautechsystems/nautilus_trader","slug":"e-f11db8","errorCode":null,"errorMessage":"{e}","messagePattern":"\\{e\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/polymarket/src/execution/submitter.rs","lineNumber":161,"sourceCode":"    /// `amount` for taker fees before signing so balance-sized BUYs are not\n    /// rejected by the venue. SELL ignores the context.\n    pub(crate) async fn submit_market_order(\n        &self,\n        request: MarketOrderSubmitRequest,\n    ) -> anyhow::Result<MarketOrderSubmitResult> {\n        let MarketOrderSubmitRequest {\n            token_id,\n            side,\n            amount,\n            time_in_force,\n            neg_risk,\n            tick_size,\n            tick_decimals,\n            fee_context,\n        } = request;\n        let poly_side = PolymarketOrderSide::from(side);\n        let order_type = PolymarketOrderType::from_market_time_in_force(time_in_force)\n            .map_err(|e| anyhow::anyhow!(\"{e}\"))?;\n        let amount_dec = amount.as_decimal();\n\n        let book = self\n            .http_client\n            .get_book(&token_id)\n            .await\n            .map_err(|e| anyhow::anyhow!(\"Failed to fetch order book: {e}\"))?;\n\n        let levels = match poly_side {\n            PolymarketOrderSide::Buy => &book.asks,\n            PolymarketOrderSide::Sell => &book.bids,\n        };\n\n        let result = calculate_market_price(levels, amount_dec, poly_side).map_err(|e| {\n            let message = format!(\"Market price calculation failed: {e}\");\n            e.context(message)\n        })?;\n        let price = PolymarketOrderBuilder::normalize_market_price(","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/polymarket/src/execution/submitter.rs#L143-L179","documentation":"This is a pass-through error raised in `OrderSubmitter::submit_market_order` when converting the strategy's `TimeInForce` to a Polymarket order type fails. Polymarket market orders only accept FOK (fill-or-kill) and IOC (immediate-or-cancel); the wrapped message is 'Unsupported `TimeInForce` for Polymarket market order: {value:?}'. It prevents submitting a market order whose time-in-force semantics Polymarket cannot honor (e.g. GTC/GTD, which are resting order types).","triggerScenarios":"Calling submit_market_order with time_in_force = Gtc, Gtd, or any other non-FOK/IOC variant; e.g. a strategy configured with default GTC time-in-force submitting a marketable order.","commonSituations":"Strategy configs that set TimeInForce globally (GTC) without overriding for market orders; porting limit-order logic to market orders; adapter versions where new TimeInForce variants were added but market-order mapping was not extended.","solutions":["Set the market order's time_in_force to TimeInForce::Fok or TimeInForce::Ioc before submitting","If the order is meant to rest, submit it via the limit-order path (submit/prepare_limit_order_submission) instead","Audit strategy configuration so TimeInForce is mapped per order type"],"exampleFix":"// before\nlet req = MarketOrderSubmitRequest { time_in_force: TimeInForce::Gtc, .. };\nsubmitter.submit_market_order(req).await?;\n// after\nlet req = MarketOrderSubmitRequest { time_in_force: TimeInForce::Ioc, .. };\nsubmitter.submit_market_order(req).await?;","handlingStrategy":"validation","validationCode":"if !matches!(tif, TimeInForce::Fok | TimeInForce::Ioc) {\n    return Err(anyhow!(\"Polymarket market orders require FOK or IOC, got {tif:?}\"));\n}","typeGuard":null,"tryCatchPattern":"match submit_market_order(req).await {\n    Ok(r) => r,\n    Err(e) if e.to_string().contains(\"Unsupported `TimeInForce`\") => {\n        // resubmit with TimeInForce::Ioc or surface config error\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Default market orders to IOC/FOK in strategy config","Keep per-order-type TIF mappings explicit rather than global"],"tags":["rust","polymarket","time-in-force","order-submission"],"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"}