nautechsystems/nautilus_trader · error

Lighter conditional market orders do not support TimeInForce

Error message

Lighter conditional market orders do not support TimeInForce::{other:?}

What it means

Catch-all rejection for conditional market orders on Lighter whose TimeInForce is none of Gtc/Day/Gtd (accepted), Ioc and Fok (dedicated errors). Any other TIF value has no mapping to a Lighter conditional-market TIF and is rejected here.

Source

Thrown at crates/adapters/lighter/src/websocket/dispatch.rs:2012

            ),
            other => anyhow::bail!(
                "Lighter market orders support only TimeInForce::Gtc or TimeInForce::Ioc, was TimeInForce::{other:?}",
            ),
        };
    }

    if is_conditional_market_order(order_type) {
        return match tif {
            TimeInForce::Gtc | TimeInForce::Day | TimeInForce::Gtd => {
                Ok(LighterTimeInForce::ImmediateOrCancel)
            }
            TimeInForce::Ioc => anyhow::bail!(
                "Lighter conditional market orders require a positive expiry; Nautilus IOC cannot be represented because the venue uses IOC for post-trigger execution",
            ),
            TimeInForce::Fok => anyhow::bail!(
                "Lighter has no fill-or-kill TIF; reject FOK at the strategy or use IOC explicitly",
            ),
            other => anyhow::bail!(
                "Lighter conditional market orders do not support TimeInForce::{other:?}",
            ),
        };
    }

    match tif {
        TimeInForce::Ioc => Ok(LighterTimeInForce::ImmediateOrCancel),
        TimeInForce::Fok => anyhow::bail!(
            "Lighter has no fill-or-kill TIF; reject FOK at the strategy or use IOC explicitly",
        ),
        TimeInForce::Gtc | TimeInForce::Day | TimeInForce::Gtd => {
            Ok(LighterTimeInForce::GoodTillTime)
        }
        other => anyhow::bail!("Lighter does not support TimeInForce::{other:?}"),
    }
}

/// Translate a Nautilus [`OrderType`] into the venue's [`LighterOrderType`]

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Use TimeInForce::Gtc, Day, or Gtd for conditional market orders
  2. Check the TimeInForce value actually set on the order; it may come from a factory default
  3. Keep the adapter updated when the Nautilus TimeInForce enum gains new variants
Defensive patterns

Strategy: validation

Validate before calling

// Rust
assert!(matches!(tif, TimeInForce::Gtc | TimeInForce::Day | TimeInForce::Gtd), "Lighter conditional market orders accept Gtc/Day/Gtd only");

Type guard

fn is_lighter_conditional_tif(tif: TimeInForce) -> bool {
    matches!(tif, TimeInForce::Gtc | TimeInForce::Day | TimeInForce::Gtd)
}

Prevention

When it happens

Trigger: Submitting a conditional market order with a TIF outside {Gtc, Day, Gtd, Ioc, Fok} — e.g. TimeInForce::AtTheOpen, TimeInForce::AtTheClose, or other less-common enum variants.

Common situations: Strategies using venue-agnostic TIF constants that resolve to exotic variants; enum drift after a Nautilus version adds new TimeInForce members not yet handled by the adapter.

Related errors


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