Back

Handling missing minutely data

For my algorithm in development, I need the first minute ticker data for my symbols. At least one of them I know has no transactions until 10:05. If the data for 9:31, is missing, then I want to skip it. I was thinking this was a hole in the minutely data, but if there are no trades on the symbol until 10:05, then it's not a hole. Below, _universe is my dictionary of SybmolData objects, keyed on Symbol. if (data[s] != null) should only find slices for symbols with data.

Instead, I'm getting Runtime errors like 'SST V2245V5VOQQT' wasn't found in the Slice object, likely because there was no-data at this moment in time. What's the best way to test for Slice data and skip anything with no trades for that time (9:31)?

 

 

public override void OnData(Slice data)
{
try
{
foreach(var s in _universe.Keys)
{
if (data[s] != null)
{
Debug($"OnData update {s}");
_universe[s].Update(Time, data[s].Close);
}
}
}
catch(Exception e)
{
Debug($"{e}");
}
}

Here's the minutely data for 11/3/14 for SPTS/SST (SPTS was SST before 2017). The missing data is fine as long as I can skip it for that day. 36300000 corresponds to 10:05am. Should there instead be data from 9:30 to 10:05? I'm ok either way as long as I can test for the existence and skip any symbols with missing data for that date.

86706_1574792711.jpg               

Update Backtest







0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Hi Tim Bohmann ,

For this error, the complete message is:
'SST V2245V5VOQQT' wasn't found in the Slice object, likely because there was no-data at this moment in time and it wasn't possible to fillforward historical data. Please check the data exists before accessing it with data.ContainsKey("SST").

Please check out the docs, under Handling Data, for more details.

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed