microsoft/qlib · error · ValueError
Unsupported freq: {freq}
Error message
Unsupported freq: {freq} What it means
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.
Source
Thrown at scripts/data_collector/contrib/future_trading_date_collector/future_trading_date_collector.py:45
return pd.read_csv(calendar_path, header=None)
def write_calendar_to_qlib(qlib_dir: Path, date_list: List[str], freq: str = "day"):
calendar_path = str(qlib_dir.joinpath("calendars").joinpath(f"{freq}_future.txt"))
np.savetxt(calendar_path, date_list, fmt="%s", encoding="utf-8")
logger.info(f"write future calendars success: {calendar_path}")
def generate_qlib_calendar(date_list: List[str], freq: str) -> List[str]:
print(freq)
if freq == "day":
return date_list
elif freq == "1min":
date_list = generate_minutes_calendar_from_daily(date_list, freq=freq).tolist()
return list(map(lambda x: pd.Timestamp(x).strftime("%Y-%m-%d %H:%M:%S"), date_list))
else:
raise ValueError(f"Unsupported freq: {freq}")
def future_calendar_collector(qlib_dir: [str, Path], freq: str = "day"):
"""get future calendar
Parameters
----------
qlib_dir: str or Path
qlib data directory
freq: str
value from ["day", "1min"], by default day
"""
qlib_dir = Path(qlib_dir).expanduser().resolve()
if not qlib_dir.exists():
raise FileNotFoundError(str(qlib_dir))
lg = bs.login()
if lg.error_code != "0":View on GitHub (pinned to 79633dd950)
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).
Example fix
# before python future_trading_date_collector.py --qlib_dir ~/.qlib/qlib_data/future_data --freq 1d # after python future_trading_date_collector.py --qlib_dir ~/.qlib/qlib_data/future_data --freq day
Defensive patterns
Strategy: validation
Validate before calling
assert freq in ("day", "1min"), f"freq must be 'day' or '1min', got {freq!r}" Prevention
- Note this script's daily value is 'day', not qlib's '1d'.
- Validate freq in pipeline config before launching the collector.
When it happens
Trigger: Running future_trading_date_collector.py with --freq 5min, --freq 1d (note: the accepted daily value is 'day', not '1d'), or any typo.
Common situations: 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.
Related errors
- This type of input {rtype} is not supported
- can't find a freq from {self.support_freq} that can resample
- This type of input is not supported
- The segment is out of valid calendar
- source_dir and target_dir cannot be None
AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15).
Data as JSON: /api/errors/8681af57e9064500.
Report an issue: GitHub.