{"record":{"id":"81f081232682f828","repo":"nautechsystems/nautilus_trader","slug":"lighter-kind-has-no-nautilus-order-type-equi","errorCode":null,"errorMessage":"Lighter `{kind:?}` has no Nautilus order-type equivalent","messagePattern":"Lighter `(.+?)` has no Nautilus order-type equivalent","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/adapters/lighter/src/websocket/parse.rs","lineNumber":1230,"sourceCode":"}\n\nfn nautilus_order_side(side: LighterOrderSide) -> OrderSide {\n    match side {\n        LighterOrderSide::Buy => OrderSide::Buy,\n        LighterOrderSide::Sell => OrderSide::Sell,\n    }\n}\n\nfn nautilus_order_type(kind: LighterOrderKind) -> anyhow::Result<OrderType> {\n    match kind {\n        LighterOrderKind::Limit => Ok(OrderType::Limit),\n        LighterOrderKind::Market => Ok(OrderType::Market),\n        LighterOrderKind::StopLoss => Ok(OrderType::StopMarket),\n        LighterOrderKind::StopLossLimit => Ok(OrderType::StopLimit),\n        LighterOrderKind::TakeProfit => Ok(OrderType::MarketIfTouched),\n        LighterOrderKind::TakeProfitLimit => Ok(OrderType::LimitIfTouched),\n        LighterOrderKind::Twap | LighterOrderKind::TwapSub | LighterOrderKind::Liquidation => Err(\n            anyhow::anyhow!(\"Lighter `{kind:?}` has no Nautilus order-type equivalent\",),\n        ),\n    }\n}\n\nfn nautilus_time_in_force(\n    tif: LighterOrderTimeInForce,\n    order_expiry: i64,\n) -> (TimeInForce, Option<UnixNanos>) {\n    match tif {\n        LighterOrderTimeInForce::ImmediateOrCancel => (TimeInForce::Ioc, None),\n        LighterOrderTimeInForce::PostOnly | LighterOrderTimeInForce::GoodTillTime => {\n            // Lighter uses positive expiry for GTD and nonpositive expiry for GTC;\n            // PostOnly uses the same expiry field plus an independent report flag.\n            if order_expiry > 0 {\n                match parse_millis_to_nanos(order_expiry as u64) {\n                    Ok(expiry) => (TimeInForce::Gtd, Some(expiry)),\n                    Err(_) => (TimeInForce::Gtc, None),\n                }","sourceCodeStart":1212,"sourceCodeEnd":1248,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/websocket/parse.rs#L1212-L1248","documentation":"nautilus_order_type maps Lighter's order-kind enum onto NautilusTrader's OrderType. Most kinds have direct equivalents, but TWAP, TWAP-sub-orders, and Liquidation orders have no Nautilus order-type representation, so the mapping intentionally returns an error rather than guessing a lossy type.","triggerScenarios":"parse_ws_order_status_report processes an order-status update for an order whose kind is LighterOrderKind::Twap, TwapSub, or Liquidation — typically an exchange-initiated liquidation or an algorithmic TWAP order placed outside this adapter.","commonSituations":"Your account gets liquidated (or partially liquidated by the exchange) and the resulting order update cannot be translated; a TWAP algo order is placed directly on the Lighter UI/API and then appears in the adapter's order stream; backtesting/reconciliation pulls history containing unsupported order kinds.","solutions":["Skip (with a warning log) order-status reports whose order type cannot be mapped, instead of failing the whole websocket message batch, if you only need the mappable orders.","Avoid placing TWAP/algorithmic orders through Lighter's native algo endpoints when using this adapter; place plain limit/market/stop orders it can represent.","Track liquidation events separately (account balance/position updates) rather than relying on the order-status stream, since Liquidation orders are exchange-initiated.","If you must consume these reports, file/extend support by adding explicit mappings or an OrderType passthrough for these kinds."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"fn is_mappable(kind: &LighterOrderKind) -> bool {\n    !matches!(kind, LighterOrderKind::Twap | LighterOrderKind::TwapSub | LighterOrderKind::Liquidation)\n}","typeGuard":null,"tryCatchPattern":"match nautilus_order_type(kind) {\n    Ok(t) => use_type(t),\n    Err(e) => log::warn!(\"ignoring unmappable Lighter order kind: {e}\"),\n}","preventionTips":["Do not place TWAP or algo orders natively on Lighter when using this adapter.","Monitor liquidations via balance/position updates rather than order-status translation.","Handle unmappable order kinds as skipped reports, not fatal stream errors."],"tags":["rust","orders","enum-mapping","websocket"],"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"}