So I am working with a dynamic universe of stocks at second resolution and am occasionally seeing the not found in tradebars object error. I am using the ~data.ContainsKey recommendation to skip the tradebar for stocks that show up as errors in the log. But I have two questions:

 

1. When dealing with a dynamic universe of stocks, I can't anticipate all the stocks that doesn't have data for a particular second. Right now I am listing all the stocks I am encountering with this error on a one week backtest. But if I do a 1 year backtest or am running live, how do I dynamically account for the issue?

if (data == null || !data.ContainsKey("CMCM") || !data.ContainsKey("SPY") || !data.ContainsKey("FL") || !data.ContainsKey("ROST")) return;

 

2. If there are many stocks in your universe and you avoid an OnData tick whenever any one of those stocks doesn't have data for a particular second, then won't that mean I will be missing many iterations of OnData? i.e. if it returns because 1 stock out of 100 in the universe doesn't have data for the second, then that means I am not running my OnData logic for the 99 stocks that are still available.