OpenBB-finance/OpenBB · warning · EmptyDataError

The request was returned empty.

Error message

The request was returned empty.

What it means

Raised by FMPYieldCurveFetch.transform_data when the fetched list of treasury yield records is empty, before any pandas processing (pivot to maturities, nearest-date lookup) happens. The FMP treasury-charts endpoint returned no rows for the requested date or date range.

Source

Thrown at openbb_platform/providers/fmp/openbb_fmp/models/yield_curve.py:99

            )
            return url

        dates = query.date.split(",")  # type: ignore
        urls = [generate_url(date) for date in dates]

        return await get_data_urls(urls, **kwargs)  # type: ignore

    @staticmethod
    def transform_data(
        query: FMPYieldCurveQueryParams, data: list, **kwargs: Any
    ) -> list[FMPYieldCurveData]:
        """Return the transformed data."""
        # pylint: disable=import-outside-toplevel
        from numpy import nan
        from pandas import Categorical, DataFrame, DatetimeIndex

        if not data:
            raise EmptyDataError("The request was returned empty.")
        df = DataFrame(data).set_index("date").sort_index()
        dates = query.date.split(",") if query.date else [df.index.max()]  # type: ignore
        df.index = DatetimeIndex(df.index)
        dates_list = DatetimeIndex(dates)
        df = df.rename(columns=maturity_dict)
        df.columns.name = "maturity"

        # Find the nearest date in the DataFrame to each date in dates_list
        nearest_dates = [df.index.asof(date) for date in dates_list]

        # Filter for only the nearest dates
        df = df[df.index.isin(nearest_dates)]

        df = df.replace({nan: None})

        # Flatten the DataFrame
        flattened_data = df.reset_index().melt(
            id_vars="date", var_name="maturity", value_name="rate"

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Pass an explicit recent business day (e.g. date='2024-12-24') instead of relying on the default latest date
  2. Check the FMP treasury yield curve endpoint directly to verify coverage for that date
  3. Retry once after a short delay in case of a transient FMP data outage
  4. Use another provider's yield_curve implementation as a fallback

Example fix

# before
curve = await obb.economy.yield_curve(provider='fmp', date='2024-12-25').await_to_list()

# after - use the nearest prior trading day
curve = await obb.economy.yield_curve(provider='fmp', date='2024-12-24').await_to_list()
Defensive patterns

Strategy: validation

Validate before calling

from pandas.tseries.holiday import USFederalHolidayCalendar
from pandas import bdate_range
cal = USFederalHolidayCalendar()
holidays = cal.holidays(start='2020-01-01', end='2030-12-31')
def is_trading_day(d):
    return d not in holidays and d.weekday() < 5
assert is_trading_day(pd.Timestamp(date))

Try / catch

from openbb_core.provider.utils.errors import EmptyDataError
try:
    curve = await obb.economy.yield_curve(provider='fmp', date=d).await_to_list()
except EmptyDataError:
    # walk back to the previous business day
curve = await obb.economy.yield_curve(provider='fmp', date=prev_bday(d)).await_to_list()

Prevention

When it happens

Trigger: Querying the FMP yield curve for a weekend/holiday date, a date in the future, or a historical date FMP's treasury dataset does not reach; the fetcher builds urls from query.date and get_data_urls merges the results.

Common situations: Requesting the latest curve on a non-trading day without a fallback date; passing a single holiday like '2024-12-25'; FMP occasionally returns empty payloads during data pipeline outages.

Related errors


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