{"record":{"id":"8edec7b3b2b3574c","repo":"microsoft/qlib","slug":"please-implement-the-get-stock-list-method","errorCode":null,"errorMessage":"Please implement the `get_stock_list` method","messagePattern":"Please implement the `get_stock_list` method","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"qlib/backtest/position.py","lineNumber":104,"sourceCode":"    def calculate_stock_value(self) -> float:\n        \"\"\"\n        calculate the value of the all assets except cash in the position\n\n        Returns\n        -------\n        float:\n            the value(money) of all the stock\n        \"\"\"\n        raise NotImplementedError(f\"Please implement the `calculate_stock_value` method\")\n\n    def calculate_value(self) -> float:\n        raise NotImplementedError(f\"Please implement the `calculate_value` method\")\n\n    def get_stock_list(self) -> List[str]:\n        \"\"\"\n        Get the list of stocks in the position.\n        \"\"\"\n        raise NotImplementedError(f\"Please implement the `get_stock_list` method\")\n\n    def get_stock_price(self, code: str) -> float:\n        \"\"\"\n        get the latest price of the stock\n\n        Parameters\n        ----------\n        code :\n            the code of the stock\n        \"\"\"\n        raise NotImplementedError(f\"Please implement the `get_stock_price` method\")\n\n    def get_stock_amount(self, code: str) -> float:\n        \"\"\"\n        get the amount of the stock\n\n        Parameters\n        ----------","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/backtest/position.py#L86-L122","documentation":"Error \"Please implement the `get_stock_list` method\" thrown in microsoft/qlib.","triggerScenarios":"This error is raised at qlib/backtest/position.py:104 when the guard condition fails: \"Please implement the `get_stock_list` method\". 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":["Implement the `get_stock_list` method in your Position subclass before calling it.","Use the built-in Position class which already implements `get_stock_list`."],"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"}