{"record":{"id":"df54d137eb04c811","repo":"microsoft/qlib","slug":"please-implement-the-update-order-method","errorCode":null,"errorMessage":"Please implement the `update_order` method","messagePattern":"Please implement the `update_order` method","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"qlib/backtest/position.py","lineNumber":70,"sourceCode":"        bool:\n            if is the stock in the position\n        \"\"\"\n        raise NotImplementedError(f\"Please implement the `check_stock` method\")\n\n    def update_order(self, order: Order, trade_val: float, cost: float, trade_price: float) -> None:\n        \"\"\"\n        Parameters\n        ----------\n        order : Order\n            the order to update the position\n        trade_val : float\n            the trade value(money) of dealing results\n        cost : float\n            the trade cost of the dealing results\n        trade_price : float\n            the trade price of the dealing results\n        \"\"\"\n        raise NotImplementedError(f\"Please implement the `update_order` method\")\n\n    def update_stock_price(self, stock_id: str, price: float) -> None:\n        \"\"\"\n        Updating the latest price of the order\n        The useful when clearing balance at each bar end\n\n        Parameters\n        ----------\n        stock_id :\n            the id of the stock\n        price : float\n            the price to be updated\n        \"\"\"\n        raise NotImplementedError(f\"Please implement the `update stock price` method\")\n\n    def calculate_stock_value(self) -> float:\n        \"\"\"\n        calculate the value of the all assets except cash in the position","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/backtest/position.py#L52-L88","documentation":"Error \"Please implement the `update_order` method\" thrown in microsoft/qlib.","triggerScenarios":"This error is raised at qlib/backtest/position.py:70 when the guard condition fails: \"Please implement the `update_order` 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 `update_order` method in your Position subclass before calling it.","Use the built-in Position class which already implements `update_order`."],"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-15T17:31:12.345Z"}