Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
class PrintOptionsContracts(QCAlgorithm):

    def Initialize(self):
        
        self.SetStartDate(2022, 1, 24)
        self.SetEndDate(2022, 1, 24)

        self.option = self.AddOption("GOOGL", Resolution.Minute)
        self.option.SetFilter(-1, +1, timedelta(10), timedelta(30))  

        self.option.PriceModel = OptionPriceModels.BjerksundStensland()
        self.SetWarmUp(TimeSpan.FromDays(5))
        
        self.Counter = 1

    def OnData(self, slice):
        if self.IsWarmingUp: return
        if self.Counter > 10: return    # stops after 10 runs
        self.Counter += 1

        for kvp in slice.OptionChains: 
            if str(kvp.Key)[1:] != "GOOGL": continue 
            optionchain = sorted(kvp.Value, key = lambda x: (x.Expiry, x.Right, x.Strike))
            contractCount = 0    # this will be the total number of contracts in the optionchain
            for contract in optionchain:
                self.Log("Underlying = " + str(contract.UnderlyingSymbol) + \
                         " Underlying price = " + str(contract.UnderlyingLastPrice) +  
                         " Expiry = " + str(contract.Expiry)  + \
                         " Strike = " + str(contract.Strike) + \
                         " Call/Put = " + str(contract.Right))
                contractCount += 1
            self.Log(f"ContractCount = {contractCount} \n")