OpenBB-finance/OpenBB · warning · EmptyDataError
No ratings data returned.
Error message
No ratings data returned.
What it means
BenzingaAnalystSearchFetcher.a_fetch_data (analyst_search.py:428) calls Benzinga's /calendar/ratings/analysts endpoint; if the decoded payload is an empty list, or a dict whose 'analyst_ratings_analyst' key is missing-or-empty, it raises EmptyDataError("No ratings data returned."). This is the normal 'no rows match your filters' outcome, not a transport failure.
Source
Thrown at openbb_platform/providers/benzinga/openbb_benzinga/models/analyst_search.py:428
async def aextract_data(
query: BenzingaAnalystSearchQueryParams,
credentials: dict[str, str] | None,
**kwargs: Any,
) -> list[dict]:
"""Extract the raw data."""
# pylint: disable=import-outside-toplevel
from openbb_benzinga.utils.helpers import response_callback
from openbb_core.provider.utils.helpers import amake_request, get_querystring
token = credentials.get("benzinga_api_key") if credentials else ""
querystring = get_querystring(query.model_dump(by_alias=True), [])
url = f"https://api.benzinga.com/api/v2.1/calendar/ratings/analysts?{querystring}&token={token}"
data = await amake_request(url, response_callback=response_callback, **kwargs)
if (isinstance(data, list) and not data) or (
isinstance(data, dict) and not data.get("analyst_ratings_analyst")
):
raise EmptyDataError("No ratings data returned.")
if isinstance(data, dict) and "analyst_ratings_analyst" not in data:
raise OpenBBError(
f"Unexpected data format. Expected 'analyst_ratings_analyst' key, got: {list(data.keys())}"
)
if not isinstance(data, dict):
raise OpenBBError(
f"Unexpected data format. Expected dict, got: {type(data).__name__}"
)
return data["analyst_ratings_analyst"]
@staticmethod
def transform_data(
query: BenzingaAnalystSearchQueryParams,
data: list[dict],
**kwargs: Any,View on GitHub (pinned to 3e071fcc2c)
Solutions
- Catch EmptyDataError and present an empty result for that filter set.
- Widen the filters: drop firm/ticker constraints or request a larger pages value / date range.
- Verify the Benzinga key works with a known-covered ticker (e.g. AAPL) to rule out auth-level emptiness.
- Retry with adjusted parameters rather than the identical request.
Example fix
# before
res = obbject.stocks.ca.analyst_search(provider="benzinga", firm="Tiny Boutique Co")
# after
from openbb_core.provider.standard_models.errors import EmptyDataError
try:
res = obbject.stocks.ca.analyst_search(provider="benzinga", firm="Tiny Boutique Co")
except EmptyDataError:
res = obbject.stocks.ca.analyst_search(provider="benzinga") # unfiltered Defensive patterns
Strategy: try-catch
Validate before calling
# Pre-flight with the widest filter to confirm coverage exists at all
probe = await obbject.stocks.ca.analyst_search(provider="benzinga")
if not probe.to_df().empty:
# narrow filters are safe to try
... Try / catch
from openbb_core.provider.standard_models.errors import EmptyDataError
try:
result = await fetcher.a_fetch_data(query, credentials)
except EmptyDataError:
result = [] # filters matched no analysts Prevention
- Treat EmptyDataError from Benzinga as filter-driven, not fatal.
- Start wide, then narrow firm/ticker/date filters.
- Verify the API key works on a covered ticker before assuming coverage gaps.
When it happens
Trigger: Querying analyst search with filters (firm, ticker, date pages) that match no analysts in Benzinga's coverage window; the endpoint returns {} or {"analyst_ratings_analyst": []}.
Common situations: Narrow date-page/firm filters, small-cap or non-covered tickers, free-tier keys that return empty bodies, and weekend/holiday windows with no rating actions.
Related errors
- The request was returned empty.
- No data was returned -> \n{messages[-1]}
- No data found.
- Unexpected data format. Expected 'analyst_ratings_analyst' k
- Unexpected data format. Expected dict, got: {type(data).__na
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/7849b2fd79f7fd03.
Report an issue: GitHub.