nautechsystems/nautilus_trader · error · anyhow::Error
FX symbol must be at least 6 characters: {symbol}
Error message
FX symbol must be at least 6 characters: {symbol} What it means
Format guard in FxRolloverInterestRate::calc_overnight_rate: FX instrument symbols are assumed to be 6-character pairs (e.g. EURUSD) so base/quote currencies can be split; shorter symbols cannot yield two 3-letter currency codes.
Source
Thrown at crates/backtest/src/modules/fx_rollover.rs:163
Ok(Self { rates })
}
/// Calculates the overnight interest rate differential for a currency pair.
///
/// Returns `(base_rate - quote_rate) / 365 / 100` as a daily decimal rate.
///
/// # Errors
///
/// Returns an error if rate data is missing for either currency.
pub fn calc_overnight_rate(
&self,
instrument_id: InstrumentId,
date: Date,
) -> anyhow::Result<f64> {
let symbol = instrument_id.symbol.as_str();
if symbol.len() < 6 {
anyhow::bail!("FX symbol must be at least 6 characters: {symbol}");
}
let base_currency = &symbol[..3];
let quote_currency = &symbol[symbol.len() - 3..];
let base_rate = self.lookup_rate(base_currency, date)?;
let quote_rate = self.lookup_rate(quote_currency, date)?;
Ok((base_rate - quote_rate) / 365.0 / 100.0)
}
fn lookup_rate(&self, currency: &str, date: Date) -> anyhow::Result<f64> {
let currency_rates = self
.rates
.get(currency)
.ok_or_else(|| anyhow::anyhow!("No rate data for currency {currency}"))?;
// Try monthly key firstView on GitHub (pinned to 18893faf8b)
Solutions
- Use a standard 6-character FX pair symbol such as EURUSD
- Skip FX rollover for instruments that are not plain currency pairs
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/backtest/src/modules/fx_rollover.rs:163 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/d70de8ad3640ceb8.
Report an issue: GitHub.