OpenBB-finance/OpenBB · error · OpenBBError

Period '{query.period}' not supported.

Error message

Period '{query.period}' not supported.

What it means

OpenBBError raised in IntrinioFinancialRatiosFetcher.transform_query when query.period is not one of the supported values. The fetcher maps 'quarter'->'QTR', 'annual'->'FY', and passes 'ttm'/'ytd' through uppercased; anything else cannot be mapped to a fundamentals 'type' parameter, so it fails fast before any HTTP request.

Source

Thrown at openbb_platform/providers/intrinio/openbb_intrinio/models/financial_ratios.py:169

    def transform_query(params: dict[str, Any]) -> IntrinioFinancialRatiosQueryParams:
        """Transform the query params."""
        return IntrinioFinancialRatiosQueryParams(**params)

    @staticmethod
    async def aextract_data(
        query: IntrinioFinancialRatiosQueryParams,
        credentials: dict[str, str] | None,
        **kwargs: Any,
    ) -> list[dict]:
        """Return the raw data from the Intrinio endpoint."""
        api_key = credentials.get("intrinio_api_key") if credentials else ""
        statement_code = "calculations"
        if query.period in ["quarter", "annual"]:
            period_type = "FY" if query.period == "annual" else "QTR"
        elif query.period in ["ttm", "ytd"]:
            period_type = query.period.upper()
        else:
            raise OpenBBError(f"Period '{query.period}' not supported.")

        fundamentals_data: dict = {}

        base_url = "https://api-v2.intrinio.com"
        fundamentals_url = (
            f"{base_url}/companies/{query.symbol}"
            f"/fundamentals?statement_code={statement_code}&type={period_type}"
        )
        if query.fiscal_year is not None:
            if query.fiscal_year < 2008:
                warn("Financials data is only available from 2008 and later.")
                query.fiscal_year = 2008
            fundamentals_url = fundamentals_url + f"&fiscal_year={query.fiscal_year}"
        fundamentals_url = fundamentals_url + f"&api_key={api_key}"
        fundamentals_data = (await get_data_one(fundamentals_url, **kwargs)).get(
            "fundamentals", []
        )
        ids = [item["id"] for item in fundamentals_data]

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Use one of: quarter, annual, ttm, ytd
  2. Map your app's vocabulary to the provider's before calling: {'quarterly': 'quarter', 'yearly': 'annual'}
  3. Add a client-side allowlist check on period before invoking the API

Example fix

# before
res = obb.equity.fundamental.ratios(provider="intrinio", symbol="AAPL", period="quarterly")

# after
res = obb.equity.fundamental.ratios(provider="intrinio", symbol="AAPL", period="quarter")
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED_PERIODS = {"quarter", "annual", "ttm", "ytd"}

PERIOD_ALIASES = {"quarterly": "quarter", "yearly": "annual", "fy": "annual"}

def normalize_period(period: str) -> str:
    p = PERIOD_ALIASES.get(period.lower(), period.lower())
    if p not in SUPPORTED_PERIODS:
        raise ValueError(f"period must be one of {sorted(SUPPORTED_PERIODS)}, got {period!r}")
    return p

Type guard

def is_supported_period(period: str) -> bool:
    return period.lower() in {"quarter", "annual", "ttm", "ytd"}

Try / catch

from openbb_core.provider.abstract.error import OpenBBError

try:
    res = await obb.equity.fundamental.ratios(provider="intrinio", symbol=sym, period=p)
except OpenBBError as e:
    if "not supported" in str(e):
        raise ValueError(f"bad period {p!r}; use quarter/annual/ttm/ytd") from e
    raise

Prevention

When it happens

Trigger: Passing period values accepted by other providers or the router default but not handled here — e.g. 'monthly', 'weekly', 'quarterly' (note: 'quarterly', not 'quarter'), 'year', or custom strings. The check happens before the fundamentals URL is built, so no API call is wasted.

Common situations: Switching providers with code that used provider-specific period vocabularies ('quarterly' vs 'quarter'); passing user free-text directly into the parameter; version drift where the router allows values this provider branch does not map.

Related errors


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