OpenBB-finance/OpenBB · error · EmptyDataError

No data returned from FMP for the given query.

Error message

No data returned from FMP for the given query.

What it means

Raised as EmptyDataError by FMPEquityHistorical.transform_data when get_historical_ohlc returned an empty list for the query. Because a_url delegates to the shared get_historical_ohlc helper (which selects chart vs candle endpoints by interval), emptiness means FMP had no rows for the symbol/date/interval combination.

Source

Thrown at openbb_platform/providers/fmp/openbb_fmp/models/equity_historical.py:119

    @staticmethod
    async def aextract_data(
        query: FMPEquityHistoricalQueryParams,
        credentials: dict[str, str] | None,
        **kwargs: Any,
    ) -> list[dict]:
        """Return the raw data from the FMP endpoint."""
        # pylint: disable=import-outside-toplevel
        from openbb_fmp.utils.helpers import get_historical_ohlc

        return await get_historical_ohlc(query, credentials, **kwargs)

    @staticmethod
    def transform_data(
        query: FMPEquityHistoricalQueryParams, data: list[dict], **kwargs: Any
    ) -> list[FMPEquityHistoricalData]:
        """Return the transformed data."""
        if not data:
            raise EmptyDataError("No data returned from FMP for the given query.")
        return [
            FMPEquityHistoricalData.model_validate(d)
            for d in sorted(
                data,
                key=lambda x: (
                    (x["date"], x["symbol"])
                    if len(query.symbol.split(",")) > 1
                    else x["date"]
                ),
                reverse=False,
            )
        ]

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Validate the symbol first with obb.equity.profile / quote
  2. Check that start_date/end_date form a sane, past-facing window that overlaps the asset's listing period
  3. For old intraday data, verify FMP actually retains bars that far back; switch to daily if not
  4. Catch EmptyDataError and skip/fallback per symbol when fetching batches

Example fix

# before
res = obb.equity.price.historical(symbol='TSLAQ', provider='fmp', start_date='2030-01-01')  # delisted + future window

# after
res = obb.equity.price.historical(symbol='TSLA', provider='fmp', start_date='2024-01-01', end_date='2024-06-30')
Defensive patterns

Strategy: validation

Validate before calling

from datetime import date
if start_date and start_date > date.today():
    raise ValueError('start_date is in the future; FMP will return no bars')
# optionally verify symbol exists first
assert obb.equity.quote(symbol=sym, provider='fmp').results, f'{sym} unknown to FMP'

Type guard

null

Try / catch

from openbb_core.provider.utils.errors import EmptyDataError
try:
    bars = await obb.equity.price.historical.async_(symbol=sym, provider='fmp', start_date=s, end_date=e)
except EmptyDataError:
    bars = []  # skip symbol in batch backfills

Prevention

When it happens

Trigger: Calling obb.equity.price.historical(symbol=X, provider='fmp') where X is unknown/delisted, or where the requested start_date/end_date window excludes all available bars (e.g. a future date range on the candle endpoint).

Common situations: Typo'd or delisted symbols, date windows entirely in the future or before the asset listed, intraday windows older than FMP's intraday history, or an API-key/plan issue yielding empty payloads.

Related errors


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