public override void Initialize()
        {
            this.SetStartDate(2017, 1, 1);
            this.SetEndDate(2017, 6, 28);
            this.SetCash(25000);
            this.LogCust("PERIOD: 2017");
            // ----------------------------------------------------------------------
            // Algo params
            // ----------------------------------------------------------------------
            this.PREMIUM    = 0.01;
            this.MAX_EXPIRY = 30;
            this._no_K      = 2;
            this.resol      = Resolution.Minute;
            this.tkr        = SPY;
            // self.Ntnl_perc = d.Decimal( round( 1. / (2. * self.MAX_EXPIRY/7.), 2) ) #  notional percentage, e.g. 0.08
            this.select_flag    = false;
            this.hedge_flag     = false;
            this.previous_delta = 0.0;
            this.delta_treshold = 0.05;
            // ----------------------------------------------------------------------
            // add underlying Equity
            var equity = this.AddEquity(this.tkr, this.resol);

            equity.SetDataNormalizationMode(DataNormalizationMode.Raw);
            this.equity_symbol = equity.Symbol;
            // Add options
            var option = this.AddOption(this.tkr, this.resol);

            this.option_symbol = option.Symbol;
            // set our strike/expiry filter for this option chain
            option.SetFilter(this.UniverseFunc);
            // for greeks and pricer (needs some warmup) - https://github.com/QuantConnect/Lean/blob/21cd972e99f70f007ce689bdaeeafe3cb4ea9c77/Common/Securities/Option/OptionPriceModels.cs#L81
            option.PriceModel = OptionPriceModels.CrankNicolsonFD();
            // this is needed for Greeks calcs
            this.SetWarmUp(TimeSpan.FromDays(3));
            this._assignedOption = false;
            this.call            = null;
            this.put             = null;
            OrderTickets.Add(new OrderTicketInfo {
                EquityUnderlying = equity
            });
            OrderTickets.Add(new OrderTicketInfo {
                EquityUnderlying = equity
            });
            // -----------------------------------------------------------------------------
            // scheduled functions
            // -----------------------------------------------------------------------------
            this.Schedule.On(this.DateRules.EveryDay(this.equity_symbol), this.TimeRules.AfterMarketOpen(this.equity_symbol, 60), new Action(this.close_optionsOpen));
            this.Schedule.On(this.DateRules.EveryDay(this.equity_symbol), this.TimeRules.BeforeMarketClose(this.equity_symbol, 10), new Action(this.close_optionsClose));
        }
        public override void Initialize()
        {
            this.SetStartDate(2017, 1, 1);
            this.SetEndDate(2017, 6, 28);
            this.SetCash(25000);
            this.LogCust("PERIOD: 2017");
            // ----------------------------------------------------------------------
            // Algo params
            // ----------------------------------------------------------------------
            this.MAX_EXPIRY = 30;
            this._no_K      = 2;
            this.resol      = Resolution.Minute;
            this.tkr        = SPY;
            // ----------------------------------------------------------------------
            // add underlying Equity
            equity = this.AddEquity(this.tkr, this.resol);
            equity.SetDataNormalizationMode(DataNormalizationMode.Raw);
            this.equity_symbol = equity.Symbol;
            // Add options
            var option = this.AddOption(this.tkr, this.resol);

            this.option_symbol = option.Symbol;
            // set our strike/expiry filter for this option chain
            option.SetFilter(this.UniverseFunc);
            // for greeks and pricer (needs some warmup) - https://github.com/QuantConnect/Lean/blob/21cd972e99f70f007ce689bdaeeafe3cb4ea9c77/Common/Securities/Option/OptionPriceModels.cs#L81
            option.PriceModel = OptionPriceModels.CrankNicolsonFD();
            // this is needed for Greeks calcs
            this.SetWarmUp(TimeSpan.FromDays(3));
            this.call = null;
            this.put  = null;
            Combo straddle;

            OrderTickets.Add(new OrderTicketInfo2 {
                EquityUnderlying = equity
            });
            OrderTickets.Add(new OrderTicketInfo2 {
                EquityUnderlying = equity
            });
            // -----------------------------------------------------------------------------
            // scheduled functions
            // -----------------------------------------------------------------------------
            this.Schedule.On(this.DateRules.EveryDay(this.equity_symbol), this.TimeRules.AfterMarketOpen(this.equity_symbol, 60), new Action(this.CloseOptionsOpen));
            this.Schedule.On(this.DateRules.EveryDay(this.equity_symbol), this.TimeRules.BeforeMarketClose(this.equity_symbol, 10), new Action(this.closeOptionsClose));
        }