OpenBB-finance/OpenBB · error · ValueError
Price field not found in the data.
Error message
Price field not found in the data.
What it means
Raised (as a plain ValueError, wrapped by OpenBB's error handling) by the derivatives futures curve charting view when the DataFrame lacks a 'price' column. Price is the y-value of the curve; expiration was present but price was not, indicating malformed or wrong-shape input data.
Source
Thrown at openbb_platform/extensions/derivatives/openbb_derivatives/derivatives_views.py:105
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
):
df["expiration"] = df.symbol
# Use a complete list of expirations to categorize the x-axis across all dates.
expirations = df["expiration"].unique().tolist()
# Use the supplied colors, if any.View on GitHub (pinned to 3e071fcc2c)
Solutions
- Rename your price-like column: df = df.rename(columns={'close': 'price'}) (or 'settlement'/'last').
- Ensure price values are non-None so exclude_none serialization keeps them.
- Use the standardized curve endpoint output instead of raw provider payloads.
- Pre-check both required columns: {'expiration', 'price'} <= set(df.columns).
Example fix
# before
fig = charting.show(data=df) # df has 'close' not 'price'
# after
df = df.rename(columns={'close': 'price'})
fig = charting.show(data=df) Defensive patterns
Strategy: validation
Validate before calling
df = <your frame>
if 'price' not in df.columns:
for alt in ('close', 'last', 'settlement'):
if alt in df.columns:
df = df.rename(columns={alt: 'price'})
break
assert 'price' in df.columns, 'curve chart requires price' Type guard
def curve_ready(df) -> bool:
return not df.empty and {'expiration', 'price'} <= set(df.columns) Try / catch
try:
fig, content = derivatives_futures_curve(**kwargs)
except ValueError as e:
if 'Price field not found' in str(e):
kwargs['data'] = kwargs['data'].rename(columns={'close': 'price'})
fig, content = derivatives_futures_curve(**kwargs) Prevention
- Standardize on 'price' as the column name before charting.
- Avoid exclude_none dumps that can strip None prices from holiday rows.
When it happens
Trigger: Calling the futures curve chart with records that have 'expiration' but no 'price' field - e.g. a payload with 'close'/'last' instead of 'price', or Data models where price was None and got dropped by exclude_none.
Common situations: Custom DataFrames using provider-native column names ('close', 'settlement') instead of the standardized 'price'; model_dump(exclude_none=True) stripping a None price on a holiday row; joining in user code that drops the column.
Related errors
- Expiration field not found in the data.
- Error: No data to plot.
- Error: Rate column not found in the data.
- Error: Date column not found in the data.
- Please provide data with only one symbol and columns for OHL
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/22aadffd6e8cb912.
Report an issue: GitHub.