OpenBB-finance/OpenBB · warning · EmptyDataError

No ratings data returned.

Error message

No ratings data returned.

What it means

Raised by the Benzinga price_target fetcher when the API call succeeds but the response dict contains a 'ratings' key that is empty, null, or a falsy value. It signals that Benzinga acknowledged the request but has no analyst ratings records for the queried parameters. This is an EmptyDataError, meaning it maps to a 'no data' condition rather than a transport or auth failure.

Source

Thrown at openbb_platform/providers/benzinga/openbb_benzinga/models/price_target.py:305

        token = credentials.get("benzinga_api_key") if credentials else ""
        base_url = "https://api.benzinga.com/api/v2.1/calendar/ratings"
        query.limit = query.limit or 200
        querystring = get_querystring(query.model_dump(by_alias=True), [])

        url = f"{base_url}?{querystring}&token={token}"
        data = await amake_request(url, response_callback=response_callback, **kwargs)

        if isinstance(data, dict) and "ratings" not in data:
            raise OpenBBError(
                f"Unexpected data format. Expected 'ratings' key, got: {list(data.keys())}"
            )
        if not isinstance(data, dict):
            raise OpenBBError(
                f"Unexpected data format. Expected dict, got: {type(data)}"
            )
        if isinstance(data, dict) and not data.get("ratings"):
            raise EmptyDataError("No ratings data returned.")

        return data["ratings"]

    @staticmethod
    def transform_data(
        query: BenzingaPriceTargetQueryParams,
        data: list[dict],
        **kwargs: Any,
    ) -> list[BenzingaPriceTargetData]:
        """Return the transformed data."""
        results: list[BenzingaPriceTargetData] = []
        # Remove duplicated field with a URL
        for item in data:
            item.pop("url_calendar", None)
            results.append(BenzingaPriceTargetData.model_validate(item))
        return results

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Verify the symbol actually has analyst coverage on Benzinga's website
  2. Check that the benzinga_api_key credential is valid and not exhausted (a bad token can yield empty ratings instead of an auth error)
  3. Wrap the call and treat EmptyDataError as 'no coverage', continuing with the next symbol
  4. Relax query parameters (e.g. wider date range, with_rating only when data exists)

Example fix

// before
from openbb import obb
data = obb.stocks.dd.price_target(symbol='OBSCURE_TICKER')  # raises EmptyDataError

// after
from openbb_core.provider.utils.errors import EmptyDataError
try:
    data = obb.stocks.dd.price_target(symbol='OBSCURE_TICKER')
except EmptyDataError:
    data = None  # no analyst coverage for this symbol
Defensive patterns

Strategy: try-catch

Validate before calling

from openbb_core.provider.utils.errors import EmptyDataError

def has_ratings(func, *args, **kwargs):
    try:
        return func(*args, **kwargs).results
    except EmptyDataError:
        return []

Try / catch

try:
    data = obb.stocks.dd.price_target(symbol=symbol)
except EmptyDataError:
    data = None  # symbol has no analyst coverage; skip or record

Prevention

When it happens

Trigger: Calling openbb.stocks.dd.price_target() with a symbol that has no Benzinga analyst coverage (small caps, recent IPOs, delisted tickers), a date_range outside available coverage, or a valid response like {"ratings": []} / {"ratings": null}. Any falsy value for data.get("ratings") triggers it.

Common situations: Developers batch-fetching price targets for a universe of tickers where some have no analyst coverage; using an expired or wrong token may also cause Benzinga to return an empty ratings array instead of an error.

Related errors


AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14). Data as JSON: /api/errors/41990112f1b16dd1. Report an issue: GitHub.