{"record":{"id":"b86401b4d7055933","repo":"nautechsystems/nautilus_trader","slug":"funding-rates-not-available-for-product-type-i","errorCode":null,"errorMessage":"Funding rates not available for {product_type:?} instruments","messagePattern":"Funding rates not available for (.+?) instruments","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/bybit/src/data.rs","lineNumber":1128,"sourceCode":"        self.spawn_ws(\n            async move {\n                ws.subscribe_trades(instrument_id)\n                    .await\n                    .context(\"trades subscription\")\n            },\n            \"trade subscription\",\n        );\n        Ok(())\n    }\n\n    fn subscribe_funding_rates(&mut self, cmd: SubscribeFundingRates) -> 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 || product_type == BybitProductType::Option {\n            anyhow::bail!(\"Funding rates not available for {product_type:?} instruments\");\n        }\n\n        let guard = self.instruments.load();\n        if let Some(instrument) = guard.get(&instrument_id)\n            && !matches!(instrument, InstrumentAny::CryptoPerpetual(_))\n        {\n            anyhow::bail!(\"Funding rates only available for perpetuals, not {instrument_id}\");\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(\"funding\");\n        });\n\n        if should_subscribe {\n            let ws = self","sourceCodeStart":1110,"sourceCodeEnd":1146,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bybit/src/data.rs#L1110-L1146","documentation":"Funding rates only exist for derivative instruments on Bybit. When subscribing to funding rates, the adapter resolves the product type for the requested instrument and bails immediately if it resolves to Spot or Option, since those products have no funding payments.","triggerScenarios":"subscribe_funding_rates called with a Spot or Option instrument ID (or one whose product type defaults/resolves to Spot/Option), e.g. BTCUSDT on spot instead of the perpetual.","commonSituations":"Using an unqualified symbol that resolves to the spot instrument; configuring a funding-rate subscription across all instruments including options; copying a subscription loop from a derivatives-only venue.","solutions":["Subscribe using the perpetual instrument ID (e.g. BTCUSDT-PERP.Linear) not spot","Ensure the instrument-to-product-type map registers the correct product type so resolution doesn't default wrongly","Filter out Spot and Option instruments before bulk funding-rate subscriptions"],"exampleFix":"// before\nsubscribe_funding_rates(BTCUSDT.SPOT) // bails\n// after\nsubscribe_funding_rates(BTCUSDT-PERP.LINEAR) // perpetual","handlingStrategy":"validation","validationCode":"let pt = client.get_product_type_for_instrument(instrument_id).unwrap_or(BybitProductType::Linear);\nif matches!(pt, BybitProductType::Spot | BybitProductType::Option) {\n    skip_funding_subscription(instrument_id);\n}","typeGuard":"fn supports_funding(inst: &InstrumentAny) -> bool {\n    matches!(inst, InstrumentAny::CryptoPerpetual(_))\n}","tryCatchPattern":"match client.subscribe_funding_rates(cmd) {\n    Err(e) if e.to_string().contains(\"Funding rates\") => {\n        log::debug!(\"skipping funding for non-derivative: {e}\");\n    }\n    r => r?,\n}","preventionTips":["Qualify instrument IDs to the perpetual (e.g. BTCUSDT-PERP.Linear)","Filter Spot/Option instruments out of funding-rate subscription batches","Keep the instrument-to-product-type cache accurate"],"tags":["bybit","funding-rates","unsupported-instrument","perpetual"],"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"}