OpenBB-finance/OpenBB · warning · EmptyDataError

No results found. Try adjusting the query parameters.

Error message

No results found. Try adjusting the query parameters.

What it means

Raised in FederalReserveSOFRFetch.extract_data when the NY Fed secured-rates search endpoint returns a payload whose 'refRates' key is missing, null, or an empty list. EmptyDataError is OpenBB's standard signal that the query is valid but no rows matched, so the framework reports 'No results found' instead of a stack trace.

Source

Thrown at openbb_platform/providers/federal_reserve/openbb_federal_reserve/models/sofr.py:91

    @staticmethod
    async def aextract_data(
        query: FederalReserveSOFRQueryParams,
        credentials: dict[str, str] | None,
        **kwargs: Any,
    ) -> list[dict]:
        """Extract the raw data."""
        # pylint: disable=import-outside-toplevel
        from openbb_core.provider.utils.helpers import amake_request

        url = (
            "https://markets.newyorkfed.org/api/rates/secured/sofr/search.json?"
            + f"startDate={query.start_date}&endDate={query.end_date}"
        )
        results: list[dict] = []
        response = await amake_request(url, **kwargs)
        results = response.get("refRates")  # type: ignore
        if not results:
            raise EmptyDataError()
        return results

    @staticmethod
    def transform_data(
        query: FederalReserveSOFRQueryParams,
        data: list[dict],
        **kwargs: Any,
    ) -> list[FederalReserveSOFRData]:
        """Transform data."""
        results: list[FederalReserveSOFRData] = []
        for d in data.copy():
            _ = d.pop("type", None)
            _ = d.pop("footnoteId", None)
            _ = d.pop("revisionIndicator", None)
            results.append(FederalReserveSOFRData.model_validate(d))

        return sorted(results, key=lambda x: x.date)

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Set start_date/end_date to business days within the SOFR publication window (2018-04 onward to present).
  2. Test the URL https://markets.newyorkfed.org/api/rates/secured/sofr/search.json?startDate=...&endDate=... directly to confirm data exists.
  3. Handle EmptyDataError as an empty result in the caller.

Example fix

try:
    data = await obb.fixedincome.rate.sofr(provider='federal_reserve', start_date='2024-01-02', end_date='2024-01-31').to_df()
except EmptyDataError:
    data = pd.DataFrame()
Defensive patterns

Strategy: validation

Validate before calling

from datetime import date
start = date(2024, 1, 2); end = date(2024, 1, 31)
assert start.weekday() < 5 and end.weekday() < 5 and start < end and start >= date(2018, 4, 2)

Try / catch

try:
    data = await obb.fixedincome.rate.sofr(provider='federal_reserve', start_date=start, end_date=end)
except EmptyDataError:
    data = None

Prevention

When it happens

Trigger: Calling obb.fixedincome.rate.sofr(provider='federal_reserve') with a start_date/end_date range containing no SOFR fixings (weekends, future dates, pre-2018 dates), or when markets.newyorkfed.org returns an error body without 'refRates'.

Common situations: end_date in the future (API returns nothing past latest fixing); inverted or too-narrow date range; NY Fed API downtime returning 200 with an error JSON.

Related errors


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