Overall Statistics Total Trades31Average Win0.55%Average Loss-0.60%Compounding Annual Return-1.314%Drawdown1.800%Expectancy-0.042Net Profit-0.548%Sharpe Ratio-0.689Loss Rate50%Win Rate50%Profit-Loss Ratio0.92Alpha0.004Beta-0.093Annual Standard Deviation0.016Annual Variance0Information Ratio-2.355Tracking Error0.071Treynor Ratio0.117Total Fees\$7.75
```# https://quantpedia.com/Screener/Details/20
from datetime import timedelta
from decimal import Decimal

def Initialize(self):
self.SetStartDate(2017, 1, 1)
self.SetEndDate(2017, 6, 1)
self.SetCash(50000)
self.symbol = equity.Symbol
option.SetFilter(self.UniverseFunc)
self.SetBenchmark(equity.Symbol)

def OnData(self,slice):

for i in slice.OptionChains:
chains = i.Value
if not self.Portfolio.Invested:
# divide option chains into call and put options
calls = list(filter(lambda x: x.Right == OptionRight.Call, chains))
puts = list(filter(lambda x: x.Right == OptionRight.Put, chains))
# if lists are empty return
if not calls or not puts: return
underlying_price = self.Securities[self.symbol].Price
expiries = [i.Expiry for i in puts]
# determine expiration date nearly one month
expiry = min(expiries, key=lambda x: abs((x.date()-self.Time.date()).days-30))
strikes = [i.Strike for i in puts]
# determine at-the-money strike
strike = min(strikes, key=lambda x: abs(x-underlying_price))
# determine 15% out-of-the-money strike
otm_strike = min(strikes, key = lambda x:abs(x-Decimal(0.85)*underlying_price))
self.atm_call = [i for i in calls if i.Expiry == expiry and i.Strike == strike]
self.atm_put = [i for i in puts if i.Expiry == expiry and i.Strike == strike]
self.otm_put = [i for i in puts if i.Expiry == expiry and i.Strike == otm_strike]

if self.atm_call and self.atm_put and self.otm_put: