{"record":{"id":"2c190770350a3c71","repo":"microsoft/qlib","slug":"request-error-2c1907","errorCode":null,"errorMessage":"request error","messagePattern":"request error","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"warning","filePath":"scripts/data_collector/fund/collector.py","lineNumber":113,"sourceCode":"\n    @property\n    @abc.abstractmethod\n    def _timezone(self):\n        raise NotImplementedError(\"rewrite get_timezone\")\n\n    @staticmethod\n    def get_data_from_remote(symbol, interval, start, end):\n        error_msg = f\"{symbol}-{interval}-{start}-{end}\"\n\n        try:\n            # TODO: numberOfHistoricalDaysToCrawl should be bigger enough\n            url = INDEX_BENCH_URL.format(\n                index_code=symbol, numberOfHistoricalDaysToCrawl=10000, startDate=start, endDate=end\n            )\n            resp = requests.get(url, headers={\"referer\": \"http://fund.eastmoney.com/110022.html\"}, timeout=None)\n\n            if resp.status_code != 200:\n                raise ValueError(\"request error\")\n\n            data = json.loads(resp.text.split(\"(\")[-1].split(\")\")[0])\n\n            # Some funds don't show the net value, example: http://fundf10.eastmoney.com/jjjz_010288.html\n            SYType = data[\"Data\"][\"SYType\"]\n            if SYType in {\"每万份收益\", \"每百份收益\", \"每百万份收益\"}:\n                raise ValueError(\"The fund contains 每*份收益\")\n\n            # TODO: should we sort the value by datetime?\n            _resp = pd.DataFrame(data[\"Data\"][\"LSJZList\"])\n\n            if isinstance(_resp, pd.DataFrame):\n                return _resp.reset_index()\n        except Exception as e:\n            logger.warning(f\"{error_msg}:{e}\")\n\n    def get_data(\n        self, symbol: str, interval: str, start_datetime: pd.Timestamp, end_datetime: pd.Timestamp","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/scripts/data_collector/fund/collector.py#L95-L131","documentation":"Raised by FundCollector.get_data_from_remote when the eastmoney fund API responds with a non-200 status. The request uses INDEX_BENCH_URL with a referer header; a non-200 is considered a request failure. Note the outer try logs a warning with '{symbol}-{interval}-{start}-{end}' and returns None rather than propagating.","triggerScenarios":"Requesting historical NAV for a fund code while fund.eastmoney.com returns 403/302/5xx (anti-bot, invalid referer, rate limiting) or the fund code is malformed yielding an error page.","commonSituations":"Running the fund collector at high concurrency triggering eastmoney throttling; network/proxy issues; fund codes scraped from a stale instrument list that no longer resolve.","solutions":["Check the logged warning for the failing symbol and test the URL in a browser/curl with the referer header to inspect the real status.","Slow down / add sleeps between requests or reduce max_workers to avoid throttling.","Confirm fund codes are valid eastmoney codes (6 digits typically); drop retired funds from the instrument list.","Retry later — eastmoney intermittently blocks datacenter IPs."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"resp = requests.get(url, headers={\"referer\": \"http://fund.eastmoney.com/110022.html\"}, timeout=30)\nif resp.status_code != 200:\n    raise RuntimeError(f\"eastmoney returned {resp.status_code} for {symbol}; retry later or reduce concurrency\")","typeGuard":null,"tryCatchPattern":"try:\n    df = FundCollector.get_data_from_remote(symbol, interval, start, end)\nexcept Exception:\n    df = None  # collector already logs the warning; skip symbol and continue\nif df is None:\n    logger.warning(f\"skipping {symbol}: no data returned\")","preventionTips":["Rate-limit requests to eastmoney (sleep between symbols, low max_workers).","Check the logged '{symbol}-{interval}-{start}-{end}' warning to identify blocked symbols.","Re-run failed symbols in a second pass rather than aborting the batch."],"tags":["qlib","data-collector","fund","eastmoney","network"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}