Overall Statistics
namespace QuantConnect 
{
    public partial class CoveredCallAlgorithm : QCAlgorithm
    {
    	string lastProcessedDtm = string.Empty;
    	string lastTradeDtm = string.Empty;
    	
    	Symbol _optionSymbolK;
    	Symbol _optionSymbolI;

		// Manual add symbols required in your initialize method:
		public override void Initialize() {
		     SetStartDate(2015, 8, 8);
            SetEndDate(2015,9, 8);

		    var optionK = AddOption("QQQ", Resolution.Minute);
		    var optionI = AddOption("QQQQ", Resolution.Minute);
		    _optionSymbolK = optionK.Symbol;
		    _optionSymbolI = optionI.Symbol;
		    // set our strike/expiry filter for this option chain
		    
		    optionK.SetFilter(-15,  -2, TimeSpan.Zero, TimeSpan.FromDays(14));
		    optionI.SetFilter(-25,  -2, TimeSpan.Zero, TimeSpan.FromDays(14));
		}
		
		// v3.0 Technique: Access data via grouped time slice method handlers:
		public override void OnData(Slice slice) {
			
		    OptionChain chainK;
		    OptionChain chainI;
		    if(slice.OptionChains.TryGetValue(_optionSymbolK, out chainK) &&
		    slice.OptionChains.TryGetValue(_optionSymbolI, out chainI))
		    {
		        // find the second call strike under market price expiring today
		        var contractK = (
		            from optionContract in chainK.OrderBy(x=> x.Expiry).OrderByDescending(x => x.Strike)
		            where optionContract.Right == OptionRight.Put
		            where optionContract.Expiry > Time.Date
		            where optionContract.Strike < ( .97m * chainK.Underlying.Price)
		            select optionContract
		            ).FirstOrDefault();
		            
		        var contractI = (
		            from optionContract in chainI.OrderBy(x=> x.Expiry).OrderByDescending(x => x.Strike)
		            where optionContract.Right == OptionRight.Put
		            where optionContract.Expiry > Time.Date
		            where optionContract.Strike < ( .98m * chainI.Underlying.Price)
		            select optionContract
		            ).FirstOrDefault();
		
		        if (contractK != null && contractI != null)
		        {
		        	//SecurityHolding
		        	
		        	if(slice.Time.DayOfWeek == DayOfWeek.Monday && lastTradeDtm != slice.Time.ToShortDateString())
		        	{
			            var quantityK = CalculateOrderQuantity(contractK.Symbol, .25m);
			            MarketOrder(contractK.Symbol, quantityK);
						Log(string.Format("traded {0} - {1}", 
							quantityK, 
							contractK.Symbol
							));
			            var quantityI = CalculateOrderQuantity(contractI.Symbol, -.25m);
						Log(string.Format("traded {0} - {1}", 
							quantityI, 
							contractI.Symbol
							));
			            MarketOrder(contractI.Symbol, quantityI);
		        	} 
		        	lastTradeDtm = slice.Time.ToShortDateString();
		        }else{
		        	if( lastProcessedDtm != slice.Time.ToShortDateString() ){
		        		Log("no contract");
		        	}
		        }
		    }else{
				if( lastProcessedDtm != slice.Time.ToShortDateString() ){
					Log("no chain available");
				}
		    }
		    lastProcessedDtm = slice.Time.ToShortDateString();
		}
    }
}