microsoft/qlib · error · ValueError

interval error: {self.interval}

Error message

interval error: {self.interval}

What it means

Raised by FundCollector.init_datetime when self.interval is neither INTERVAL_1min nor INTERVAL_1d. Like the crypto collector, the fund collector only supports daily and 1-minute data, clamping 1min starts to a default earliest datetime.

Source

Thrown at scripts/data_collector/fund/collector.py:82

            start=start,
            end=end,
            interval=interval,
            max_workers=max_workers,
            max_collector_count=max_collector_count,
            delay=delay,
            check_data_length=check_data_length,
            limit_nums=limit_nums,
        )

        self.init_datetime()

    def init_datetime(self):
        if self.interval == self.INTERVAL_1min:
            self.start_datetime = max(self.start_datetime, self.DEFAULT_START_DATETIME_1MIN)
        elif self.interval == self.INTERVAL_1d:
            pass
        else:
            raise ValueError(f"interval error: {self.interval}")

        self.start_datetime = self.convert_datetime(self.start_datetime, self._timezone)
        self.end_datetime = self.convert_datetime(self.end_datetime, self._timezone)

    @staticmethod
    def convert_datetime(dt: [pd.Timestamp, datetime.date, str], timezone):
        try:
            dt = pd.Timestamp(dt, tz=timezone).timestamp()
            dt = pd.Timestamp(dt, tz=tzlocal(), unit="s")
        except ValueError as e:
            pass
        return dt

    @property
    @abc.abstractmethod
    def _timezone(self):
        raise NotImplementedError("rewrite get_timezone")

View on GitHub (pinned to 79633dd950)

Solutions

  1. Use --interval 1d or --interval 1min.
  2. Verify the exact string (no spaces, lowercase) if the value is templated from a script.

Example fix

# before
python collector.py download_data --interval 5min

# after
python collector.py download_data --interval 1d
Defensive patterns

Strategy: validation

Validate before calling

assert interval in ("1d", "1min"), f"fund collector supports 1d/1min only, got {interval!r}"

Prevention

When it happens

Trigger: Running the fund collector with --interval other than 1d/1min (e.g. 5min or 'day'), or a config-supplied interval with different naming.

Common situations: Reusing interval values from other collectors; typos; whitespace/case differences in CLI args.

Related errors


AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15). Data as JSON: /api/errors/0594dd8840b61742. Report an issue: GitHub.