microsoft/qlib · error · ValueError

cannot support {interval}

Error message

cannot support {interval}

What it means

Raised by FundCollector.get_data (scripts/data_collector/fund/collector.py:146) when the requested bar interval is anything other than the class constant INTERVAL_1d. The fund collector pipeline only knows how to fetch daily bars; any other interval string (e.g. '1min', '60m', 'weekly') reaches the final else-branch and raises ValueError. This is a capability gate, not a runtime data failure.

Source

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

            logger.warning(f"{error_msg}:{e}")

    def get_data(
        self, symbol: str, interval: str, start_datetime: pd.Timestamp, end_datetime: pd.Timestamp
    ) -> [pd.DataFrame]:
        def _get_simple(start_, end_):
            self.sleep()
            _remote_interval = interval
            return self.get_data_from_remote(
                symbol,
                interval=_remote_interval,
                start=start_,
                end=end_,
            )

        if interval == self.INTERVAL_1d:
            _result = _get_simple(start_datetime, end_datetime)
        else:
            raise ValueError(f"cannot support {interval}")
        return _result


class FundollectorCN(FundCollector, ABC):
    def get_instrument_list(self):
        logger.info("get cn fund symbols......")
        symbols = get_en_fund_symbols()
        logger.info(f"get {len(symbols)} symbols.")
        return symbols

    def normalize_symbol(self, symbol):
        return symbol

    @property
    def _timezone(self):
        return "Asia/Shanghai"

View on GitHub (pinned to 79633dd950)

Solutions

  1. Pass interval exactly equal to the collector's INTERVAL_1d constant (normally '1d') when invoking the fund collector.
  2. Check the collector's supported intervals (grep for INTERVAL_ constants in scripts/data_collector/fund/collector.py) before launching collection jobs.
  3. If intraday fund data is genuinely required, use a different data source/collector; do not try to force this one.

Example fix

# before
collector.get_data(symbol='000001', interval='1min', start_datetime=..., end_datetime=...)

# after
from scripts.data_collector.fund.collector import FundollectorCN
collector.get_data(symbol='000001', interval=FundollectorCN.INTERVAL_1d, start_datetime=..., end_datetime=...)
Defensive patterns

Strategy: validation

Validate before calling

from scripts.data_collector.fund.collector import FundollectorCN
allowed = {FundollectorCN.INTERVAL_1d}
assert interval in allowed, f'fund collector supports only {allowed}, got {interval}'

Type guard

def is_supported_fund_interval(interval: str, cls=FundollectorCN) -> bool:
    return interval == cls.INTERVAL_1d

Try / catch

try:
    df = collector.get_data(symbol, interval=interval, ...)
except ValueError as e:
    if 'cannot support' in str(e):
        raise SystemExit(f'unsupported interval for fund collection: {interval}')
    raise

Prevention

When it happens

Trigger: Calling collector_data()/get_data(symbol, interval=...) on a FundCollector subclass with interval not equal to self.INTERVAL_1d (typically '1d'). Note the branch above shows a nested path that retries via get_data_from_remote with a _remote_interval, but only the INTERVAL_1d case reaches _get_simple; everything else falls through to the raise.

Common situations: Copying a stock collector invocation (e.g. --interval 1min used with the yahoo collector) into the fund collector; passing a Binance-style interval string like '1d' vs '1day' mismatch; running fund collection with a config file written for minute data.

Related errors


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