{"record":{"id":"dc685b1561ed0cbb","repo":"OpenBB-finance/OpenBB","slug":"no-data-found-for-the-given-symbol-and-dates","errorCode":null,"errorMessage":"No data found for the given symbol and dates.","messagePattern":"No data found for the given symbol and dates\\.","errorType":"exception","errorClass":"EmptyDataError","httpStatus":null,"severity":"warning","filePath":"openbb_platform/providers/deribit/openbb_deribit/utils/helpers.py","lineNumber":327,"sourceCode":"                        \"volume_notional\",\n                    ]\n                ].to_dict(orient=\"records\")\n            )\n\n    urls = generate_urls(symbol, start_date, end_date, new_interval)\n\n    if len(urls) > 15:\n        raise OpenBBError(\n            \"The request is too large. Break up the request into smaller chunks.\"\n        )\n\n    tasks = [get_one(url) for url in urls]\n\n    await asyncio.gather(*tasks, return_exceptions=True)\n\n    if results:\n        return sorted(results, key=lambda x: x[\"date\"])\n    raise EmptyDataError(\"No data found for the given symbol and dates.\")\n\n\nasync def check_ohlc_symbol(symbol: str) -> bool | str:\n    \"\"\"\n    Check if the symbol has OHLC data.\n\n    Parameters\n    ----------\n    symbol : str\n        The symbol to check.\n\n    Returns\n    -------\n    bool\n        True if the symbol has OHLC data, False otherwise.\n    \"\"\"\n    all_instruments = await get_instruments(\"all\", None)\n    all_symbols = {","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/deribit/openbb_deribit/utils/helpers.py#L309-L345","documentation":"EmptyDataError raised at the end of Deribit's get_ohlc_data when the symbol resolved and all chunk requests completed, but the aggregated `results` list is empty — i.e. the API returned no OHLC rows for any window. OpenBB maps EmptyDataError to an empty result/warning at the router level rather than a hard failure.","triggerScenarios":"Requesting dates entirely before the instrument's creation (e.g. a 2023 option/future with start_date in 2020), delisted or expired instrument names, a start==end window with no candles at that resolution, or all chunk requests returning empty `result` payloads without an error field.","commonSituations":"Historical backfills that assume instruments existed earlier than they did; hardcoded expired futures contract names (e.g. BTC-27DEC24 after expiry); typos in instrument names that still resolve via get_instruments; weekend/holiday windows with no trades on illiquid options.","solutions":["Verify the instrument exists and its creation date via Deribit's public/get_instruments, then clip your start_date to after creation.","Use a currently listed or perpetual instrument (e.g. BTC-PERPETUAL) for long history.","Widen or shift the date range so it overlaps a period with actual trades.","Handle EmptyDataError as an empty result rather than crashing the pipeline."],"exampleFix":"// before\ndata = obb.crypto.historical(symbol=\"BTC-27DEC24\", start_date=\"2020-01-01\", end_date=\"2024-12-27\")\n\n// after\ntry:\n    data = obb.crypto.historical(symbol=\"BTC-PERPETUAL\", start_date=\"2024-01-01\", end_date=\"2024-06-01\")\nexcept Exception as e:\n    if \"No data found\" in str(e):\n        data = None  # empty window, skip","handlingStrategy":"try-catch","validationCode":"import requests\n\ndef symbol_has_ohlc(symbol: str, start: str) -> bool:\n    r = requests.get(\"https://www.deribit.com/api/v2/public/get_instruments\", params={\"currency\": \"all\", \"kind\": \"all\"})\n    created = {i[\"instrument_name\"]: i[\"creation_timestamp\"] for i in r.json()[\"result\"]}\n    ts = created.get(symbol)\n    return ts is not None and float(start.replace(\"-\", \"\")) >= str(ts)[:8].replace(\"-\", \"\")[:8] or ts is not None","typeGuard":null,"tryCatchPattern":"from openbb_core.provider.utils.errors import EmptyDataError\ntry:\n    res = obb.crypto.historical(symbol=sym, start_date=s, end_date=e, provider=\"deribit\")\nexcept EmptyDataError:\n    res = None  # no candles in window; treat as empty, not fatal","preventionTips":["Clip start_date to the instrument's creation date before requesting.","Prefer perpetual instruments for long histories.","Treat EmptyDataError as an expected empty result in batch loops."],"tags":["deribit","crypto","empty-data","ohlc","instrument-expiry"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}