{"record":{"id":"f0885baa34a43735","repo":"nautechsystems/nautilus_trader","slug":"lighter-self-has-no-nautilus-order-type-equi","errorCode":null,"errorMessage":"Lighter `{self:?}` has no Nautilus order-type equivalent","messagePattern":"Lighter `(.+?)` has no Nautilus order-type equivalent","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/adapters/lighter/src/common/enums.rs","lineNumber":630,"sourceCode":"    /// `StopLoss` / `StopLossLimit` map to Nautilus stop-on-the-loss-side\n    /// triggers (`StopMarket` / `StopLimit`), while `TakeProfit` /\n    /// `TakeProfitLimit` map to \"if-touched\" triggers\n    /// (`MarketIfTouched` / `LimitIfTouched`) which fire when price reaches\n    /// a target rather than crosses a stop.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error for venue-internal or algorithmic order types which\n    /// do not map to a single Nautilus order type.\n    pub fn as_nautilus(self) -> anyhow::Result<OrderType> {\n        match self {\n            Self::Limit => Ok(OrderType::Limit),\n            Self::Market => Ok(OrderType::Market),\n            Self::StopLoss => Ok(OrderType::StopMarket),\n            Self::StopLossLimit => Ok(OrderType::StopLimit),\n            Self::TakeProfit => Ok(OrderType::MarketIfTouched),\n            Self::TakeProfitLimit => Ok(OrderType::LimitIfTouched),\n            Self::Twap | Self::TwapSub | Self::Liquidation => Err(anyhow::anyhow!(\n                \"Lighter `{self:?}` has no Nautilus order-type equivalent\",\n            )),\n        }\n    }\n}\n\nimpl TryFrom<OrderType> for LighterOrderType {\n    type Error = anyhow::Error;\n\n    fn try_from(value: OrderType) -> Result<Self, Self::Error> {\n        match value {\n            OrderType::Limit => Ok(Self::Limit),\n            OrderType::Market => Ok(Self::Market),\n            OrderType::StopMarket => Ok(Self::StopLoss),\n            OrderType::StopLimit => Ok(Self::StopLossLimit),\n            OrderType::MarketIfTouched => Ok(Self::TakeProfit),\n            OrderType::LimitIfTouched => Ok(Self::TakeProfitLimit),\n            other => Err(anyhow::anyhow!(","sourceCodeStart":612,"sourceCodeEnd":648,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/common/enums.rs#L612-L648","documentation":"Converting a Lighter order type to its Nautilus equivalent (`as_nautilus`) fails for Lighter order types with no Nautilus mapping: Twap, TwapSub, and Liquidation. The adapter only maps Limit, Market, StopLoss, StopLossLimit, TakeProfit, and TakeProfitLimit.","triggerScenarios":"Calling `LighterOrderType::Twap.as_nautilus()` (or TwapSub/Liquidation), e.g. when translating a Lighter-side order type into a Nautilus order type during order handling or reconciliation.","commonSituations":"Processing/reconciling orders that were placed on Lighter directly (not via Nautilus) as TWAP or liquidation orders; testing variants explicitly (as the referenced test does).","solutions":["Avoid submitting or importing TWAP/liquidation order types through this adapter; use standard Limit/Market/stop types.","Implement TWAP logic at the strategy level using multiple Limit/Market orders.","If you must handle these types, match them explicitly before calling `as_nautilus` and handle the error path."],"exampleFix":"// before\nlet order_type = lighter_type.as_nautilus()?;\n// after\nif matches!(lighter_type, LighterOrderType::Twap | LighterOrderType::TwapSub | LighterOrderType::Liquidation) {\n    anyhow::bail!(\"unsupported Lighter order type for this strategy: {lighter_type:?}\");\n}\nlet order_type = lighter_type.as_nautilus()?;","handlingStrategy":"try-catch","validationCode":"if matches!(lighter_type, LighterOrderType::Twap | LighterOrderType::TwapSub | LighterOrderType::Liquidation) {\n    // handle before calling as_nautilus\n}","typeGuard":"fn is_mappable_to_nautilus(t: &LighterOrderType) -> bool {\n    !matches!(t, LighterOrderType::Twap | LighterOrderType::TwapSub | LighterOrderType::Liquidation)\n}","tryCatchPattern":"match lighter_type.as_nautilus() {\n    Ok(t) => use_nautilus_type(t),\n    Err(e) => log::warn!(\"skipping unmappable Lighter order type: {e}\"),\n}","preventionTips":["Do not import TWAP/liquidation orders placed directly on Lighter into Nautilus.","Implement TWAP at the strategy level with standard orders.","Filter reconciliation reports for unmappable order types."],"tags":["order-type","mapping","lighter","unsupported"],"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"}