Overall Statistics |
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 311.251% Drawdown 0.900% Expectancy 0 Net Profit 1.169% Sharpe Ratio 25.479 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 1.916 Beta -23.146 Annual Standard Deviation 0.131 Annual Variance 0.017 Information Ratio 24.874 Tracking Error 0.137 Treynor Ratio -0.144 Total Fees $1.00 Estimated Strategy Capacity $1600000.00 Lowest Capacity Asset GOOCV XOA77Z9Y6IH2|GOOCV VP83T1ZUHROL |
class PensiveRedOrangeRhinoceros(QCAlgorithm): def Initialize(self): self.SetStartDate(2021, 3, 27) # Set Start Date self.SetEndDate(2021, 3, 29) self.SetCash(100000) # Set Strategy Cash self.AddEquity("MSFT", Resolution.Minute) self.option = self.AddOption("GOOG") ''' Need to set PriceModel ''' self.option.PriceModel = OptionPriceModels.CrankNicolsonFD() self.option.SetFilter(-2, 2, timedelta(0), timedelta(182)) self.option.SetFilter(lambda universe: universe.WeeklysOnly().Strikes(-2, +2).Expiration(timedelta(0), timedelta(182))) ''' Needs sufficient warmup, try with days=1 and will not work ''' self.SetWarmup(timedelta(days=7)) def OnData(self, slice): for chain in slice.OptionChains.Values: contracts = sorted(sorted(chain, \ key = lambda x: abs(chain.Underlying.Price - x.Strike)), \ key = lambda x: x.Expiry, reverse=True) for contract in contracts: self.Debug(contract.Greeks.Delta) if not self.Portfolio.Invested: self.MarketOrder(contract.Symbol, 1)