{"record":{"id":"3f6310f16b48a4fc","repo":"OpenBB-finance/OpenBB","slug":"no-data-returned-from-fmp-for-the-given-query","errorCode":null,"errorMessage":"No data returned from FMP for the given query.","messagePattern":"No data returned from FMP for the given query\\.","errorType":"exception","errorClass":"EmptyDataError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/fmp/openbb_fmp/models/equity_historical.py","lineNumber":119,"sourceCode":"    @staticmethod\n    async def aextract_data(\n        query: FMPEquityHistoricalQueryParams,\n        credentials: dict[str, str] | None,\n        **kwargs: Any,\n    ) -> list[dict]:\n        \"\"\"Return the raw data from the FMP endpoint.\"\"\"\n        # pylint: disable=import-outside-toplevel\n        from openbb_fmp.utils.helpers import get_historical_ohlc\n\n        return await get_historical_ohlc(query, credentials, **kwargs)\n\n    @staticmethod\n    def transform_data(\n        query: FMPEquityHistoricalQueryParams, data: list[dict], **kwargs: Any\n    ) -> list[FMPEquityHistoricalData]:\n        \"\"\"Return the transformed data.\"\"\"\n        if not data:\n            raise EmptyDataError(\"No data returned from FMP for the given query.\")\n        return [\n            FMPEquityHistoricalData.model_validate(d)\n            for d in sorted(\n                data,\n                key=lambda x: (\n                    (x[\"date\"], x[\"symbol\"])\n                    if len(query.symbol.split(\",\")) > 1\n                    else x[\"date\"]\n                ),\n                reverse=False,\n            )\n        ]\n","sourceCodeStart":101,"sourceCodeEnd":132,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/fmp/openbb_fmp/models/equity_historical.py#L101-L132","documentation":"Raised as EmptyDataError by FMPEquityHistorical.transform_data when get_historical_ohlc returned an empty list for the query. Because a_url delegates to the shared get_historical_ohlc helper (which selects chart vs candle endpoints by interval), emptiness means FMP had no rows for the symbol/date/interval combination.","triggerScenarios":"Calling obb.equity.price.historical(symbol=X, provider='fmp') where X is unknown/delisted, or where the requested start_date/end_date window excludes all available bars (e.g. a future date range on the candle endpoint).","commonSituations":"Typo'd or delisted symbols, date windows entirely in the future or before the asset listed, intraday windows older than FMP's intraday history, or an API-key/plan issue yielding empty payloads.","solutions":["Validate the symbol first with obb.equity.profile / quote","Check that start_date/end_date form a sane, past-facing window that overlaps the asset's listing period","For old intraday data, verify FMP actually retains bars that far back; switch to daily if not","Catch EmptyDataError and skip/fallback per symbol when fetching batches"],"exampleFix":"# before\nres = obb.equity.price.historical(symbol='TSLAQ', provider='fmp', start_date='2030-01-01')  # delisted + future window\n\n# after\nres = obb.equity.price.historical(symbol='TSLA', provider='fmp', start_date='2024-01-01', end_date='2024-06-30')","handlingStrategy":"validation","validationCode":"from datetime import date\nif start_date and start_date > date.today():\n    raise ValueError('start_date is in the future; FMP will return no bars')\n# optionally verify symbol exists first\nassert obb.equity.quote(symbol=sym, provider='fmp').results, f'{sym} unknown to FMP'","typeGuard":"null","tryCatchPattern":"from openbb_core.provider.utils.errors import EmptyDataError\ntry:\n    bars = await obb.equity.price.historical.async_(symbol=sym, provider='fmp', start_date=s, end_date=e)\nexcept EmptyDataError:\n    bars = []  # skip symbol in batch backfills","preventionTips":["Pre-screen symbol universes through profile/quote before bulk historical pulls","Keep date windows past-facing and inside the asset's listing period","In batch jobs, catch per-symbol EmptyDataError and continue"],"tags":["fmp","empty-data","historical-prices","symbol"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}