{"record":{"id":"127ab05669a08c01","repo":"nautechsystems/nautilus_trader","slug":"no-cached-quote-for-instrument-id-subscribe-to","errorCode":null,"errorMessage":"no cached quote for {instrument_id}: subscribe to quotes before submitting MARKET orders","messagePattern":"no cached quote for (.+?): subscribe to quotes before submitting MARKET orders","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/execution.rs","lineNumber":1623,"sourceCode":"            base_amount > 0,\n            \"quantity `{}` rounds to 0 ticks at size_precision {}\",\n            order.quantity(),\n            instrument.size_precision(),\n        );\n        let price_precision = instrument.price_precision();\n        let is_buy = matches!(order.order_side(), OrderSide::Buy);\n\n        // Lighter requires `price` on market-style orders as the worst\n        // acceptable cap; derive it from far-side quote or trigger.\n        let price_ticks = match order.order_type() {\n            OrderType::Market => {\n                let quote = self\n                    .core\n                    .cache()\n                    .quote(&instrument_id)\n                    .copied()\n                    .ok_or_else(|| {\n                        anyhow::anyhow!(\n                            \"no cached quote for {instrument_id}: subscribe to quotes before submitting MARKET orders\",\n                        )\n                    })?;\n                let base = if is_buy {\n                    quote.ask_price.as_decimal()\n                } else {\n                    quote.bid_price.as_decimal()\n                };\n                derive_market_order_price_ticks(base, is_buy, price_precision, slippage_bps)?\n            }\n            OrderType::StopMarket | OrderType::MarketIfTouched => {\n                let trigger = order.trigger_price().ok_or_else(|| {\n                    anyhow::anyhow!(\"{:?} orders require a trigger_price\", order.order_type(),)\n                })?;\n                derive_market_order_price_ticks(\n                    trigger.as_decimal(),\n                    is_buy,\n                    price_precision,","sourceCodeStart":1605,"sourceCodeEnd":1641,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/execution.rs#L1605-L1641","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Subscribe to quotes for the instrument before submitting MARKET orders.","Wait until at least one quote has been received (gate submissions on data readiness).","Fall back to a LIMIT order with an explicit price if quotes are unavailable.","Check the market data subscription configuration and WS data feed health."],"exampleFix":"// before\ntrader.submit(order); // MARKET order, no quotes yet\n// after\nif cache.quote(&instrument_id).is_none() {\n    client.subscribe_quotes(instrument_id);\n    // wait for first quote or submit a limit order instead\n}\ntrader.submit(order);","handlingStrategy":"validation","validationCode":"// Rust\nanyhow::ensure!(\n    cache.quote(&instrument_id).is_some(),\n    \"no quote cached for {instrument_id}; subscribe and wait for first quote\"\n);","typeGuard":null,"tryCatchPattern":"match cache.quote(&instrument_id) {\n    Some(q) => submit_market_with_quote(q),\n    None => submit_limit_fallback_or_wait(),\n}","preventionTips":["Always subscribe to quotes for instruments traded with MARKET orders","Gate order submission on data readiness (first quote received)","Prefer LIMIT orders when quote freshness cannot be guaranteed"],"tags":["market-data","quotes","prerequisite","trading"],"backgroundTag":"empty-required-field","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}