{"record":{"id":"cb13493036a607d8","repo":"nautechsystems/nautilus_trader","slug":"add-funding-rate-not-implemented-for-postgresql-ca","errorCode":null,"errorMessage":"add_funding_rate not implemented for PostgreSQL cache adapter","messagePattern":"add_funding_rate not implemented for PostgreSQL cache adapter","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/infrastructure/src/sql/cache.rs","lineNumber":1052,"sourceCode":"                    if let Err(e) = tx.send(trades) {\n                        log::error!(\"Failed to send trades for instrument {instrument_id}: {e:?}\");\n                    }\n                }\n                Err(e) => {\n                    log::error!(\"Failed to load trades for instrument {instrument_id}: {e:?}\");\n                    if let Err(e) = tx.send(Vec::new()) {\n                        log::error!(\n                            \"Failed to send empty trades for instrument {instrument_id}: {e:?}\"\n                        );\n                    }\n                }\n            }\n        });\n        Ok(rx.recv()?)\n    }\n\n    fn add_funding_rate(&self, _funding_rate: &FundingRateUpdate) -> anyhow::Result<()> {\n        anyhow::bail!(\"add_funding_rate not implemented for PostgreSQL cache adapter\")\n    }\n\n    fn load_funding_rates(\n        &self,\n        _instrument_id: &InstrumentId,\n    ) -> anyhow::Result<Vec<FundingRateUpdate>> {\n        anyhow::bail!(\"load_funding_rates not implemented for PostgreSQL cache adapter\")\n    }\n\n    fn add_bar(&self, bar: &Bar) -> anyhow::Result<()> {\n        let query = DatabaseQuery::AddBar(bar.to_owned());\n        self.tx.send(query).map_err(|e| {\n            anyhow::anyhow!(\"Failed to send query add_bar to database message handler: {e}\")\n        })\n    }\n\n    fn load_bars(&self, instrument_id: &InstrumentId) -> anyhow::Result<Vec<Bar>> {\n        let pool = self.pool.clone();","sourceCodeStart":1034,"sourceCodeEnd":1070,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/infrastructure/src/sql/cache.rs#L1034-L1070","documentation":"add_funding_rate on the PostgreSQL cache adapter is not implemented: funding rate persistence has no SQL schema/insert path in this adapter, so calls fail with this explicit not-implemented marker rather than silently no-oping.","triggerScenarios":"A data engine or strategy writing funding rate updates to a PostgreSQL-backed cache — e.g. perpetuals trading configs that record funding rates via the cache database.","commonSituations":"Running derivatives (perp) strategies on a Postgres cache deployment; migrating from Redis where funding-rate persistence works; backtesting pipelines that persist funding updates.","solutions":["Persist funding rates with the Redis cache adapter, or disable funding-rate persistence in the data engine config","Store funding rates in a separate table/warehouse outside the cache adapter","Implement add_funding_rate (and load_funding_rates) in sql/cache.rs"],"exampleFix":"// before\ncache_db.add_funding_rate(&update)?; // bails on Postgres\n// after\nif let Err(e) = cache_db.add_funding_rate(&update) {\n    log::warn!(\"funding rate not persisted: {e}\");\n}","handlingStrategy":"fallback","validationCode":"if is_postgres_cache(&cache_db) { /* persist funding rates elsewhere or skip */ }","typeGuard":"fn is_postgres_cache(db: &dyn CacheDatabase) -> bool { db.as_any().downcast_ref::<PostgresCache>().is_some() }","tryCatchPattern":"if let Err(e) = cache_db.add_funding_rate(&update) {\n    if e.to_string().contains(\"not implemented\") {\n        log::warn!(\"funding rate persistence unavailable on SQL adapter\");\n    } else { return Err(e); }\n}","preventionTips":["Route funding-rate persistence to Redis or a dedicated store when on Postgres","Keep funding-rate history in a purpose-built table rather than the cache adapter","Confirm adapter support for derivatives data before configuring perp strategies"],"tags":["postgresql","cache","not-implemented","funding-rate"],"backgroundTag":"method-not-implemented","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"}