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
EmptyDataError (default message 'No results found. Try adjusting the query parameters.') raised at the end of get_agency_holdings when the NY Fed response contains an empty soma.holdings array. The request succeeded and validation passed, but nothing matched the as_of/cusip/holding_type combination.
Source
Thrown at openbb_platform/providers/federal_reserve/openbb_federal_reserve/utils/ny_fed_api.py:481
"soma_holdings"
]["agency_debts"]
response = await fetch_data(url)
return [response.get("soma", {})]
url = _get_endpoints(date=as_of)["soma_holdings"]["get_as_of"]
if holding_type is not None:
if holding_type not in AGENCY_HOLDING_TYPES:
raise OpenBBError(
"Invalid choice. Choose from: ['all', 'agency debts', 'mbs', 'cmbs']"
)
url = _get_endpoints(
agency_holding_type=AGENCY_HOLDING_TYPES[holding_type], date=as_of
)["soma_holdings"]["get_holding_type"]
if cusip is not None:
url = _get_endpoints(cusips=cusip)["soma_holdings"]["get_cusip"]
response = await fetch_data(url)
holdings = response.get("soma", {}).get("holdings", [])
if not holdings:
raise EmptyDataError()
return holdings
async def get_treasury_holdings( # pylint: disable=R0917
self,
as_of: str | None = None,
cusip: str | None = None,
holding_type: str | None = None,
wam: bool | None = False,
monthly: bool | None = False,
) -> list[dict]:
"""Get the latest Treasury holdings, or as of a single date.
Parameters
----------
as_of: Optional[str]
The as-of date to get data for. Defaults to the latest.
cusip: Optional[str]View on GitHub (pinned to 3e071fcc2c)
Solutions
- Fetch valid dates with await SomaHoldings().get_as_of_dates() and pass one explicitly.
- Double-check the CUSIP against the Fed's published holdings; drop cusip to see if any rows return for that date.
- Handle EmptyDataError as a no-match result in the caller.
Example fix
// before h = await SomaHoldings().get_agency_holdings(as_of='2024-06-01') # a Saturday // after dates = await SomaHoldings().get_as_of_dates() h = await SomaHoldings().get_agency_holdings(as_of=dates[0])
Defensive patterns
Strategy: validation
Validate before calling
dates = await SomaHoldings().get_as_of_dates()
if as_of and as_of not in dates:
as_of = dates[0] # snap to nearest valid SOMA operations date Try / catch
from openbb_core.provider.standard_errors import EmptyDataError
try:
holdings = await SomaHoldings().get_agency_holdings(as_of=as_of, cusip=cusip)
except EmptyDataError:
holdings = await SomaHoldings().get_agency_holdings(as_of=as_of) # retry without cusip filter Prevention
- Always source as_of from get_as_of_dates, never calendar guesses
- Verify CUSIPs exist in the portfolio before filtering on them
When it happens
Trigger: Passing an as_of date that is not a valid SOMA operations date (e.g. a weekend or holiday); a CUSIP not present in the agency portfolio; holding_type + date combos with no rows; or upstream empty responses.
Common situations: Using calendar dates instead of SOMA business dates (obtainable via get_as_of_dates); typo'd CUSIPs; querying before the dataset's start date.
Related errors
- There was an error with the request and was returned empty.
- The request was returned empty.
- No results found. Try adjusting the query parameters.
- Error requesting dates. Please try again later.
- No data found. Try again later.
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/ba298f30dbbdc3cb.
Report an issue: GitHub.