nautechsystems/nautilus_trader · error · anyhow::Error

No rate data for at or

Error message

No rate data for {currency} at {monthly_key} or {quarterly_key}

What it means

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.

Solutions

  1. Extend the configured rates data to cover the currency and period
  2. Use a rates source that provides monthly or quarterly entries for that date
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/backtest/src/modules/fx_rollover.rs:194 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/717bcce5c119a5ae. Report an issue: GitHub.

Appendix: source

Thrown at crates/backtest/src/modules/fx_rollover.rs:194

        let currency_rates = self
            .rates
            .get(currency)
            .ok_or_else(|| anyhow::anyhow!("No rate data for currency {currency}"))?;

        // Try monthly key first
        let monthly_key = format!("{}-{:02}", date.year(), date.month());
        if let Some(&rate) = currency_rates.get(&monthly_key) {
            return Ok(rate);
        }

        // Fall back to quarterly key
        let quarter = (date.month() - 1) / 3 + 1;
        let quarterly_key = format!("{}-Q{quarter}", date.year());
        if let Some(&rate) = currency_rates.get(&quarterly_key) {
            return Ok(rate);
        }

        anyhow::bail!("No rate data for {currency} at {monthly_key} or {quarterly_key}")
    }
}

/// Simulates FX rollover (swap) interest applied at 5 PM US/Eastern daily.
///
/// When holding FX positions overnight, the interest rate differential
/// between the two currencies is credited or debited. Wednesday and Friday
/// rollovers are tripled (Wednesday for T+2 settlement, Friday for the weekend).
#[derive(Debug, Clone)]
#[cfg_attr(
    feature = "python",
    pyo3_stub_gen::derive::gen_stub_pyclass(module = "nautilus_trader.backtest")
)]
#[cfg_attr(
    feature = "python",
    pyo3::pyclass(
        module = "nautilus_trader.backtest",
        extends = PySimulationModule,

View on GitHub (pinned to 18893faf8b)