nautechsystems/nautilus_trader · error
{e}
Error message
{e} What it means
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).
Source
Thrown at crates/adapters/polymarket/src/execution/submitter.rs:161
/// `amount` for taker fees before signing so balance-sized BUYs are not
/// rejected by the venue. SELL ignores the context.
pub(crate) async fn submit_market_order(
&self,
request: MarketOrderSubmitRequest,
) -> anyhow::Result<MarketOrderSubmitResult> {
let MarketOrderSubmitRequest {
token_id,
side,
amount,
time_in_force,
neg_risk,
tick_size,
tick_decimals,
fee_context,
} = request;
let poly_side = PolymarketOrderSide::from(side);
let order_type = PolymarketOrderType::from_market_time_in_force(time_in_force)
.map_err(|e| anyhow::anyhow!("{e}"))?;
let amount_dec = amount.as_decimal();
let book = self
.http_client
.get_book(&token_id)
.await
.map_err(|e| anyhow::anyhow!("Failed to fetch order book: {e}"))?;
let levels = match poly_side {
PolymarketOrderSide::Buy => &book.asks,
PolymarketOrderSide::Sell => &book.bids,
};
let result = calculate_market_price(levels, amount_dec, poly_side).map_err(|e| {
let message = format!("Market price calculation failed: {e}");
e.context(message)
})?;
let price = PolymarketOrderBuilder::normalize_market_price(View on GitHub (pinned to 18893faf8b)
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
Example fix
// before
let req = MarketOrderSubmitRequest { time_in_force: TimeInForce::Gtc, .. };
submitter.submit_market_order(req).await?;
// after
let req = MarketOrderSubmitRequest { time_in_force: TimeInForce::Ioc, .. };
submitter.submit_market_order(req).await?; Defensive patterns
Strategy: validation
Validate before calling
if !matches!(tif, TimeInForce::Fok | TimeInForce::Ioc) {
return Err(anyhow!("Polymarket market orders require FOK or IOC, got {tif:?}"));
} Try / catch
match submit_market_order(req).await {
Ok(r) => r,
Err(e) if e.to_string().contains("Unsupported `TimeInForce`") => {
// resubmit with TimeInForce::Ioc or surface config error
}
Err(e) => return Err(e),
} Prevention
- Default market orders to IOC/FOK in strategy config
- Keep per-order-type TIF mappings explicit rather than global
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Lighter market orders support only TimeInForce::Gtc or TimeI
- Invalid order side: {e}
- Unsupported `TimeInForce` for Binance: {value:?}
- Binance Spot does not support native GTD; set use_gtd=false
- Unsupported TIF {time_in_force} for MARKET on Coinbase (use
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/f11db8bcf8d5403b.
Report an issue: GitHub.