Overall Statistics
Total Orders
3
Average Win
0.42%
Average Loss
0%
Compounding Annual Return
5.446%
Drawdown
1.200%
Expectancy
-1
Start Equity
100000
End Equity
100856
Net Profit
0.856%
Sharpe Ratio
1.485
Sortino Ratio
1.74
Probabilistic Sharpe Ratio
64.891%
Loss Rate
100%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0.034
Beta
0.126
Annual Standard Deviation
0.021
Annual Variance
0
Information Ratio
0.508
Tracking Error
0.119
Treynor Ratio
0.242
Total Fees
$2.00
Estimated Strategy Capacity
$61000000.00
Lowest Capacity Asset
IBM 2ZN0UI19JRV52|IBM R735QTJ8XC9X
Portfolio Turnover
0.33%
#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(lambda universe: universe.include_weeklys().naked_put(30, 0))

        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