{"record":{"id":"8681af57e9064500","repo":"microsoft/qlib","slug":"unsupported-freq-freq","errorCode":null,"errorMessage":"Unsupported freq: {freq}","messagePattern":"Unsupported freq: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/data_collector/contrib/future_trading_date_collector/future_trading_date_collector.py","lineNumber":45,"sourceCode":"    return pd.read_csv(calendar_path, header=None)\n\n\ndef write_calendar_to_qlib(qlib_dir: Path, date_list: List[str], freq: str = \"day\"):\n    calendar_path = str(qlib_dir.joinpath(\"calendars\").joinpath(f\"{freq}_future.txt\"))\n\n    np.savetxt(calendar_path, date_list, fmt=\"%s\", encoding=\"utf-8\")\n    logger.info(f\"write future calendars success: {calendar_path}\")\n\n\ndef generate_qlib_calendar(date_list: List[str], freq: str) -> List[str]:\n    print(freq)\n    if freq == \"day\":\n        return date_list\n    elif freq == \"1min\":\n        date_list = generate_minutes_calendar_from_daily(date_list, freq=freq).tolist()\n        return list(map(lambda x: pd.Timestamp(x).strftime(\"%Y-%m-%d %H:%M:%S\"), date_list))\n    else:\n        raise ValueError(f\"Unsupported freq: {freq}\")\n\n\ndef future_calendar_collector(qlib_dir: [str, Path], freq: str = \"day\"):\n    \"\"\"get future calendar\n\n    Parameters\n    ----------\n    qlib_dir: str or Path\n        qlib data directory\n    freq: str\n        value from [\"day\", \"1min\"], by default day\n    \"\"\"\n    qlib_dir = Path(qlib_dir).expanduser().resolve()\n    if not qlib_dir.exists():\n        raise FileNotFoundError(str(qlib_dir))\n\n    lg = bs.login()\n    if lg.error_code != \"0\":","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/scripts/data_collector/contrib/future_trading_date_collector/future_trading_date_collector.py#L27-L63","documentation":"Raised by generate_qlib_calendar in the future trading date collector when freq is neither 'day' nor '1min'. Daily calendars are written as-is; 1min calendars are expanded from the daily list; any other frequency string is unsupported.","triggerScenarios":"Running future_trading_date_collector.py with --freq 5min, --freq 1d (note: the accepted daily value is 'day', not '1d'), or any typo.","commonSituations":"Users assuming qlib interval naming ('1d') applies here, but the script expects 'day'; passing a freq value copied from another collector's CLI; automated pipelines parameterizing freq from config that includes unsupported values.","solutions":["Use freq=day or freq=1min only.","If you passed 1d for daily data, switch to day.","For other frequencies you must implement calendar generation yourself (extend generate_qlib_calendar)."],"exampleFix":"# before\npython future_trading_date_collector.py --qlib_dir ~/.qlib/qlib_data/future_data --freq 1d\n\n# after\npython future_trading_date_collector.py --qlib_dir ~/.qlib/qlib_data/future_data --freq day","handlingStrategy":"validation","validationCode":"assert freq in (\"day\", \"1min\"), f\"freq must be 'day' or '1min', got {freq!r}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Note this script's daily value is 'day', not qlib's '1d'.","Validate freq in pipeline config before launching the collector."],"tags":["qlib","data-collector","calendar","future","freq"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}