Overall Statistics Total Orders5Average Win0.23%Average Loss0%Compounding Annual Return3.917%Drawdown0.700%Expectancy0Start Equity100000End Equity100619.5Net Profit0.620%Sharpe Ratio1.653Sortino Ratio1.462Probabilistic Sharpe Ratio71.137%Loss Rate0%Win Rate100%Profit-Loss Ratio0Alpha0.022Beta0.06Annual Standard Deviation0.012Annual Variance0Information Ratio0.39Tracking Error0.128Treynor Ratio0.33Total Fees\$3.00Estimated Strategy Capacity\$180000.00Lowest Capacity AssetIBM 2ZNFM7EZGPFGM|IBM R735QTJ8XC9XPortfolio Turnover0.01%
```#region imports
from AlgorithmImports import *
#endregion

class NakedPutAlgorithm(QCAlgorithm):

def initialize(self):
self.set_start_date(2014, 1, 1)
self.set_end_date(2014, 3, 1)
self.set_cash(100000)

option = self.add_option("IBM")
self.symbol = option.symbol

option.set_filter(-3, 3, 0, 31)

self.put = None

# use the underlying equity as the benchmark
self.set_benchmark(self.symbol.underlying)

def on_data(self, slice):

if self.put and self.portfolio[self.put].invested:
return

chain = slice.option_chains.get(self.symbol)
if not chain:
return

# Find ATM put with the farthest expiry
expiry = max([x.expiry for x in chain])
put_contracts = sorted([x for x in chain
if x.right == OptionRight.PUT and x.expiry == expiry],
key=lambda x: abs(chain.underlying.price - x.strike))

if not put_contracts:
return

atm_put = put_contracts[0]

naked_put = OptionStrategies.naked_put(self.symbol, atm_put.strike, expiry)
self.buy(naked_put, 1)

self.put = atm_put.symbol```