{"record":{"id":"7fb90f66d43d6bf3","repo":"microsoft/qlib","slug":"sampling-freq-must-be-xmin-xd-xw-xm","errorCode":null,"errorMessage":"sampling freq must be xmin, xd, xw, xm","messagePattern":"sampling freq must be xmin, xd, xw, xm","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"qlib/utils/resam.py","lineNumber":69,"sourceCode":"        return _calendar_minute\n\n    # else, convert the raw calendar into day calendar, and divide the whole calendar into several bars evenly\n    else:\n        _calendar_day = np.unique(list(map(lambda x: pd.Timestamp(x.year, x.month, x.day, 0, 0, 0), calendar_raw)))\n        if freq_sam.base == Freq.NORM_FREQ_DAY:\n            return _calendar_day[:: freq_sam.count]\n\n        elif freq_sam.base == Freq.NORM_FREQ_WEEK:\n            _day_in_week = np.array(list(map(lambda x: x.dayofweek, _calendar_day)))\n            _calendar_week = _calendar_day[np.ediff1d(_day_in_week, to_begin=-1) < 0]\n            return _calendar_week[:: freq_sam.count]\n\n        elif freq_sam.base == Freq.NORM_FREQ_MONTH:\n            _day_in_month = np.array(list(map(lambda x: x.day, _calendar_day)))\n            _calendar_month = _calendar_day[np.ediff1d(_day_in_month, to_begin=-1) < 0]\n            return _calendar_month[:: freq_sam.count]\n        else:\n            raise ValueError(\"sampling freq must be xmin, xd, xw, xm\")\n\n\ndef get_higher_eq_freq_feature(instruments, fields, start_time=None, end_time=None, freq=\"day\", disk_cache=1):\n    \"\"\"get the feature with higher or equal frequency than `freq`.\n    Returns\n    -------\n    pd.DataFrame\n        the feature with higher or equal frequency\n    \"\"\"\n\n    from ..data.data import D  # pylint: disable=C0415\n\n    try:\n        _result = D.features(instruments, fields, start_time, end_time, freq=freq, disk_cache=disk_cache)\n        _freq = freq\n    except (ValueError, KeyError) as value_key_e:\n        _, norm_freq = Freq.parse(freq)\n        if norm_freq in [Freq.NORM_FREQ_MONTH, Freq.NORM_FREQ_WEEK, Freq.NORM_FREQ_DAY]:","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/utils/resam.py#L51-L87","documentation":"Error \"sampling freq must be xmin, xd, xw, xm\" thrown in microsoft/qlib.","triggerScenarios":"This error is raised at qlib/utils/resam.py:69 when the guard condition fails: \"sampling freq must be xmin, xd, xw, xm\". It triggers when the code path receives input or a state that violates the precondition checked at this point — e.g. an unimplemented abstract method being called, an unsupported argument type/value, or an invalid configuration. To avoid it, satisfy the documented precondition before this call: implement the required method in your subclass, or pass a supported value of the expected type as described by the message.","commonSituations":"See trigger scenarios.","solutions":["Use a sampling freq of the form xmin, xd, xw, or xm (e.g. '5min', '1d', '2w', '1m').","Correct the freq string in your call to match the supported pattern."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}