Hi,

The below code is not able to fetch delta for options for initial 1-2 days. I am using WarmUp Period but that is not able to help delta calculation. Is there a way to manually warmup options delta calculations as well in this case or any better idea to achieve this:


import numpy as np
from datetime import timedelta
from QuantConnect.Securities.Option import OptionPriceModels

### <summary>
### Basic template algorithm simply initializes the date range and cash. This is a skeleton
### framework you can use for designing an algorithm.
### </summary>
class BasicTemplateAlgorithm(QCAlgorithm):
    '''Basic template algorithm simply initializes the date range and cash'''

    def Initialize(self):
        self.SetStartDate(2017, 6, 1)
        self.SetEndDate(2017, 6, 15)
        self.SetWarmUp(timedelta(60)) # Warm up technical indicators
        self.AddEquity("IBM", Resolution.Minute)

        
        self.Schedule.On(self.DateRules.EveryDay("IBM"),self.TimeRules.AfterMarketOpen("IBM", 30),Action(self.add_option))
        self.Schedule.On(self.DateRules.EveryDay("IBM"),self.TimeRules.AfterMarketOpen("IBM", 60),Action(self.print_first_hour))

    def OnData(self, slice):
        self.option_data = slice
        
    def add_option(self):
        self.option = self.AddOption("IBM", Resolution.Minute)
        self.option.SetFilter(-3, +3, timedelta(0), timedelta(30))
        self.option.PriceModel = OptionPriceModels.CrankNicolsonFD()
        

    def print_first_hour(self):
        for chain in self.option_data.OptionChains.Values:
            self.Log(f'{self.Time}--> Values of Delta: {[x.Greeks.Delta for x in chain]}')

 

Thanks.

 

Author