{"record":{"id":"355c4af62547b8ee","repo":"nautechsystems/nautilus_trader","slug":"mark-prices-not-available-for-spot-instruments","errorCode":null,"errorMessage":"Mark prices not available for Spot instruments","messagePattern":"Mark prices not available for Spot instruments","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/bybit/src/data.rs","lineNumber":1170,"sourceCode":"                async move {\n                    ws.subscribe_ticker(instrument_id)\n                        .await\n                        .context(\"ticker subscription for funding rates\")\n                },\n                \"funding rate subscription\",\n            );\n        }\n        Ok(())\n    }\n\n    fn subscribe_mark_prices(&mut self, cmd: SubscribeMarkPrices) -> anyhow::Result<()> {\n        let instrument_id = cmd.instrument_id;\n        let product_type = self\n            .get_product_type_for_instrument(instrument_id)\n            .unwrap_or(BybitProductType::Linear);\n\n        if product_type == BybitProductType::Spot {\n            anyhow::bail!(\"Mark prices not available for Spot instruments\");\n        }\n\n        let mut should_subscribe = false;\n        self.ticker_subs.rcu(|m| {\n            let entry = m.entry(instrument_id).or_default();\n            should_subscribe = entry.is_empty();\n            entry.insert(\"mark_prices\");\n        });\n\n        if should_subscribe {\n            let ws = self\n                .get_ws_client_for_product(product_type)\n                .context(\"no WebSocket client for product type\")?\n                .clone();\n\n            self.spawn_ws(\n                async move {\n                    ws.subscribe_ticker(instrument_id)","sourceCodeStart":1152,"sourceCodeEnd":1188,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bybit/src/data.rs#L1152-L1188","documentation":"This error is raised when subscribing to mark prices for a Spot instrument on Bybit. Bybit's WebSocket does not provide mark-price streams for Spot product types, so the adapter rejects the subscription early. The subscription is only valid for Linear, Inverse, and Option instruments.","triggerScenarios":"Calling subscribe_mark_prices (via DataEngine.subscribe_mark_prices or SubscribeMarkPrices command) with an instrument_id whose symbol suffix maps to Bybit Spot (e.g. BTCUSDT.SBYBIT resolved to Spot).","commonSituations":"Configuring a strategy that assumes mark prices exist for all instruments; reusing a data pipeline built for perp/futures symbols with Spot symbols; get_product_type_for_instrument returning Spot from the symbol suffix.","solutions":["Use Linear (perpetual) or Inverse instrument IDs instead of Spot for mark-price subscriptions","Skip mark-price subscription logic for Spot instruments in your strategy configuration","Use last trade price / ticker data for Spot instruments instead of mark prices"],"exampleFix":"// before\nlet instrument_id = InstrumentId::from(\"BTCUSDT.SBYBIT\"); // Spot\ndata_engine.subscribe_mark_prices(instrument_id);\n// after\nlet instrument_id = InstrumentId::from(\"BTCUSDT-PERP.SBYBIT\"); // Linear\ndata_engine.subscribe_mark_prices(instrument_id);","handlingStrategy":"validation","validationCode":"let instrument = cache.instrument(&instrument_id).expect(\"instrument not found\");\nif instrument.asset_class() == AssetClass::SPOT /* or product type Spot */ {\n    // skip mark price subscription, use ticker data instead\n    return Ok(());\n}\ndata_engine.subscribe_mark_prices(instrument_id)?;","typeGuard":null,"tryCatchPattern":"match data_engine.subscribe_mark_prices(instrument_id) {\n    Err(e) if e.to_string().contains(\"Mark prices not available for Spot\") => {\n        // fall back to quote/ticker data\n    }\n    r => r?,\n}","preventionTips":["Resolve the instrument's product type before subscribing to derivatives-only feeds","Keep Spot and derivatives instruments in separate subscription paths","Document which data feeds are venue/product-specific in your strategy config"],"tags":["bybit","spot","mark-prices","websocket","unsupported-instrument"],"backgroundTag":"unsupported-operation","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"}