OpenBB-finance/OpenBB · error · OpenBBError

Greeks were not found within the data.

Error message

Greeks were not found within the data.

What it means

Raised inside the private OptionsChainsData._get_stat(metric=...) helper that backs total_dex/total_gex/filter_data(stat=...). When the metric is 'DEX' or 'GEX', it first asserts self.has_greeks; since those exposure numbers are computed from delta/gamma, absence of greeks makes the computation impossible and it raises rather than returning zero totals.

Source

Thrown at openbb_platform/core/openbb_core/provider/utils/options_chains_properties.py:403

    def _get_stat(
        self,
        metric: Literal["open_interest", "volume", "DEX", "GEX"],
        moneyness: Literal["otm", "itm"] | None = None,
        date: str | None = None,
    ) -> dict:
        """Return the metric with keys: "total", "expiration", "strike".
        This method is not intended to be called directly.
        """
        # pylint: disable=import-outside-toplevel
        from numpy import inf, nan
        from pandas import DataFrame, concat

        df = self.dataframe

        if metric in ["DEX", "GEX"]:
            if not self.has_greeks:
                raise OpenBBError("Greeks were not found within the data.")
            df[metric] = abs(df[metric])

        total_calls = df[df.option_type == "call"][metric].sum()
        total_puts = df[df.option_type == "put"][metric].sum()
        total_metric = total_calls + total_puts
        total_metric_dict = {
            "Calls": total_calls,
            "Puts": total_puts,
            "Total": total_metric,
            "PCR": round(total_puts / total_calls, 4) if total_calls != 0 else 0,
        }

        df = DataFrame(df[df[metric].notnull()])  # type: ignore
        df["expiration"] = df.expiration.astype(str)

        if moneyness is not None:
            df_calls = DataFrame(
                df[df.strike >= df.underlying_price].query("option_type == 'call'")

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Branch on result.has_greeks before requesting any DEX/GEX statistic
  2. Use a provider that returns greeks (delta/gamma) for the symbol
  3. If you only need volume/OI stats, use stat='volume'/'open_interest' which never require greeks

Example fix

# before
df = res.filter_data(stat="gex")  # falls through to _get_stat -> OpenBBError

# after
if res.has_greeks:
    df = res.filter_data(stat="gex")
else:
    df = res.filter_data(stat="volume")
Defensive patterns

Strategy: validation

Validate before calling

if not res.has_greeks:
    raise LookupError("provider returned no greeks; DEX/GEX stats unavailable")
stat = res._get_stat("GEX")  # or use the public total_gex/filter_data paths

Type guard

def has_greeks_data(res) -> bool:
    return res.has_greeks

Try / catch

from openbb_core.app.model.abstract.error import OpenBBError

try:
    totals = res.total_gex  # or filter_data(stat="dex")
except OpenBBError as e:
    if "Greeks were not found" in str(e):
        totals = None
    else:
        raise

Prevention

When it happens

Trigger: Any route into DEX/GEX aggregation on greeks-free data: result.total_dex, result.total_gex, or result.filter_data(stat='dex'|'gex') where the provider rows carry no delta/gamma. filter_data's stat branch may pass its own underlying-price guard but still hits this guard inside _get_stat.

Common situations: Same as errors 49/50: provider swaps or API tiers that omit greeks; cached/stale responses from before a provider upgrade that dropped greeks coverage.

Related errors


AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14). Data as JSON: /api/errors/2a0ee5fc7674cd79. Report an issue: GitHub.