microsoft/qlib · error · ValueError

cannot support {interval}

Error message

cannot support {interval}

What it means

Raised by the PIT (point-in-time financial report) collector's get_data (scripts/data_collector/pit/collector.py:203) when interval != INTERVAL_QUARTERLY. PIT data (performance express reports, profit, forecast, growth) is only meaningful at quarterly granularity, so any other interval is rejected up-front before the symbol is split into code/exchange and the four report fetches begin.

Source

Thrown at scripts/data_collector/pit/collector.py:203

        growth_df = pd.DataFrame(growth_list, columns=fields)
        try:
            growth_df = growth_df[list(column_mapping.keys())]
        except KeyError:
            return pd.DataFrame()
        growth_df.rename(columns=column_mapping, inplace=True)
        growth_df["field"] = "YOYNI"
        growth_df["value"] = pd.to_numeric(growth_df["value"], errors="ignore")
        return growth_df

    def get_data(
        self,
        symbol: str,
        interval: str,
        start_datetime: pd.Timestamp,
        end_datetime: pd.Timestamp,
    ) -> pd.DataFrame:
        if interval != self.INTERVAL_QUARTERLY:
            raise ValueError(f"cannot support {interval}")
        symbol, exchange = symbol.split(".")
        exchange = "sh" if exchange == "ss" else "sz"
        code = f"{exchange}.{symbol}"
        start_date = start_datetime.strftime("%Y-%m-%d")
        end_date = end_datetime.strftime("%Y-%m-%d")

        performance_express_report_df = self.get_performance_express_report_df(code, start_date, end_date)
        profit_df = self.get_profit_df(code, start_date, end_date)
        forecast_report_df = self.get_forecast_report_df(code, start_date, end_date)
        growth_df = self.get_growth_df(code, start_date, end_date)

        df = pd.concat(
            [performance_express_report_df, profit_df, forecast_report_df, growth_df],
            axis=0,
        )
        return df

View on GitHub (pinned to 79633dd950)

Solutions

  1. Pass exactly the collector's INTERVAL_QUARTERLY constant (check its literal value in the class) when calling get_data / running the PIT collector.
  2. Reference the class constant instead of hard-coding a string, so spelling cannot drift.
  3. If you need other report frequencies, use the appropriate collector — PIT is quarterly-only by design.

Example fix

# before
collector.get_data(symbol='600000.SS', interval='quarter', start_datetime=..., end_datetime=...)

# after
from scripts.data_collector.pit.collector import PitCollector  # adjust to actual class
collector.get_data(symbol='600000.SS', interval=collector.INTERVAL_QUARTERLY, start_datetime=..., end_datetime=...)
Defensive patterns

Strategy: validation

Validate before calling

assert interval == collector.INTERVAL_QUARTERLY, f'PIT collector is quarterly-only, got {interval}'

Type guard

def is_pit_interval(interval: str, collector_cls) -> bool:
    return interval == collector_cls.INTERVAL_QUARTERLY

Try / catch

try:
    df = collector.get_data(symbol, interval, start_datetime, end_datetime)
except ValueError as e:
    if 'cannot support' in str(e):
        raise SystemExit('use INTERVAL_QUARTERLY for PIT collection')
    raise

Prevention

When it happens

Trigger: Invoking the PIT collector's get_data with an interval string other than the class's INTERVAL_QUARTERLY constant, e.g. '1d', 'daily', '1min', or even 'quarter' if the constant is spelled differently.

Common situations: Reusing an interval value from the yahoo/fund collectors in the PIT pipeline; case/wording mismatches ('quarterly' vs 'q' vs 'quarter'); config templating that applies one interval to all collectors.

Related errors


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