{"record":{"id":"2a0ee5fc7674cd79","repo":"OpenBB-finance/OpenBB","slug":"greeks-were-not-found-within-the-data","errorCode":null,"errorMessage":"Greeks were not found within the data.","messagePattern":"Greeks were not found within the data\\.","errorType":"exception","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/core/openbb_core/provider/utils/options_chains_properties.py","lineNumber":403,"sourceCode":"\n    def _get_stat(\n        self,\n        metric: Literal[\"open_interest\", \"volume\", \"DEX\", \"GEX\"],\n        moneyness: Literal[\"otm\", \"itm\"] | None = None,\n        date: str | None = None,\n    ) -> dict:\n        \"\"\"Return the metric with keys: \"total\", \"expiration\", \"strike\".\n        This method is not intended to be called directly.\n        \"\"\"\n        # pylint: disable=import-outside-toplevel\n        from numpy import inf, nan\n        from pandas import DataFrame, concat\n\n        df = self.dataframe\n\n        if metric in [\"DEX\", \"GEX\"]:\n            if not self.has_greeks:\n                raise OpenBBError(\"Greeks were not found within the data.\")\n            df[metric] = abs(df[metric])\n\n        total_calls = df[df.option_type == \"call\"][metric].sum()\n        total_puts = df[df.option_type == \"put\"][metric].sum()\n        total_metric = total_calls + total_puts\n        total_metric_dict = {\n            \"Calls\": total_calls,\n            \"Puts\": total_puts,\n            \"Total\": total_metric,\n            \"PCR\": round(total_puts / total_calls, 4) if total_calls != 0 else 0,\n        }\n\n        df = DataFrame(df[df[metric].notnull()])  # type: ignore\n        df[\"expiration\"] = df.expiration.astype(str)\n\n        if moneyness is not None:\n            df_calls = DataFrame(\n                df[df.strike >= df.underlying_price].query(\"option_type == 'call'\")","sourceCodeStart":385,"sourceCodeEnd":421,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/core/openbb_core/provider/utils/options_chains_properties.py#L385-L421","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Branch on result.has_greeks before requesting any DEX/GEX statistic","Use a provider that returns greeks (delta/gamma) for the symbol","If you only need volume/OI stats, use stat='volume'/'open_interest' which never require greeks"],"exampleFix":"# before\ndf = res.filter_data(stat=\"gex\")  # falls through to _get_stat -> OpenBBError\n\n# after\nif res.has_greeks:\n    df = res.filter_data(stat=\"gex\")\nelse:\n    df = res.filter_data(stat=\"volume\")","handlingStrategy":"validation","validationCode":"if not res.has_greeks:\n    raise LookupError(\"provider returned no greeks; DEX/GEX stats unavailable\")\nstat = res._get_stat(\"GEX\")  # or use the public total_gex/filter_data paths","typeGuard":"def has_greeks_data(res) -> bool:\n    return res.has_greeks","tryCatchPattern":"from openbb_core.app.model.abstract.error import OpenBBError\n\ntry:\n    totals = res.total_gex  # or filter_data(stat=\"dex\")\nexcept OpenBBError as e:\n    if \"Greeks were not found\" in str(e):\n        totals = None\n    else:\n        raise","preventionTips":["Never call DEX/GEX aggregation without an up-front has_greeks check","Make greeks availability part of provider selection criteria for exposure analytics","Use volume/open_interest stats as the guaranteed-available baseline in reports"],"tags":["options","greeks","gex","dex","derivatives"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}