{"record":{"id":"4a3f9f0f740ac340","repo":"microsoft/qlib","slug":"method-method-is-not-supported","errorCode":null,"errorMessage":"method {method} is not supported!","messagePattern":"method (.+?) is not supported!","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"qlib/backtest/report.py","lineNumber":568,"sourceCode":"        pa_config = indicator_config.get(\"pa_config\", {})\n        self._agg_base_price(inner_order_indicators, decision_list, trade_exchange, pa_config=pa_config)  # TODO\n        self._agg_order_price_advantage()\n\n    def _cal_trade_fulfill_rate(self, method: str = \"mean\") -> Optional[BaseSingleMetric]:\n        if method == \"mean\":\n            return self.order_indicator.transfer(\n                lambda ffr: ffr.mean(),\n            )\n        elif method == \"amount_weighted\":\n            return self.order_indicator.transfer(\n                lambda ffr, deal_amount: (ffr * deal_amount.abs()).sum() / (deal_amount.abs().sum()),\n            )\n        elif method == \"value_weighted\":\n            return self.order_indicator.transfer(\n                lambda ffr, trade_value: (ffr * trade_value.abs()).sum() / (trade_value.abs().sum()),\n            )\n        else:\n            raise ValueError(f\"method {method} is not supported!\")\n\n    def _cal_trade_price_advantage(self, method: str = \"mean\") -> Optional[BaseSingleMetric]:\n        if method == \"mean\":\n            return self.order_indicator.transfer(lambda pa: pa.mean())\n        elif method == \"amount_weighted\":\n            return self.order_indicator.transfer(\n                lambda pa, deal_amount: (pa * deal_amount.abs()).sum() / (deal_amount.abs().sum()),\n            )\n        elif method == \"value_weighted\":\n            return self.order_indicator.transfer(\n                lambda pa, trade_value: (pa * trade_value.abs()).sum() / (trade_value.abs().sum()),\n            )\n        else:\n            raise ValueError(f\"method {method} is not supported!\")\n\n    def _cal_trade_positive_rate(self) -> Optional[BaseSingleMetric]:\n        def func(pa):\n            return (pa > 0).sum() / pa.count()","sourceCodeStart":550,"sourceCodeEnd":586,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/backtest/report.py#L550-L586","documentation":"Raised in qlib/backtest/report.py by the fulfillment-rate (FFR) metric calculator. The method argument controls how per-order FFR values are combined and only supports 'mean' (simple average), 'amount_weighted' (weighted by absolute deal amount), and 'value_weighted' (weighted by absolute trade value). Any other method string raises ValueError.","triggerScenarios":"Passing method to the FFR indicator via the report config, e.g. {'ffr': {'method': 'median'}}, or calling the internal _cal_ffr(method=...) with an unsupported string.","commonSituations":"Users extend portfolio analysis workflows and try to add a new weighting (e.g. 'share_weighted' or 'median') through config alone without subclassing the indicator calculator; or they typo 'amount_weighted' as 'amountweighted'.","solutions":["Use one of the three supported methods: 'mean', 'amount_weighted', or 'value_weighted'.","If a custom aggregation is required, subclass the indicator calculator and override _cal_ffr instead of passing a new method string.","Verify the exact spelling in the workflow YAML — matching is exact and case-sensitive."],"exampleFix":"# before\nindicator_config = {'ffr': {'method': 'median'}}\n# after\nindicator_config = {'ffr': {'method': 'mean'}}  # or 'amount_weighted' / 'value_weighted'","handlingStrategy":"validation","validationCode":"SUPPORTED = {'mean', 'amount_weighted', 'value_weighted'}\nif method not in SUPPORTED:\n    raise ValueError(f'method must be one of {sorted(SUPPORTED)}')\n# only then build the indicator config","typeGuard":"def is_ffr_method(m: str) -> bool:\n    return m in {'mean', 'amount_weighted', 'value_weighted'}","tryCatchPattern":"try:\n    ffr = calc._cal_ffr(method)\nexcept ValueError:\n    ffr = calc._cal_ffr('mean')  # explicit safe default, log a warning","preventionTips":["Validate metric method strings against the supported set before building report configs.","Beware exact case-sensitive matching when editing workflow YAMLs."],"tags":["qlib","backtest","config","metrics"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}