OpenBB-finance/OpenBB · error · OpenBBError

Error: No data to plot.

Error message

Error: No data to plot.

What it means

Raised by the derivatives futures curve charting view (derivatives_futures_curve) when, after normalizing the input - either a passed DataFrame, a list of Data models, or the OBBject item's dumped results - the resulting DataFrame is empty. The chart cannot be built from nothing, so it aborts before touching plotly.

Source

Thrown at openbb_platform/extensions/derivatives/openbb_derivatives/derivatives_views.py:99

        data = kwargs.get("data")
        symbol = kwargs.get("standard_params", {}).get("symbol", "")
        df: DataFrame = DataFrame()
        if data:
            if isinstance(data, DataFrame) and not data.empty:  # noqa: SIM108
                df = data
            elif isinstance(data, (list, Data)):
                df = DataFrame([d.model_dump(exclude_none=True, exclude_unset=True) for d in data])  # type: ignore
            else:
                pass
        else:
            df = DataFrame(
                [d.model_dump(exclude_none=True, exclude_unset=True) for d in kwargs["obbject_item"]]  # type: ignore
                if isinstance(kwargs.get("obbject_item"), list)
                else kwargs["obbject_item"].model_dump(exclude_none=True, exclude_unset=True)  # type: ignore
            )

        if df.empty:
            raise OpenBBError("Error: No data to plot.")

        if "expiration" not in df.columns:
            raise OpenBBError("Expiration field not found in the data.")

        if "price" not in df.columns:
            raise ValueError("Price field not found in the data.")

        provider = kwargs.get("provider", "")

        if provider != "deribit":
            df["expiration"] = df["expiration"].apply(to_datetime).dt.strftime("%b-%Y")

        if (
            provider == "cboe"
            and "date" in df.columns
            and len(df["date"].unique()) > 1
            and "symbol" in df.columns
        ):

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Verify the underlying fetch returns rows before enabling chart=True: inspect data.results length.
  2. Check the symbol and date parameters are valid for the provider (e.g. obb.derivatives.futures.curve(symbol='VX', provider='cboe')).
  3. If passing data= explicitly, confirm the DataFrame is non-empty and has expiration/price columns.
  4. Retry during market hours or with another provider if the response was genuinely empty.

Example fix

# before
res = obb.derivatives.futures.curve(symbol='BADSYM', date='1990-01-01', provider='cboe', chart=True)

# after
res = obb.derivatives.futures.curve(symbol='VX', provider='cboe', chart=True)
assert res.results, 'no curve rows returned'
Defensive patterns

Strategy: validation

Validate before calling

res = obb.derivatives.futures.curve(symbol=sym, provider=prov)
if not res.results:
    raise ValueError(f'no curve rows for {sym}; check symbol/date/provider')

Try / catch

try:
    data.show()  # or charting.to_chart()
except OpenBBError as e:
    if 'No data to plot' in str(e):
        logging.warning('curve fetch empty for %s', symbol)

Prevention

When it happens

Trigger: Calling obb.derivatives.futures.curve(..., chart=True) when the fetcher returned zero rows (empty symbol/date), or passing data=[] / an empty DataFrame via chart_params; also when data is a list whose model_dump calls yield no columns.

Common situations: Delisted/unknown futures symbol; requesting a date with no curve data; provider outage returning an empty result; charting an OBBject whose results were already consumed/emptied.

Related errors


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