OpenBB-finance/OpenBB · error · ValueError

Data supplied does not match the expected format.

Error message

Data supplied does not match the expected format.

What it means

Raised by the volatility (realized volatility) charting view when the converted DataFrame lacks any of the required columns 'Realized', 'Min', 'Median', 'Max' after title-casing and underscore-stripping the column names. The view plots a range chart of realized volatility statistics, so those four series must exist in the OBBject results (or the supplied DataFrame). Missing columns mean the underlying data is not realized-volatility output.

Source

Thrown at openbb_platform/extensions/technical/openbb_technical/technical_views.py:242

        from openbb_charting.core.chart_style import ChartStyle
        from openbb_charting.core.openbb_figure import OpenBBFigure
        from openbb_core.app.utils import basemodel_to_df
        from pandas import DataFrame

        data = kwargs.get("data")

        if isinstance(data, DataFrame) and not data.empty and "window" in data.columns:
            df_ta = data.set_index("window")
        else:
            df_ta = basemodel_to_df(kwargs["obbject_item"], index="window")  # type: ignore

        df_ta.columns = [col.title().replace("_", " ") for col in df_ta.columns]

        # Check if the data is formatted as expected.
        if not all(
            col in df_ta.columns for col in ["Realized", "Min", "Median", "Max"]
        ):
            raise ValueError("Data supplied does not match the expected format.")

        model = (
            str(kwargs.get("model"))
            .replace("std", "Standard Deviation")
            .replace("_", "-")
            .title()
            if kwargs.get("model")
            else "Standard Deviation"
        )

        symbol = str(kwargs.get("symbol")) + " - " if kwargs.get("symbol") else ""

        title = (
            str(kwargs.get("title"))
            if kwargs.get("title")
            else f"{symbol}Realized Volatility Cones - {model} Model"
        )

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Ensure the OBBject comes from obb.technical.volatility.realized (its results contain the expected columns)
  2. If passing data manually, rename your columns to 'realized', 'min', 'median', 'max' with a 'window' index before calling
  3. Print df_ta.columns after conversion to see which expected label is missing and adapt

Example fix

# before
res = obb.technical.volatility.realized(symbol='AAPL').charting()  # wrong/partial data

# after
df = res.to_df()
df = df.rename(columns={'rv': 'realized', 'lo': 'min', 'mid': 'median', 'hi': 'max'})
res.charting(data=df)
Defensive patterns

Strategy: validation

Validate before calling

required = {'realized', 'min', 'median', 'max'}
missing = required - {c.lower() for c in df.columns}
assert not missing, f'volatility chart missing columns: {missing}'

Type guard

def has_volatility_columns(df: pd.DataFrame) -> bool:
    cols = {c.lower() for c in df.columns}
    return {'realized', 'min', 'median', 'max'}.issubset(cols)

Try / catch

try:
    res.charting()
except ValueError as e:
    if 'expected format' in str(e):
        print(df.columns); raise

Prevention

When it happens

Trigger: Calling chart/volatility/realized on an OBBject whose results are not from the realized-volatility endpoint; passing a DataFrame via kwargs['data'] that lacks realized/min/median/max columns (window-indexed); using 'data' that has a 'window' column but different output names after provider schema changes.

Common situations: Charting the wrong OBBject (e.g. a normal historical price result); custom DataFrames fed to the volatility view; provider or extension version changes that rename output columns so the title-case mapping no longer matches.

Related errors


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