nautechsystems/nautilus_trader · error
backtest data client cannot fetch option-chain reference…
Error message
backtest data client cannot fetch option-chain reference prices
What it means
The backtest data client intentionally does not implement option-chain reference price fetching — there is no simulated source for that data. Requests are rejected with this error rather than silently returning nothing, so callers know the capability is unsupported in backtest mode.
Solutions
- Remove or guard the RequestOptionChainReferencePrice call when running in backtest mode
- Provide the reference prices via injected data/timers in the backtest scenario instead
- Use a custom data client or engine extension that supplies simulated option-chain reference prices
- Gate the request behind a capability check (only issue it against live data clients)
Example fix
// before self.request_option_chain_reference_price(request); // called in backtest too // after #[cfg(not(feature = "backtest"))] self.request_option_chain_reference_price(request); // live only
Defensive patterns
Strategy: type-guard
Type guard
fn supports_option_chain_reference_price(client: &dyn DataClient) -> bool {
// backtest data client intentionally does not implement this capability
client.as_any().downcast_ref::<BacktestDataClient>().is_none()
}
if supports_option_chain_reference_price(&self.client) {
self.request_option_chain_reference_price(request);
} Try / catch
match client.request_option_chain_reference_price(request) {
Ok(()) => {},
Err(e) if e.to_string().contains("option-chain reference prices") => {
log::warn!("Backtest mode: skipping option-chain reference price request");
}
Err(e) => return Err(e),
} Prevention
- Gate live-only data requests behind a mode check
- Read the data client capability list before issuing requests
- Adapt option strategies when porting from live to backtest
When it happens
Trigger: Calling request_option_chain_reference_price on the BacktestDataClient, which happens when a strategy issues a RequestOptionChainReferencePrice during a backtest.
Common situations: A live trading strategy that queries option-chain reference prices is run unmodified in a backtest; porting a live options strategy to the backtest engine without adapting data requests.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Trigger/conditional orders
- A different simulation module extractor is already…
- At least one run config is required
- BacktestEngine requires TestClock
- BacktestEngineConfig.controller for importable controller
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/8d5475c9a5d1d47f.
Report an issue: GitHub.
Appendix: source
Thrown at crates/backtest/src/data_client.rs:327
// No-op in backtest: quotes are replayed by the engine
Ok(())
}
fn request_trades(&self, _request: RequestTrades) -> anyhow::Result<()> {
// No-op in backtest: trades are replayed by the engine
Ok(())
}
fn request_bars(&self, _request: RequestBars) -> anyhow::Result<()> {
// No-op in backtest: bars are replayed by the engine
Ok(())
}
fn request_option_chain_reference_price(
&self,
_request: RequestOptionChainReferencePrice,
) -> anyhow::Result<()> {
anyhow::bail!("backtest data client cannot fetch option-chain reference prices")
}
#[cfg(feature = "defi")]
fn request_pool_snapshot(&self, _request: RequestPoolSnapshot) -> anyhow::Result<()> {
Ok(())
}
}
#[cfg(test)]
mod tests {
use nautilus_core::{UUID4, UnixNanos};
use nautilus_model::identifiers::{InstrumentId, OptionSeriesId};
use rstest::rstest;
use ustr::Ustr;
use super::*;
#[rstest]View on GitHub (pinned to 18893faf8b)