{"record":{"id":"f675a90ba008b896","repo":"QuantConnect/Lean","slug":"regression-test-failed-current-bid-price-was-not","errorCode":null,"errorMessage":"Regression test failed: current bid price was not loaded from FOXA file and is not $0.05","messagePattern":"Regression test failed: current bid price was not loaded from FOXA file and is not \\$0\\.05","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"Algorithm.Python/OptionRenameRegressionAlgorithm.py","lineNumber":69,"sourceCode":"                        # Buy the undelying stock\n                        underlying_symbol = contract.symbol.underlying\n                        self.buy (underlying_symbol, 100)\n                        # check\n                        if float(contract.ask_price) != 1.1:\n                            raise ValueError(\"Regression test failed: current ask price was not loaded from NWSA backtest file and is not $1.1\")\n        elif self.time.day == 2 and self.time.hour > 14 and self.time.minute > 0:\n            for kvp in slice.option_chains:\n                chain = kvp.value\n                self.liquidate()\n                contracts = [i for i in sorted(chain, key=lambda x:x.expiry) \n                                        if i.right ==  OptionRight.CALL and \n                                           i.strike == 33 and\n                                           i.expiry.date() == datetime(2013,8,17).date()]\n            if contracts:\n                contract = contracts[0]\n                self.log(\"Bid Price\" + str(contract.bid_price))\n                if float(contract.bid_price) != 0.05:\n                    raise ValueError(\"Regression test failed: current bid price was not loaded from FOXA file and is not $0.05\")\n\n    def on_order_event(self, order_event):\n        self.log(str(order_event))\n","sourceCodeStart":51,"sourceCodeEnd":73,"githubUrl":"https://github.com/QuantConnect/Lean/blob/d2c3659f877bfc2b5d9dc0fc89a9c7566f45e892/Algorithm.Python/OptionRenameRegressionAlgorithm.py#L51-L73","documentation":"Companion assertion in the same OptionRenameRegressionAlgorithm, run on 2013-07-02 after 14:00. After the symbol has been renamed to FOXA (Twenty-First Century Fox), it checks contract.bid_price equals exactly 0.05 for the same CALL (strike 33, expiry 2013-08-17). Failure means the post-rename data file (FOXA) did not load the expected bid price, indicating a data-mapping, regression-data, or float-equality problem.","triggerScenarios":"On day 2 after 14:00, after self.liquidate(), selecting the CALL strike 33 / 2013-08-17 contract and reading contract.bid_price when it is not float-equal to 0.05. Triggered by regenerated data zips, edited FOXA map files, or changed symbol-mapping resolution.","commonSituations":"Regenerating Lean regression data; modifying the FOXA/TFCFA map or factor files; a rounding change in bid-price normalization so 0.05 is stored as a near-but-not-equal double.","solutions":["Verify the FOXA regression data file bid value; if intentionally changed, update the golden 0.05 constant.","Check the FOXA map/factor files under Lean/Data for correctness and that the rename resolver picks the FOXA file on 2013-07-02.","Switch exact equality to a tolerance: abs(bid - 0.05) < 1e-6.","Confirm the liquidate() call did not alter the contract object's cached quote before the read."],"exampleFix":"// before\nif float(contract.bid_price) != 0.05:\n    raise ValueError('...not $0.05')\n// after\nif abs(float(contract.bid_price) - 0.05) > 1e-6:\n    raise ValueError(f'bid price {contract.bid_price} != 0.05 from FOXA data')","handlingStrategy":"validation","validationCode":"# Tolerance-based bid check for the post-rename FOXA data\nBID_GOLDEN = 0.05\nif abs(float(contract.bid_price) - BID_GOLDEN) > 1e-6:\n    raise ValueError(f'FOXA bid {contract.bid_price} != {BID_GOLDEN}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use tolerance, not exact equality, for price assertions.","Keep FOXA map/factor files aligned with the regression data package.","Re-verify golden constants whenever data zips are regenerated.","Confirm the rename resolver selects the FOXA file on the post-rename date."],"tags":["options","symbol-rename","regression-test","quantconnect","data-mapping"],"backgroundTag":null,"analyzedSha":"d2c3659f877bfc2b5d9dc0fc89a9c7566f45e892","analyzedAt":"2026-08-13T13:52:21.013Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}