nautechsystems/nautilus_trader · error · anyhow::Error
No price available for {instrument_id}
Error message
No price available for {instrument_id} What it means
calculate_option_greeks requires the option's own price (plus the underlying's price) to compute greeks. When get_price returns None for the option instrument id, the calculation is aborted with this error. It indicates missing market data for the option contract itself.
Source
Thrown at crates/common/src/greeks.rs:577
None => flat_interest_rate,
};
let dividend_curve = cache.yield_curve(&underlying_instrument_id.to_string());
drop(cache);
let mut cost_of_carry = 0.0;
if let Some(dividend_curve) = dividend_curve {
cost_of_carry = interest_rate - dividend_curve(expiry_in_years);
} else if let Some(div_yield) = flat_dividend_yield {
cost_of_carry = interest_rate - div_yield;
}
let multiplier = instrument.multiplier();
let is_call = instrument.option_kind().unwrap_or(OptionKind::Call) == OptionKind::Call;
let strike = instrument.strike_price().unwrap_or_default().as_f64();
let option_price = self
.get_price(&instrument_id)
.ok_or_else(|| anyhow::anyhow!("No price available for {instrument_id}"))?;
let underlying_price = self.get_underlying_price(&underlying_instrument_id)?;
if let Some(vol_index_id) = vol_index_instrument_id {
self.get_price(&vol_index_id)
.ok_or_else(|| anyhow::anyhow!("No price available for {vol_index_id}"))?;
}
let greeks = if update_vol {
let cached_greeks = self.cache.borrow().greeks(&instrument_id);
match cached_greeks {
Some(cached_greeks) => refine_vol_and_greeks(
underlying_price,
interest_rate,
cost_of_carry,
is_call,
strike,
expiry_in_years,
option_price,
cached_greeks.vol,View on GitHub (pinned to 18893faf8b)
Solutions
- Subscribe to and wait for the option's quotes/trades before requesting greeks
- Verify the option instrument id (symbol, expiry, strike, right) matches the cache exactly
- Provide a fallback price_type (e.g. use last trade or mark price) that exists for the contract
- Add a pre-check on get_price and skip/log when the option price is missing
Example fix
// before
let greeks = calculator.instrument_greeks(&option_id, None, None, None, None)?;
// after
if calculator.get_price(&option_id).is_none() {
anyhow::bail!("option {option_id} has no cached price; waiting for data");
}
let greeks = calculator.instrument_greeks(&option_id, None, None, None, None)?; Defensive patterns
Strategy: validation
Validate before calling
if calculator.get_price(&option_id).is_none() {
log::warn!("no price for option {option_id}; skipping greeks");
return Ok(());
} Try / catch
match calculator.instrument_greeks(&option_id, None, None, None, None) {
Ok(g) => g,
Err(e) if e.to_string().starts_with("No price available") => {
log::warn!("waiting for option data: {e}");
return Ok(());
}
Err(e) => return Err(e),
} Prevention
- Subscribe to option quotes/trades before enabling greeks-based logic
- Verify option id formatting (expiry/strike/right) against the instrument provider
- Add a readiness gate that requires cached prices for all greeks inputs
When it happens
Trigger: Calling instrument_greeks on an option whose cached price is absent — no quote/trade/mark price received for that contract, wrong option instrument id, or data not yet warmed in the cache.
Common situations: Computing greeks at strategy start before option data arrives; illiquid options that rarely quote; instrument id built with wrong expiry/strike formatting; venue not publishing the configured price type.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- Instrument {instrument_id} has no underlying identifier
- No price available for {vol_index_id}
- option_summary_family_subs mutex poisoned
- Missing data in SetFeeProtocol event log
- Missing data in CollectProtocol event log
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/400a68737664b1f0.
Report an issue: GitHub.