{"record":{"id":"9d9c267ae220e31f","repo":"ZhuLinsen/daily_stock_analysis","slug":"finnhub-no-data-returned-for-symbol","errorCode":null,"errorMessage":"[Finnhub] No data returned for {symbol}","messagePattern":"\\[Finnhub\\] No data returned for (.+?)","errorType":"exception","errorClass":"DataFetchError","httpStatus":null,"severity":"error","filePath":"data_provider/finnhub_fetcher.py","lineNumber":69,"sourceCode":"        url = f\"{_FINNHUB_BASE_URL}/stock/candle\"\n        params = {\n            'symbol': symbol,\n            'resolution': 'D',\n            'from': start_ts,\n            'to': end_ts,\n            'token': self._api_key,\n        }\n\n        try:\n            self.random_sleep(0.3, 0.8)\n            resp = requests.get(url, params=params, timeout=15)\n            resp.raise_for_status()\n            data = resp.json()\n        except Exception as e:\n            raise DataFetchError(f\"[Finnhub] HTTP request failed for {symbol}: {e}\") from e\n\n        if data.get('s') != 'ok' or not data.get('c'):\n            raise DataFetchError(f\"[Finnhub] No data returned for {symbol}\")\n\n        return pd.DataFrame({\n            'c': data['c'],\n            'h': data['h'],\n            'l': data['l'],\n            'o': data['o'],\n            't': data['t'],\n            'v': data['v'],\n        })\n\n    def _normalize_data(self, df: pd.DataFrame, stock_code: str) -> pd.DataFrame:\n        if df.empty:\n            return df\n\n        df = df.copy()\n        df['date'] = pd.to_datetime(df['t'], unit='s').dt.date\n        df = df.rename(columns={\n            'o': 'open', 'h': 'high', 'l': 'low',","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/ZhuLinsen/daily_stock_analysis/blob/5159bd72e8373d215492dff122acc9d389e219c9/data_provider/finnhub_fetcher.py#L51-L87","documentation":"Finnhub answered HTTP 200 but the candle payload is unusable: status field 's' != 'ok' or the close array 'c' is empty/missing. Finnhub uses s='no_data' for valid symbols with no bars in range and s can reflect invalid symbols too, so this covers both 'no coverage' and 'wrong window'.","triggerScenarios":"GET /stock/candle where from/to window predates the symbol's listing, the symbol is delisted/misspelled, or free-tier restrictions exclude it (some tickers/IPOs). Finnhub returns s='no_data' with empty arrays.","commonSituations":"See trigger scenarios.","solutions":["Shift start/end dates into the symbol's actual trading history (e.g. after IPO date) and retry.","Verify the symbol on finnhub.com — delisted or unsupported tickers yield no_data permanently; route those to Yfinance.","Fail over via DataFetcherManager to the next US source for this symbol rather than retrying the same window blindly."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"# confirm the symbol has bars in the window before calling\n# e.g. check listing date from a metadata source, or just widen window:\ndf = finnhub.get_daily_data(symbol, start='1990-01-01', end=today)  # probe once","typeGuard":null,"tryCatchPattern":"try:\n    df = finnhub.get_daily_data(symbol, start, end)\nexcept DataFetchError as e:\n    if 'No data returned' in str(e):\n        df = manager.get_daily_data(symbol, start, end)  # Yfinance usually covers it","preventionTips":["Align start_date with the symbol's listing/active trading period.","For delisted or exotic tickers, prefer Yfinance as primary source.","Treat 'No data returned' as a coverage gap, not a transient error — don't blind-retry."],"tags":["finnhub","no-data","date-range","delisted"],"backgroundTag":null,"analyzedSha":"5159bd72e8373d215492dff122acc9d389e219c9","analyzedAt":"2026-08-15T01:59:36.292Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}