{"record":{"id":"b9d380e17476eb0a","repo":"OpenBB-finance/OpenBB","slug":"period-query-period-not-supported-b9d380","errorCode":null,"errorMessage":"Period '{query.period}' not supported.","messagePattern":"Period '(.+?)' not supported\\.","errorType":"exception","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/intrinio/openbb_intrinio/models/financial_ratios.py","lineNumber":169,"sourceCode":"    def transform_query(params: dict[str, Any]) -> IntrinioFinancialRatiosQueryParams:\n        \"\"\"Transform the query params.\"\"\"\n        return IntrinioFinancialRatiosQueryParams(**params)\n\n    @staticmethod\n    async def aextract_data(\n        query: IntrinioFinancialRatiosQueryParams,\n        credentials: dict[str, str] | None,\n        **kwargs: Any,\n    ) -> list[dict]:\n        \"\"\"Return the raw data from the Intrinio endpoint.\"\"\"\n        api_key = credentials.get(\"intrinio_api_key\") if credentials else \"\"\n        statement_code = \"calculations\"\n        if query.period in [\"quarter\", \"annual\"]:\n            period_type = \"FY\" if query.period == \"annual\" else \"QTR\"\n        elif query.period in [\"ttm\", \"ytd\"]:\n            period_type = query.period.upper()\n        else:\n            raise OpenBBError(f\"Period '{query.period}' not supported.\")\n\n        fundamentals_data: dict = {}\n\n        base_url = \"https://api-v2.intrinio.com\"\n        fundamentals_url = (\n            f\"{base_url}/companies/{query.symbol}\"\n            f\"/fundamentals?statement_code={statement_code}&type={period_type}\"\n        )\n        if query.fiscal_year is not None:\n            if query.fiscal_year < 2008:\n                warn(\"Financials data is only available from 2008 and later.\")\n                query.fiscal_year = 2008\n            fundamentals_url = fundamentals_url + f\"&fiscal_year={query.fiscal_year}\"\n        fundamentals_url = fundamentals_url + f\"&api_key={api_key}\"\n        fundamentals_data = (await get_data_one(fundamentals_url, **kwargs)).get(\n            \"fundamentals\", []\n        )\n        ids = [item[\"id\"] for item in fundamentals_data]","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/intrinio/openbb_intrinio/models/financial_ratios.py#L151-L187","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use one of: quarter, annual, ttm, ytd","Map your app's vocabulary to the provider's before calling: {'quarterly': 'quarter', 'yearly': 'annual'}","Add a client-side allowlist check on period before invoking the API"],"exampleFix":"# before\nres = obb.equity.fundamental.ratios(provider=\"intrinio\", symbol=\"AAPL\", period=\"quarterly\")\n\n# after\nres = obb.equity.fundamental.ratios(provider=\"intrinio\", symbol=\"AAPL\", period=\"quarter\")","handlingStrategy":"validation","validationCode":"SUPPORTED_PERIODS = {\"quarter\", \"annual\", \"ttm\", \"ytd\"}\n\nPERIOD_ALIASES = {\"quarterly\": \"quarter\", \"yearly\": \"annual\", \"fy\": \"annual\"}\n\ndef normalize_period(period: str) -> str:\n    p = PERIOD_ALIASES.get(period.lower(), period.lower())\n    if p not in SUPPORTED_PERIODS:\n        raise ValueError(f\"period must be one of {sorted(SUPPORTED_PERIODS)}, got {period!r}\")\n    return p","typeGuard":"def is_supported_period(period: str) -> bool:\n    return period.lower() in {\"quarter\", \"annual\", \"ttm\", \"ytd\"}","tryCatchPattern":"from openbb_core.provider.abstract.error import OpenBBError\n\ntry:\n    res = await obb.equity.fundamental.ratios(provider=\"intrinio\", symbol=sym, period=p)\nexcept OpenBBError as e:\n    if \"not supported\" in str(e):\n        raise ValueError(f\"bad period {p!r}; use quarter/annual/ttm/ytd\") from e\n    raise","preventionTips":["Allowlist period values client-side before calling","Map app vocabulary (quarterly/yearly) to the provider's terms","Never pass raw user input as period"],"tags":["validation","financial-ratios","intrinio","period","query-params"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}