{"record":{"id":"6acc8551ceb33809","repo":"OpenBB-finance/OpenBB","slug":"supplied-data-must-be-daily-intervals-and-have-mor-6acc85","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/extensions/technical/openbb_technical/relative_rotation.py","lineNumber":307,"sourceCode":"            )\n\n        if \"symbol\" in df.columns:\n            df = df.pivot(columns=\"symbol\", values=target_col)\n\n        if benchmark not in df.columns:\n            raise RuntimeError(\"The benchmark symbol was not found in the data.\")\n\n        benchmark_data = df.pop(benchmark).to_frame()\n        symbols_data = df\n\n        if len(symbols_data) <= 252 and study in [\"price\", \"volume\"]:  # type: ignore\n            raise ValueError(\n                \"Supplied data must be daily intervals and have more than one year of back data to calculate\"\n                \" the most recent day in the time series.\"\n            )\n\n        if study == \"volatility\" and len(symbols_data) <= 504:  # type: ignore\n            raise ValueError(\n                \"Supplied data must be daily intervals and have more than two years of back data to calculate\"\n                \" the most recent day in the time series as a volatility study.\"\n            )\n        self.symbols = df.columns.to_list()\n        self.benchmark = benchmark\n        self.study = study\n        self.long_period = long_period\n        self.short_period = short_period\n        self.window = window\n        self.trading_periods = trading_periods\n        self.symbols_data = symbols_data  # type: ignore\n        self.benchmark_data = benchmark_data  # type: ignore\n        self._process_data()  # type: ignore\n        self.symbols_data = df_to_basemodel(self.symbols_data.reset_index())  # type: ignore\n        self.benchmark_data = df_to_basemodel(self.benchmark_data.reset_index())  # type: ignore\n\n    def _process_data(self):\n        \"\"\"Process the data.\"\"\"","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/extensions/technical/openbb_technical/relative_rotation.py#L289-L325","documentation":"RelativeRotation's stricter bound for study='volatility': more than 504 daily observations (two trading years) are required because the volatility study needs a longer lookback for its ratios; it raises when len(symbols_data) <= 504.","triggerScenarios":"Calling RelativeRotation(study='volatility') with 504 or fewer daily rows, e.g. two years of data with holidays dropping it just below the threshold.","commonSituations":"Reusing a one-to-two-year fetch that sufficed for price study; provider caps limiting history; weekly/monthly series; assuming 504 is inclusive (it is not).","solutions":["Fetch > 504 daily bars (e.g. limit=750 or start_date 3 years back).","Confirm daily interval data.","Fall back to study='price' if only ~1 year of history is available.","Filter the universe to symbols with 2+ years of history before running the volatility study."],"exampleFix":"# before\ndata = obb.equity.price.historical(symbols, limit=504)\nRelativeRotation(data=data, benchmark=\"SPY\", study=\"volatility\")\n\n# after\ndata = obb.equity.price.historical(symbols, limit=750)\nRelativeRotation(data=data, benchmark=\"SPY\", study=\"volatility\")","handlingStrategy":"validation","validationCode":"n = len(symbols_data)\nassert n > 504, f\"volatility RRG needs > 504 daily bars, have {n}\"","typeGuard":"def enough_volatility_rrg_history(df) -> bool:\n    return len(df) > 504","tryCatchPattern":"try:\n    rrg = RelativeRotation(data=data, benchmark=\"SPY\", study=\"volatility\")\nexcept ValueError as e:\n    if \"more than two years\" in str(e):\n        data = fetch_history(symbols, limit=750)\n        rrg = RelativeRotation(data=data, benchmark=\"SPY\", study=\"volatility\")\n    else:\n        raise","preventionTips":["Fetch > 504 daily bars (limit ~750) for volatility studies","Fall back to study='price' with ~1 year of data","Filter symbols with < 2 years of history first"],"tags":["rrg","relative-rotation","insufficient-data","volatility"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}