{"record":{"id":"d7b57d7f00b69aac","repo":"microsoft/qlib","slug":"this-type-of-input-rtype-is-not-supported","errorCode":null,"errorMessage":"This type of input {rtype} is not supported","messagePattern":"This type of input (.+?) is not supported","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"qlib/backtest/decision.py","lineNumber":504,"sourceCode":"            2) raise_error is True\n        \"\"\"\n        # potential performance issue\n        day_start = pd.Timestamp(self.start_time.date())\n        day_end = epsilon_change(day_start + pd.Timedelta(days=1))\n        freq = self.strategy.trade_exchange.freq\n        _, _, day_start_idx, day_end_idx = Cal.locate_index(day_start, day_end, freq=freq)\n        if self.trade_range is None:\n            if raise_error:\n                raise NotImplementedError(f\"There is no trade_range in this case\")\n            else:\n                return 0, day_end_idx - day_start_idx\n        else:\n            if rtype == \"full\":\n                val_start, val_end = self.trade_range.clip_time_range(day_start, day_end)\n            elif rtype == \"step\":\n                val_start, val_end = self.trade_range.clip_time_range(self.start_time, self.end_time)\n            else:\n                raise ValueError(f\"This type of input {rtype} is not supported\")\n            _, _, start_idx, end_index = Cal.locate_index(val_start, val_end, freq=freq)\n            return start_idx - day_start_idx, end_index - day_start_idx\n\n    def empty(self) -> bool:\n        for obj in self.get_decision():\n            if isinstance(obj, Order):\n                # Zero amount order will be treated as empty\n                if obj.amount > 1e-6:\n                    return False\n            else:\n                return True\n        return True\n\n    def mod_inner_decision(self, inner_trade_decision: BaseTradeDecision) -> None:\n        \"\"\"\n        This method will be called on the inner_trade_decision after it is generated.\n        `inner_trade_decision` will be changed **inplace**.\n","sourceCodeStart":486,"sourceCodeEnd":522,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/backtest/decision.py#L486-L522","documentation":"The day-relative range calculator only accepts rtype='full' (limitation across the whole trading day) or rtype='step' (limitation of the current step). Any other string hits the ValueError. This is a strict enum check on the rtype parameter of the decision's index-range API.","triggerScenarios":"Calling the method with a typo or unsupported value, e.g. rtype='day', rtype='Step', or rtype=None while the decision has a trade_range set.","commonSituations":"Custom executor/strategy code passing a made-up rtype; case mismatch ('Full' vs 'full'); copying example code that predates the rtype parameter.","solutions":["Use rtype='full' for the whole-day range or rtype='step' for the current step range","If you need an unclipped range, omit trade_range handling and use raise_error=False to get the full day instead of inventing an rtype"],"exampleFix":"// before\nidx = decision.get_range_limit(rtype='day', raise_error=True)\n// after\nidx = decision.get_range_limit(rtype='full', raise_error=False)","handlingStrategy":"validation","validationCode":"rtype = rtype.lower()\nassert rtype in ('full', 'step'), f\"rtype must be 'full' or 'step', got {rtype!r}\"\nidx = decision.get_range_limit(rtype=rtype, raise_error=False)","typeGuard":"def is_valid_rtype(r: str) -> bool:\n    return isinstance(r, str) and r in ('full', 'step')","tryCatchPattern":null,"preventionTips":["Whitelist rtype against {'full','step'} at call sites","Avoid inventing new rtype values; extend the method in a subclass instead"],"tags":["qlib","backtest","invalid-argument","value-error"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}