{"record":{"id":"3b2b90f342ee85b8","repo":"microsoft/qlib","slug":"get-data-error-symbol-start-end-the-stoc","errorCode":null,"errorMessage":"get data error: {symbol}--{start_}--{end_}The stock may be delisted, please check","messagePattern":"get data error: (.+?)--(.+?)--(.+?)The stock may be delisted, please check","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"warning","filePath":"scripts/data_collector/yahoo/collector.py","lineNumber":166,"sourceCode":"                f\"get data error: {symbol}--{start}--{end}\"\n                + \"Your data request fails. This may be caused by your firewall (e.g. GFW). Please switch your network if you want to access Yahoo! data\"\n            )\n\n    def get_data(\n        self, symbol: str, interval: str, start_datetime: pd.Timestamp, end_datetime: pd.Timestamp\n    ) -> pd.DataFrame:\n        @deco_retry(retry_sleep=self.delay, retry=self.retry)\n        def _get_simple(start_, end_):\n            self.sleep()\n            _remote_interval = \"1m\" if interval == self.INTERVAL_1min else interval\n            resp = self.get_data_from_remote(\n                symbol,\n                interval=_remote_interval,\n                start=start_,\n                end=end_,\n            )\n            if resp is None or resp.empty:\n                raise ValueError(\n                    f\"get data error: {symbol}--{start_}--{end_}\" + \"The stock may be delisted, please check\"\n                )\n            return resp\n\n        _result = None\n        if interval == self.INTERVAL_1d:\n            try:\n                _result = _get_simple(start_datetime, end_datetime)\n            except ValueError as e:\n                pass\n        elif interval == self.INTERVAL_1min:\n            _res = []\n            _start = self.start_datetime\n            while _start < self.end_datetime:\n                _tmp_end = min(_start + pd.Timedelta(days=7), self.end_datetime)\n                try:\n                    _resp = _get_simple(_start, _tmp_end)\n                    _res.append(_resp)","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/scripts/data_collector/yahoo/collector.py#L148-L184","documentation":"Raised inside _get_simple of YahooCollector.get_data (scripts/data_collector/yahoo/collector.py:166) when get_data_from_remote returns None or an empty DataFrame for the requested symbol/window. The message points at the most common cause — a delisted/invalid ticker — but any upstream empty response (rate limit, bad date range, suspended stock) triggers it. The @deco_retry wrapper retries first; for INTERVAL_1d the outer code swallows this ValueError (except: pass) and returns an empty DataFrame, while the 1min loop also tolerates it per 7-day chunk.","triggerScenarios":"Requesting bars for a symbol yahooquery has no data on: delisted tickers, wrong symbol format for the region (suffix mapping), date ranges entirely outside the listing period, or empty responses after retries. For 1d the exception is caught upstream, so users mostly see it when calling get_data directly or as silent empty results.","commonSituations":"Bulk-collecting a universe that includes delisted/renamed tickers (e.g. old SP500 constituents); symbols normalized incorrectly (suffix/prefix mismatch); start/end dates in the future or before IPO.","solutions":["Verify the symbol trades on Yahoo Finance (finance.yahoo.com search) and matches the expected format for the collector subclass.","Clamp start/end to the ticker's listing period, or drop the ticker from the batch.","If it is a genuine data hole for a live ticker, rerun later — transient yahooquery throttling can also return empty.","When calling get_data directly, wrap with try/except ValueError and treat empty as 'no data', matching the collector's own 1d behavior."],"exampleFix":"# before\ndf = collector.get_data(symbol, interval='1d', start_datetime=s, end_datetime=e)\n\n# after\ntry:\n    df = collector.get_data(symbol, interval='1d', start_datetime=s, end_datetime=e)\nexcept ValueError as e:\n    print(f'skip {symbol}: {e}')  # likely delisted / no data in window\n    df = pd.DataFrame()","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    df = collector.get_data(symbol, interval='1d', start_datetime=s, end_datetime=e)\nexcept ValueError as e:\n    if 'may be delisted' in str(e):\n        df = pd.DataFrame()  # treat as no-data, mirror the collector's own 1d handling\n    else:\n        raise","preventionTips":["Filter symbol universes against a live listing set before bulk collection.","Clamp request windows to each ticker's listing period when known."],"tags":["yahoo","delisted","empty-data","retry"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}