nautechsystems/nautilus_trader · error

Unsupported `TimeInForce` for Polymarket market order: {valu

Error message

Unsupported `TimeInForce` for Polymarket market order: {value:?}

What it means

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.

Source

Thrown at crates/adapters/polymarket/src/common/enums.rs:323

    type Error = anyhow::Error;

    fn try_from(value: TimeInForce) -> anyhow::Result<Self> {
        match value {
            TimeInForce::Gtc => Ok(Self::GTC),
            TimeInForce::Gtd => Ok(Self::GTD),
            TimeInForce::Fok => Ok(Self::FOK),
            TimeInForce::Ioc => Ok(Self::FAK),
            _ => anyhow::bail!("Unsupported `TimeInForce` for Polymarket: {value:?}"),
        }
    }
}

impl PolymarketOrderType {
    pub(crate) fn from_market_time_in_force(value: TimeInForce) -> anyhow::Result<Self> {
        match value {
            TimeInForce::Fok => Ok(Self::FOK),
            TimeInForce::Ioc => Ok(Self::FAK),
            _ => anyhow::bail!("Unsupported `TimeInForce` for Polymarket market order: {value:?}"),
        }
    }
}

impl From<PolymarketOrderStatus> for OrderStatus {
    fn from(value: PolymarketOrderStatus) -> Self {
        match value {
            PolymarketOrderStatus::Invalid => Self::Rejected,
            PolymarketOrderStatus::Live => Self::Accepted,
            PolymarketOrderStatus::Delayed => Self::Accepted,
            PolymarketOrderStatus::Matched => Self::Filled,
            // Placement failure (never became live), treat as rejected
            PolymarketOrderStatus::Unmatched => Self::Rejected,
            PolymarketOrderStatus::Canceled => Self::Canceled,
            // Market resolved = order expired due to market settlement
            PolymarketOrderStatus::CanceledMarketResolved => Self::Expired,
        }
    }

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Use TimeInForce::Fok or TimeInForce::Ioc when creating Polymarket market orders
  2. Adjust order-construction code to pick TIF based on OrderType (FOK/IOC for market, GTC/GTD for limit)
  3. Validate TIF at order-build time before reaching the adapter

Example fix

// before
OrderRequestBuilder::market().time_in_force(TimeInForce::Gtc) // bails
// after
OrderRequestBuilder::market().time_in_force(TimeInForce::Ioc) // or Fok
Defensive patterns

Strategy: validation

Validate before calling

fn valid_market_tif(tif: TimeInForce) -> bool {
    matches!(tif, TimeInForce::Fok | TimeInForce::Ioc)
}

Type guard

fn is_market_order_tif(tif: TimeInForce) -> bool {
    matches!(tif, TimeInForce::Fok | TimeInForce::Ioc)
}

Try / catch

match PolymarketOrderType::from_market_time_in_force(tif) {
    Ok(t) => submit(t),
    Err(e) => return Err(format!("market order needs FOK/IOC: {e}")),
}

Prevention

When it happens

Trigger: Submitting a MARKET order to Polymarket with time_in_force set to Gtc, Gtd, or any non-FOK/IOC value.

Common situations: Reusing a limit-order TIF (e.g. GTC) when constructing a market order; default order builders that set GTC regardless of order type.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/ff7d3b6c00eb1241. Report an issue: GitHub.