{"record":{"id":"8bb4a23dca82d213","repo":"nautechsystems/nautilus_trader","slug":"bybit-does-not-support-kline-bar-data-for-options","errorCode":null,"errorMessage":"Bybit does not support kline/bar data for options","messagePattern":"Bybit does not support kline/bar data for options","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/bybit/src/data.rs","lineNumber":1241,"sourceCode":"                    ws.subscribe_ticker(instrument_id)\n                        .await\n                        .context(\"ticker subscription for index prices\")\n                },\n                \"index price subscription\",\n            );\n        }\n        Ok(())\n    }\n\n    fn subscribe_bars(&mut self, cmd: SubscribeBars) -> anyhow::Result<()> {\n        let bar_type = cmd.bar_type;\n        let instrument_id = bar_type.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::Option {\n            anyhow::bail!(\"Bybit does not support kline/bar data for options\");\n        }\n\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_bars(bar_type)\n                    .await\n                    .context(\"bars subscription\")\n            },\n            \"bar subscription\",\n        );\n        Ok(())\n    }\n","sourceCodeStart":1223,"sourceCodeEnd":1259,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bybit/src/data.rs#L1223-L1259","documentation":"This error is raised when requesting bar (candlestick/kline) subscriptions for an Option instrument on Bybit. Bybit's kline WebSocket topic does not cover options, so the adapter rejects the bar subscription before opening a stream.","triggerScenarios":"Calling subscribe_bars with a BarType whose instrument resolves to BybitProductType::Option (e.g. option symbols like BTC-28JUN24-65000-C.SBYBIT).","commonSituations":"Building bar-based strategies on option chains; a generic data loader that subscribes bars for every instrument in a portfolio including options.","solutions":["Use Linear/Inverse/Spot instruments for bar data on Bybit","Obtain options OHLC via REST history requests if needed, or a different data provider","Filter options out of bar subscription loops"],"exampleFix":"// before\nlet bar_type = BarType::from(\"BTC-28JUN24-65000-C.SBYBIT-1-MINUTE-LAST\");\ndata_engine.subscribe_bars(bar_type); // error\n// after\nlet bar_type = BarType::from(\"BTCUSDT-PERP.SBYBIT-1-MINUTE-LAST\");\ndata_engine.subscribe_bars(bar_type);","handlingStrategy":"validation","validationCode":"let instrument = cache.instrument(&bar_type.instrument_id()).expect(\"instrument not found\");\nif is_option_product(&instrument) {\n    // Bybit has no kline stream for options; fetch history via REST or skip\n    return Ok(());\n}\ndata_engine.subscribe_bars(bar_type)?;","typeGuard":null,"tryCatchPattern":"match data_engine.subscribe_bars(bar_type) {\n    Err(e) if e.to_string().contains(\"does not support kline/bar data for options\") => {\n        // request historical bars via REST or use a different provider\n    }\n    r => r?,\n}","preventionTips":["Filter option symbols out of bar subscription lists","Check Bybit kline topic coverage per product type before building strategies","Keep options analytics on a dedicated data source"],"tags":["bybit","options","bars","kline","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"}