Diagnosing None Values in Historical Price Data During Backtests
Summary
This forum post shows a backtest error raised when code tries to access the volume field of a value that is actually None. The example initializes a stock list through a query function, then requests recent daily volume and closing-price history for those securities inside the data handler. It reports that a separate, commented-out historical price request appears to run when substituted, and asks why the two approaches behave differently.
The post does not include a resolution, so it does not establish why the history request returns None or whether the stock list, data API, or call context is responsible. Its practical lesson is limited to recognizing that subscripting a missing result causes this error and that the returned object should be checked before accessing fields. The contrasting API calls provide a starting point for investigating data availability and interface behavior, but the document gives no confirmed fix or backtest results.
Key ideas
- The reported exception occurs when code indexes a None value as though it were a data object.
- The failing example accesses volume from a historical data request inside a backtest handler.
- A separate historical price request reportedly runs when substituted for the failing call.
- The post asks why the calls differ but does not provide a confirmed cause or solution.
- Inspect the returned value and verify data availability before reading its fields.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.