{"record":{"id":"717bcce5c119a5ae","repo":"nautechsystems/nautilus_trader","slug":"no-rate-data-for-currency-at-monthly-key-or-q","errorCode":null,"errorMessage":"No rate data for {currency} at {monthly_key} or {quarterly_key}","messagePattern":"No rate data for (.+?) at (.+?) or (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/backtest/src/modules/fx_rollover.rs","lineNumber":194,"sourceCode":"        let currency_rates = self\n            .rates\n            .get(currency)\n            .ok_or_else(|| anyhow::anyhow!(\"No rate data for currency {currency}\"))?;\n\n        // Try monthly key first\n        let monthly_key = format!(\"{}-{:02}\", date.year(), date.month());\n        if let Some(&rate) = currency_rates.get(&monthly_key) {\n            return Ok(rate);\n        }\n\n        // Fall back to quarterly key\n        let quarter = (date.month() - 1) / 3 + 1;\n        let quarterly_key = format!(\"{}-Q{quarter}\", date.year());\n        if let Some(&rate) = currency_rates.get(&quarterly_key) {\n            return Ok(rate);\n        }\n\n        anyhow::bail!(\"No rate data for {currency} at {monthly_key} or {quarterly_key}\")\n    }\n}\n\n/// Simulates FX rollover (swap) interest applied at 5 PM US/Eastern daily.\n///\n/// When holding FX positions overnight, the interest rate differential\n/// between the two currencies is credited or debited. Wednesday and Friday\n/// rollovers are tripled (Wednesday for T+2 settlement, Friday for the weekend).\n#[derive(Debug, Clone)]\n#[cfg_attr(\n    feature = \"python\",\n    pyo3_stub_gen::derive::gen_stub_pyclass(module = \"nautilus_trader.backtest\")\n)]\n#[cfg_attr(\n    feature = \"python\",\n    pyo3::pyclass(\n        module = \"nautilus_trader.backtest\",\n        extends = PySimulationModule,","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/backtest/src/modules/fx_rollover.rs#L176-L212","documentation":"Lookup miss in FxRolloverInterestRate::lookup_rate: the rate table is keyed monthly (YYYY-MM) with a quarterly (YYYY-Qn) fallback; neither key exists for the requested currency and date, so no interest rate can be determined.","triggerScenarios":"Thrown at crates/backtest/src/modules/fx_rollover.rs:194 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Extend the configured rates data to cover the currency and period","Use a rates source that provides monthly or quarterly entries for that date"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}