{"record":{"id":"9403c6248377285d","repo":"nautechsystems/nautilus_trader","slug":"lighter-market-orders-support-only-timeinforce-gt","errorCode":null,"errorMessage":"Lighter market orders support only TimeInForce::Gtc or TimeInForce::Ioc, was TimeInForce::{other:?}","messagePattern":"Lighter market orders support only TimeInForce::Gtc or TimeInForce::Ioc, was TimeInForce::(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/websocket/dispatch.rs","lineNumber":1995,"sourceCode":"/// FOK (\"fill or kill\") is rejected because Lighter has no native\n/// fill-or-kill primitive: routing FOK as IOC would let a partial fill\n/// satisfy the request, violating the FOK guarantee.\npub(crate) fn nautilus_to_lighter_tif(\n    order_type: OrderType,\n    tif: TimeInForce,\n    post_only: bool,\n) -> anyhow::Result<LighterTimeInForce> {\n    if post_only {\n        return Ok(LighterTimeInForce::PostOnly);\n    }\n\n    if order_type == OrderType::Market {\n        return match tif {\n            TimeInForce::Gtc | TimeInForce::Ioc => Ok(LighterTimeInForce::ImmediateOrCancel),\n            TimeInForce::Fok => anyhow::bail!(\n                \"Lighter has no fill-or-kill TIF; reject FOK at the strategy or use IOC explicitly\",\n            ),\n            other => anyhow::bail!(\n                \"Lighter market orders support only TimeInForce::Gtc or TimeInForce::Ioc, was TimeInForce::{other:?}\",\n            ),\n        };\n    }\n\n    if is_conditional_market_order(order_type) {\n        return match tif {\n            TimeInForce::Gtc | TimeInForce::Day | TimeInForce::Gtd => {\n                Ok(LighterTimeInForce::ImmediateOrCancel)\n            }\n            TimeInForce::Ioc => anyhow::bail!(\n                \"Lighter conditional market orders require a positive expiry; Nautilus IOC cannot be represented because the venue uses IOC for post-trigger execution\",\n            ),\n            TimeInForce::Fok => anyhow::bail!(\n                \"Lighter has no fill-or-kill TIF; reject FOK at the strategy or use IOC explicitly\",\n            ),\n            other => anyhow::bail!(\n                \"Lighter conditional market orders do not support TimeInForce::{other:?}\",","sourceCodeStart":1977,"sourceCodeEnd":2013,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/websocket/dispatch.rs#L1977-L2013","documentation":"The Lighter adapter rejects Nautilus market orders whose TimeInForce is not GTC or IOC. Lighter market orders are always immediate-or-cancel on the venue, so GTC/IOC map to ImmediateOrCancel, while any other TIF (e.g. Day, Gtd, AtTheClose) has no venue representation and is rejected at order-submission translation time with this bail! error.","triggerScenarios":"Submitting an OrderType::Market to the Lighter adapter with TimeInForce::Day, TimeInForce::Gtd, or any TIF other than Gtc/Ioc (Fok hits its own earlier match arm). This happens in the TIF translation path in nautilus_to_lighter_tif called during CreateOrder tx construction.","commonSituations":"Strategy defaults or config files that set tif=DAY or GTD on all orders; templates built for equity/futures venues where Day orders are valid; porting a strategy from another adapter without reviewing per-order TIF.","solutions":["Change the market order to TimeInForce::Gtc or TimeInForce::Ioc before submission","If day/expiring behavior is required, implement a strategy-level timer to cancel unexecuted IOC orders instead of relying on venue TIF","Validate orders in a strategy pre-submit hook and log/reject unsupported TIFs early"],"exampleFix":"// before\norder = order_factory.market(instrument_id, side, qty, tif=TimeInForce.DAY)\n// after\norder = order_factory.market(instrument_id, side, qty, tif=TimeInForce.GTC)","handlingStrategy":"validation","validationCode":"// Rust\nfn is_lighter_market_tif(tif: TimeInForce) -> bool {\n    matches!(tif, TimeInForce::Gtc | TimeInForce::Ioc)\n}\nassert!(is_lighter_market_tif(order.tif()), \"Lighter market order requires GTC or IOC\");","typeGuard":"fn is_gtc_or_ioc(tif: TimeInForce) -> bool {\n    matches!(tif, TimeInForce::Gtc | TimeInForce::Ioc)\n}","tryCatchPattern":null,"preventionTips":["Default market-order TIF to IOC for Lighter strategies","Add a pre-submit assertion on order TIF","Document venue TIF support in strategy config schemas"],"tags":["rust","order-submission","time-in-force","exchange-adapter"],"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-14T00:17:10.932Z"}