nautechsystems/nautilus_trader · error
Lighter has no fill-or-kill TIF; reject FOK at the strategy
Error message
Lighter has no fill-or-kill TIF; reject FOK at the strategy or use IOC explicitly
What it means
Raised when translating an order's time-in-force for a Lighter market order with TimeInForce::Fok. Lighter's market orders only support GTC (mapped to ImmediateOrCancel) and IOC; there is no fill-or-kill TIF on the venue, so FOK is rejected with this guidance message.
Source
Thrown at crates/adapters/lighter/src/websocket/dispatch.rs:1992
/// execution instruction, but their trigger lifetime is controlled by a
/// positive `OrderExpiry`.
///
/// FOK ("fill or kill") is rejected because Lighter has no native
/// fill-or-kill primitive: routing FOK as IOC would let a partial fill
/// satisfy the request, violating the FOK guarantee.
pub(crate) fn nautilus_to_lighter_tif(
order_type: OrderType,
tif: TimeInForce,
post_only: bool,
) -> anyhow::Result<LighterTimeInForce> {
if post_only {
return Ok(LighterTimeInForce::PostOnly);
}
if order_type == OrderType::Market {
return match tif {
TimeInForce::Gtc | 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",
),
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",View on GitHub (pinned to 18893faf8b)
Solutions
- Change the strategy/submit call to use TimeInForce::Ioc for market orders (nearest semantics to FOK on Lighter).
- Use a LIMIT PostOnly or IOC order if fill-all-or-nothing semantics are mandatory; emulate FOK at the strategy level (cancel unfilled remainder).
- Update the order factory/emulator config so market orders default to GTC or IOC.
- Add pre-submit validation in your strategy that rejects FOK for Lighter instruments.
- If FOK support appears in a newer Lighter API, upgrade the adapter and revisit this mapping.
Example fix
// before
let order = order_factory.market(
instrument_id, OrderSide::Buy, qty,
TimeInForce::Fok, None, // rejected by Lighter
);
// after
let order = order_factory.market(
instrument_id, OrderSide::Buy, qty,
TimeInForce::Ioc, None,
); Defensive patterns
Strategy: validation
Validate before calling
// reject FOK market orders before submission
if order_type == OrderType::Market && tif == TimeInForce::Fok {
return Err("Lighter market orders do not support FOK; use IOC".into());
} Try / catch
match translate_tif(order_type, tif) {
Err(e) if e.to_string().contains("fill-or-kill") => {
log::warn!("downgrading FOK to IOC for Lighter");
translate_tif(order_type, TimeInForce::Ioc)?
}
r => r?,
} Prevention
- Configure strategies to use IOC/GTC for Lighter market orders
- Audit order-factory defaults for venue-incompatible TIFs
- Emulate FOK semantics at the strategy layer (cancel remainder)
- Check venue TIF support before porting strategies from other exchanges
When it happens
Trigger: Submitting a Lighter MARKET order with tif = TimeInForce::Fok — e.g. a strategy configured for FOK market entries, or code defaulting market orders to FOK — hits this bail in the TIF translation before the order reaches the exchange.
Common situations: Porting a strategy from another venue (e.g. Binance/Crypto.com) that supports FOK without adjusting TIF for Lighter; backtest code that assumes universal FOK support; a default TimeInForce::Fok in an order factory configuration.
Related errors
- AX requires whole contract quantities, was {}
- Order quantity must be at least 1 contract
- Unsupported order type: {:?}, the Architect AX adapter accep
- post-only Derive orders only support GTC time in force; rece
- missing trigger price for Derive trigger order {}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/96b1eb71eb409b9f.
Report an issue: GitHub.