QuantConnect/Lean · error · ValueError
Regression test failed: current ask price was not loaded fro
Error message
Regression test failed: current ask price was not loaded from NWSA backtest file and is not $1.1
What it means
This is a regression assertion in Lean's OptionRenameRegressionAlgorithm that verifies historical option quote data survived a corporate-action/symbol rename (the algorithm subscribes to TFCFA, which historically maps through NWSA, the old News Corp ticker). It checks that contract.ask_price for a specific CALL (strike 33, expiry 2013-08-17) equals exactly 1.1, proving the rename-mapped factor file and the backtest data file loaded with the right ask price. A failure means the data mapping, the regression data zip, or the symbol-mapping resolver returned a different ask price than the recorded golden value.
Source
Thrown at Algorithm.Python/OptionRenameRegressionAlgorithm.py:56
if not self.portfolio.invested:
for kvp in slice.option_chains:
chain = kvp.value
if self.time.day == 28 and self.time.hour > 9 and self.time.minute > 0:
contracts = [i for i in sorted(chain, key=lambda x:x.expiry)
if i.right == OptionRight.CALL and
i.strike == 33 and
i.expiry.date() == datetime(2013,8,17).date()]
if contracts:
# Buying option
contract = contracts[0]
self.buy(contract.symbol, 1)
# Buy the undelying stock
underlying_symbol = contract.symbol.underlying
self.buy (underlying_symbol, 100)
# check
if float(contract.ask_price) != 1.1:
raise ValueError("Regression test failed: current ask price was not loaded from NWSA backtest file and is not $1.1")
elif self.time.day == 2 and self.time.hour > 14 and self.time.minute > 0:
for kvp in slice.option_chains:
chain = kvp.value
self.liquidate()
contracts = [i for i in sorted(chain, key=lambda x:x.expiry)
if i.right == OptionRight.CALL and
i.strike == 33 and
i.expiry.date() == datetime(2013,8,17).date()]
if contracts:
contract = contracts[0]
self.log("Bid Price" + str(contract.bid_price))
if float(contract.bid_price) != 0.05:
raise ValueError("Regression test failed: current bid price was not loaded from FOXA file and is not $0.05")
def on_order_event(self, order_event):
self.log(str(order_event))
View on GitHub (pinned to d2c3659f87)
Solutions
- Confirm the regression data zip for this algorithm is unchanged; if data was regenerated, update the golden expected value (1.1) to the new correct ask price.
- Inspect the map/factor files under Lean/Data for TFCFA/NWSA to ensure the rename mapping resolves to the original NWSA backtest file.
- Replace the brittle exact float equality (== 1.1) with a tolerance check (abs(ask - 1.1) < 1e-6) if the value is correct but floating-point representation changed.
- Verify the SecurityIdentifier mapping resolver returns the same SID for the contract so the same quote row is loaded.
Example fix
// before
if float(contract.ask_price) != 1.1:
raise ValueError('...not $1.1')
// after
if abs(float(contract.ask_price) - 1.1) > 1e-6:
raise ValueError(f'ask price {contract.ask_price} != 1.1 after rename mapping') Defensive patterns
Strategy: validation
Validate before calling
# Use a tolerance instead of exact float equality for loaded quote prices
ASK_GOLDEN = 1.1
if abs(float(contract.ask_price) - ASK_GOLDEN) > 1e-6:
raise ValueError(f'NWSA ask {contract.ask_price} != {ASK_GOLDEN}') Prevention
- Never compare floats with == for prices loaded from data; use a tolerance.
- Pin regression data zips so symbol-rename golden values stay stable.
- When regenerating data, update golden constants in lockstep.
- Validate map/factor files resolve the renamed ticker to the expected historical file.
When it happens
Trigger: Running the rename regression on 2013-06-28 after 09:00 when the option chain for TFCFA is available, selecting the CALL strike 33 / 2013-08-17 contract, and reading contract.ask_price when it is not float-equal to 1.1. Happens when the regression data package was regenerated, the symbol mapping changed, or a factor/rename file was edited.
Common situations: Updating the Lean regression data zips; changing the Symbol / SecurityIdentifier mapping logic; adding or editing a map file for NWSA/TFCFA/FOXA; floating the ask price through a normalization step that introduced rounding so 1.1 became 1.1000001.
Related errors
- Regression test failed: current bid price was not loaded fro
- Index is not tradable.
- Trade volume should be greater than zero by the end of this
- Indicators are not ready!
- Expiry event was not at the correct time, {orderEvent.UtcTim
AI-assisted analysis of QuantConnect/Lean@d2c3659f87 (2026-08-13).
Data as JSON: /api/errors/81c3598372f4ac8a.
Report an issue: GitHub.