{"record":{"id":"ed7b0941734c23e7","repo":"OpenBB-finance/OpenBB","slug":"supplied-data-must-be-daily-intervals-and-have-mor","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/extensions/technical/openbb_technical/relative_rotation.py","lineNumber":301,"sourceCode":"            if \"date\" in df.columns:\n                df.set_index(\"date\", inplace=True)\n\n        if df.empty:\n            raise ValueError(\n                \"Data must be a list of Data objects or a DataFrame with a 'date' column.\"\n            )\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","sourceCodeStart":283,"sourceCodeEnd":319,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/extensions/technical/openbb_technical/relative_rotation.py#L283-L319","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\ndata = obb.equity.price.historical(symbols, limit=252)\nRelativeRotation(data=data, benchmark=\"SPY\", study=\"price\")\n\n# after\ndata = obb.equity.price.historical(symbols, limit=500)\nRelativeRotation(data=data, benchmark=\"SPY\", study=\"price\")","handlingStrategy":"validation","validationCode":"n = len(symbols_data)\nassert n > 252, f\"price/volume RRG needs > 252 daily bars, have {n}\"","typeGuard":"def enough_rrg_history(df, study: str) -> bool:\n    return len(df) > (504 if study == \"volatility\" else 252)","tryCatchPattern":"try:\n    rrg = RelativeRotation(data=data, benchmark=\"SPY\", study=study)\nexcept ValueError as e:\n    if \"more than one year\" in str(e):\n        data = fetch_history(symbols, limit=500)\n        rrg = RelativeRotation(data=data, benchmark=\"SPY\", study=study)\n    else:\n        raise","preventionTips":["Fetch > 252 daily bars (use limit ~500)","Confirm daily interval data","Note 252 is exclusive: exactly 252 rows fails"],"tags":["rrg","relative-rotation","insufficient-data","daily-bars"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}