OpenBB-finance/OpenBB · error · ValueError
Supplied data must be daily intervals and have more than one
Error message
Supplied data must be daily intervals and have more than one year of back data to calculate the most recent day in the time series.
What it means
RelativeRotation requires more than 252 daily observations for 'price' and 'volume' studies (one year of trading days); it raises when len(symbols_data) <= 252 so the RRG math (relative strength ratios, momentum) has enough history.
Source
Thrown at openbb_platform/extensions/technical/openbb_technical/relative_rotation.py:301
if "date" in df.columns:
df.set_index("date", inplace=True)
if df.empty:
raise ValueError(
"Data must be a list of Data objects or a DataFrame with a 'date' column."
)
if "symbol" in df.columns:
df = df.pivot(columns="symbol", values=target_col)
if benchmark not in df.columns:
raise RuntimeError("The benchmark symbol was not found in the data.")
benchmark_data = df.pop(benchmark).to_frame()
symbols_data = df
if len(symbols_data) <= 252 and study in ["price", "volume"]: # type: ignore
raise ValueError(
"Supplied data must be daily intervals and have more than one year of back data to calculate"
" the most recent day in the time series."
)
if study == "volatility" and len(symbols_data) <= 504: # type: ignore
raise ValueError(
"Supplied data must be daily intervals and have more than two years of back data to calculate"
" the most recent day in the time series as a volatility study."
)
self.symbols = df.columns.to_list()
self.benchmark = benchmark
self.study = study
self.long_period = long_period
self.short_period = short_period
self.window = window
self.trading_periods = trading_periods
self.symbols_data = symbols_data # type: ignore
self.benchmark_data = benchmark_data # type: ignoreView on GitHub (pinned to 3e071fcc2c)
Solutions
- Fetch more than one year of daily data (limit > 252, e.g. 500, or start_date over a year back).
- Ensure the data is daily-interval; resample or refetch if weekly/monthly.
- Skip symbols with < 1 year of history.
- Note the strict inequality: exactly 252 rows still fails.
Example fix
# before data = obb.equity.price.historical(symbols, limit=252) RelativeRotation(data=data, benchmark="SPY", study="price") # after data = obb.equity.price.historical(symbols, limit=500) RelativeRotation(data=data, benchmark="SPY", study="price")
Defensive patterns
Strategy: validation
Validate before calling
n = len(symbols_data)
assert n > 252, f"price/volume RRG needs > 252 daily bars, have {n}" Type guard
def enough_rrg_history(df, study: str) -> bool:
return len(df) > (504 if study == "volatility" else 252) Try / catch
try:
rrg = RelativeRotation(data=data, benchmark="SPY", study=study)
except ValueError as e:
if "more than one year" in str(e):
data = fetch_history(symbols, limit=500)
rrg = RelativeRotation(data=data, benchmark="SPY", study=study)
else:
raise Prevention
- Fetch > 252 daily bars (use limit ~500)
- Confirm daily interval data
- Note 252 is exclusive: exactly 252 rows fails
When it happens
Trigger: Calling RelativeRotation with study='price' or 'volume' on a DataFrame with 252 or fewer rows, e.g. limit=252 in the history fetch or one year of calendar data missing trading days.
Common situations: Default provider limits capping history at 252 or fewer rows; weekly data (52 rows/year) supplied where daily is required; recent listings with under a year of history.
Related errors
- Supplied data must be daily intervals and have more than two
- Data must be a list of Data objects or a DataFrame with a 'd
- The benchmark symbol was not found in the data.
- This analysis requires at least 3 items in the dataset.
- No data found to plot.
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/ed7b0941734c23e7.
Report an issue: GitHub.