nautechsystems/nautilus_trader · error · anyhow::Error

No price available for {vol_index_id}

Error message

No price available for {vol_index_id}

What it means

calculate_option_greeks optionally uses a volatility index (e.g. VIX) instrument; when a vol_index_instrument_id is supplied, its price is fetched and must exist. If get_price returns None for the vol index id, this error is raised. The calculation refuses to proceed with an incomplete volatility input.

Source

Thrown at crates/common/src/greeks.rs:582

        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,
                ),
                None => imply_vol_and_greeks(
                    underlying_price,
                    interest_rate,
                    cost_of_carry,

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Subscribe to and cache the vol index data before passing its id to greeks calculations
  2. Verify the vol index instrument id against the instrument provider/cache exactly
  3. Pass None for vol_index_instrument_id if the index is not actually required
  4. Pre-check get_price for the vol index and skip or defer the greeks computation when absent

Example fix

// before
let greeks = calculator.instrument_greeks(&option_id, None, None, Some(&vix_id), None)?;
// after
if calculator.get_price(&vix_id).is_some() {
    let greeks = calculator.instrument_greeks(&option_id, None, None, Some(&vix_id), None)?;
} else {
    let greeks = calculator.instrument_greeks(&option_id, None, None, None, None)?;
}
Defensive patterns

Strategy: fallback

Validate before calling

if let Some(vix) = &vol_index_id {
    if calculator.get_price(vix).is_none() {
        log::warn!("vol index {vix} unpriced; computing greeks without it");
        return calculator.instrument_greeks(&option_id, None, None, None, None);
    }
}

Try / catch

match calculator.instrument_greeks(&option_id, None, None, vol_index_id, None) {
    Ok(g) => g,
    Err(e) if e.to_string().contains(&vol_index_id.to_string()) => {
        calculator.instrument_greeks(&option_id, None, None, None, None)
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Passing Some(vol_index_instrument_id) to instrument_greeks while the vol index has no cached price — index data never subscribed, wrong index id, or the venue does not quote that index.

Common situations: Using VIX/Nikkei-style index ids not actually fed into the backtest/live data pipeline; id formatting mismatch (e.g. .VIX vs .IND); computing greeks with vol index before index quotes arrive.

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


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