I have cloned the OptionChainConsistencyRegressionAlgorithm and was trying to log IV on options data and i am getting zero.
public override void OnData(Slice slice)
{
if (!Portfolio.Invested)
{
OptionChain chain;
if (slice.OptionChains.TryGetValue(OptionSymbol, out chain))
{
// check if data is consistent
foreach (var o in chain)
{
Log(string.Format("chain:{0} Bid:{1} Ask:{2} IV:{3}", o.Symbol, o.BidPrice, o.AskPrice, o.ImpliedVolatility));
if (!Securities.ContainsKey(o.Symbol))
{
// inconsistency found: option chains contains contract information that is not available in securities manager and not available for trading
throw new Exception(string.Format("inconsistency found: option chains contains contract {0} that is not available in securities manager and not available for trading", o.Symbol.Value));
}
}
}
}