nautechsystems/nautilus_trader · warning
Lighter `{self:?}` has no Nautilus order-type equivalent
Error message
Lighter `{self:?}` has no Nautilus order-type equivalent What it means
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.
Source
Thrown at crates/adapters/lighter/src/common/enums.rs:630
/// `StopLoss` / `StopLossLimit` map to Nautilus stop-on-the-loss-side
/// triggers (`StopMarket` / `StopLimit`), while `TakeProfit` /
/// `TakeProfitLimit` map to "if-touched" triggers
/// (`MarketIfTouched` / `LimitIfTouched`) which fire when price reaches
/// a target rather than crosses a stop.
///
/// # Errors
///
/// Returns an error for venue-internal or algorithmic order types which
/// do not map to a single Nautilus order type.
pub fn as_nautilus(self) -> anyhow::Result<OrderType> {
match self {
Self::Limit => Ok(OrderType::Limit),
Self::Market => Ok(OrderType::Market),
Self::StopLoss => Ok(OrderType::StopMarket),
Self::StopLossLimit => Ok(OrderType::StopLimit),
Self::TakeProfit => Ok(OrderType::MarketIfTouched),
Self::TakeProfitLimit => Ok(OrderType::LimitIfTouched),
Self::Twap | Self::TwapSub | Self::Liquidation => Err(anyhow::anyhow!(
"Lighter `{self:?}` has no Nautilus order-type equivalent",
)),
}
}
}
impl TryFrom<OrderType> for LighterOrderType {
type Error = anyhow::Error;
fn try_from(value: OrderType) -> Result<Self, Self::Error> {
match value {
OrderType::Limit => Ok(Self::Limit),
OrderType::Market => Ok(Self::Market),
OrderType::StopMarket => Ok(Self::StopLoss),
OrderType::StopLimit => Ok(Self::StopLossLimit),
OrderType::MarketIfTouched => Ok(Self::TakeProfit),
OrderType::LimitIfTouched => Ok(Self::TakeProfitLimit),
other => Err(anyhow::anyhow!(View on GitHub (pinned to 18893faf8b)
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.
Example fix
// before
let order_type = lighter_type.as_nautilus()?;
// after
if matches!(lighter_type, LighterOrderType::Twap | LighterOrderType::TwapSub | LighterOrderType::Liquidation) {
anyhow::bail!("unsupported Lighter order type for this strategy: {lighter_type:?}");
}
let order_type = lighter_type.as_nautilus()?; Defensive patterns
Strategy: try-catch
Validate before calling
if matches!(lighter_type, LighterOrderType::Twap | LighterOrderType::TwapSub | LighterOrderType::Liquidation) {
// handle before calling as_nautilus
} Type guard
fn is_mappable_to_nautilus(t: &LighterOrderType) -> bool {
!matches!(t, LighterOrderType::Twap | LighterOrderType::TwapSub | LighterOrderType::Liquidation)
} Try / catch
match lighter_type.as_nautilus() {
Ok(t) => use_nautilus_type(t),
Err(e) => log::warn!("skipping unmappable Lighter order type: {e}"),
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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).
Related errors
- Nautilus `{other:?}` has no Lighter order-type equivalent
- Unsupported order type for Betfair: {other:?}
- Unsupported order type for Binance Futures: {order_type:?}
- MarketToLimit order type is not supported by BitMEX
- unsupported order type for Bybit: {order_type}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/f0885baa34a43735.
Report an issue: GitHub.