nautechsystems/nautilus_trader · error

no cached quote for {instrument_id}: subscribe to quotes bef

Error message

no cached quote for {instrument_id}: subscribe to quotes before submitting MARKET orders

What it means

A MARKET order needs a reference price to derive limit-price ticks with slippage protection, but the cache holds no quote for the instrument. The adapter requires quote data to be subscribed (and received) before market orders can be converted into Lighter's signed limit-order representation.

Source

Thrown at crates/adapters/lighter/src/execution.rs:1623

            base_amount > 0,
            "quantity `{}` rounds to 0 ticks at size_precision {}",
            order.quantity(),
            instrument.size_precision(),
        );
        let price_precision = instrument.price_precision();
        let is_buy = matches!(order.order_side(), OrderSide::Buy);

        // Lighter requires `price` on market-style orders as the worst
        // acceptable cap; derive it from far-side quote or trigger.
        let price_ticks = match order.order_type() {
            OrderType::Market => {
                let quote = self
                    .core
                    .cache()
                    .quote(&instrument_id)
                    .copied()
                    .ok_or_else(|| {
                        anyhow::anyhow!(
                            "no cached quote for {instrument_id}: subscribe to quotes before submitting MARKET orders",
                        )
                    })?;
                let base = if is_buy {
                    quote.ask_price.as_decimal()
                } else {
                    quote.bid_price.as_decimal()
                };
                derive_market_order_price_ticks(base, is_buy, price_precision, slippage_bps)?
            }
            OrderType::StopMarket | OrderType::MarketIfTouched => {
                let trigger = order.trigger_price().ok_or_else(|| {
                    anyhow::anyhow!("{:?} orders require a trigger_price", order.order_type(),)
                })?;
                derive_market_order_price_ticks(
                    trigger.as_decimal(),
                    is_buy,
                    price_precision,

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Subscribe to quotes for the instrument before submitting MARKET orders.
  2. Wait until at least one quote has been received (gate submissions on data readiness).
  3. Fall back to a LIMIT order with an explicit price if quotes are unavailable.
  4. Check the market data subscription configuration and WS data feed health.

Example fix

// before
trader.submit(order); // MARKET order, no quotes yet
// after
if cache.quote(&instrument_id).is_none() {
    client.subscribe_quotes(instrument_id);
    // wait for first quote or submit a limit order instead
}
trader.submit(order);
Defensive patterns

Strategy: validation

Validate before calling

// Rust
anyhow::ensure!(
    cache.quote(&instrument_id).is_some(),
    "no quote cached for {instrument_id}; subscribe and wait for first quote"
);

Try / catch

match cache.quote(&instrument_id) {
    Some(q) => submit_market_with_quote(q),
    None => submit_limit_fallback_or_wait(),
}

Prevention

When it happens

Trigger: submit_order/submit_order_list with OrderType::Market while cache.quote(&instrument_id) is None — quotes never subscribed, or subscribed but no quote tick arrived yet.

Common situations: Submitting immediately after startup before the first quote arrives; forgetting to request quote data in the subscription/config; quiet markets with no recent quotes; reconnect wiping cached data.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/127ab05669a08c01. Report an issue: GitHub.