{"record":{"id":"0ad3f252b71bd75b","repo":"microsoft/qlib","slug":"cannot-support-interval","errorCode":null,"errorMessage":"cannot support {interval}","messagePattern":"cannot support (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/data_collector/crypto/collector.py","lineNumber":167,"sourceCode":"            logger.warning(f\"{error_msg}:{e}\")\n\n    def get_data(\n        self, symbol: str, interval: str, start_datetime: pd.Timestamp, end_datetime: pd.Timestamp\n    ) -> [pd.DataFrame]:\n        def _get_simple(start_, end_):\n            self.sleep()\n            _remote_interval = interval\n            return self.get_data_from_remote(\n                symbol,\n                interval=_remote_interval,\n                start=start_,\n                end=end_,\n            )\n\n        if interval == self.INTERVAL_1d:\n            _result = _get_simple(start_datetime, end_datetime)\n        else:\n            raise ValueError(f\"cannot support {interval}\")\n        return _result\n\n\nclass CryptoCollector1d(CryptoCollector, ABC):\n    def get_instrument_list(self):\n        logger.info(\"get coingecko crypto symbols......\")\n        symbols = get_cg_crypto_symbols()\n        logger.info(f\"get {len(symbols)} symbols.\")\n        return symbols\n\n    def normalize_symbol(self, symbol):\n        return symbol\n\n    @property\n    def _timezone(self):\n        return \"Asia/Shanghai\"\n\n","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/scripts/data_collector/crypto/collector.py#L149-L185","documentation":"Raised in the crypto collector's validation/download path when interval equals INTERVAL_1d it calls _get_simple, otherwise it delegates 1min to get_data_from_remote via the earlier branch; reaching the final else means interval is neither 1d nor the 1min remote path — an unsupported combination for this collector class.","triggerScenarios":"Calling get_data (or download loop) with interval not in {1d, 1min} on CryptoCollector, or a subclass where the 1min branch condition (e.g. start/end bounds enabling remote fetch) is not met and a stray interval value falls through to the else.","commonSituations":"Passing 5min/1h intervals to the crypto collector; subclass overriding conditions such that only the else branch remains reachable; inconsistent interval constants after a refactor (INTERVAL_1min string mismatch with the check above).","solutions":["Use interval=1d or interval=1min with the crypto collector.","If subclassing, ensure your interval handling matches the branch conditions (1min goes through get_data_from_remote; only 1d reaches _get_simple).","For other granularities use the binance-based crypto collector scripts that support them."],"exampleFix":"# before\ncollector.get_data(symbol, interval=\"5min\", ...)\n\n# after\ncollector.get_data(symbol, interval=\"1min\", ...)","handlingStrategy":"validation","validationCode":"assert interval in (\"1d\", \"1min\"), f\"unsupported crypto interval: {interval!r}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep interval constants in one place when subclassing collectors.","Test subclass get_data paths for each supported interval."],"tags":["qlib","data-collector","crypto","interval"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}