{"record":{"id":"5959ef6b6b95c3c5","repo":"microsoft/qlib","slug":"us-calendar-is-not-supported","errorCode":null,"errorMessage":"Us calendar is not supported","messagePattern":"Us calendar is not supported","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/data_collector/future_calendar_collector.py","lineNumber":91,"sourceCode":"        if lg.error_code != \"0\":\n            raise ValueError(f\"login respond error_msg: {lg.error_msg}\")\n        rs = bs.query_trade_dates(\n            start_date=self._format_datetime(self.start_date), end_date=self._format_datetime(self.end_date)\n        )\n        if rs.error_code != \"0\":\n            raise ValueError(f\"query_trade_dates respond error_msg: {rs.error_msg}\")\n        data_list = []\n        while (rs.error_code == \"0\") & rs.next():\n            data_list.append(rs.get_row_data())\n        calendar = pd.DataFrame(data_list, columns=rs.fields)\n        calendar[\"is_trading_day\"] = calendar[\"is_trading_day\"].astype(int)\n        return pd.to_datetime(calendar[calendar[\"is_trading_day\"] == 1][\"calendar_date\"]).to_list()\n\n\nclass CollectorFutureCalendarUS(CollectorFutureCalendar):\n    def collector(self) -> Iterable[pd.Timestamp]:\n        # TODO: US future calendar\n        raise ValueError(\"Us calendar is not supported\")\n\n\ndef run(qlib_dir: Union[str, Path], region: str = \"cn\", start_date: str = None, end_date: str = None):\n    \"\"\"Collect future calendar(day)\n\n    Parameters\n    ----------\n    qlib_dir:\n        qlib data directory\n    region:\n        cn/CN or us/US\n    start_date\n        start date\n    end_date\n        end date\n\n    Examples\n    -------","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/scripts/data_collector/future_calendar_collector.py#L73-L109","documentation":"Raised unconditionally by CollectorFutureCalendarUS.collector (scripts/data_collector/future_calendar_collector.py:91). The US future-calendar branch is an explicit TODO stub: run(qlib_dir, region='us') dispatches to this class and immediately raises ValueError because no US calendar source has been implemented. There is no runtime condition that avoids it — it is a hard not-implemented marker.","triggerScenarios":"Calling run(qlib_dir, region='us'|'US') in scripts/data_collector/future_calendar_collector.py, or instantiating and calling .collector() on CollectorFutureCalendarUS.","commonSituations":"Users assuming feature parity between cn/us regions because the CLI accepts region='us'; automated pipelines iterating over both regions hitting the stub.","solutions":["Use region='cn' — only the CN collector is implemented.","For US calendars, source trading dates elsewhere (e.g. exchange holiday lists or another data vendor) and append them to calendars/day_future.txt yourself via the write_calendar pattern.","If you must extend the tool, subclass CollectorFutureCalendar and implement collector() for US before calling run()."],"exampleFix":"# before\nrun(qlib_dir='~/.qlib/qlib_data/us_data', region='us')  # raises immediately\n\n# after\nrun(qlib_dir='~/.qlib/qlib_data/cn_data', region='cn')","handlingStrategy":"validation","validationCode":"if region.lower() == 'us':\n    raise SystemExit('US future calendar collection is not implemented; only region=cn is supported')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Gate automation to region='cn' for future_calendar_collector.","Check for NotImplementedError/ValueError stubs before assuming cn/us parity in any collector."],"tags":["not-implemented","us-calendar","future-calendar","stub"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}