Overall Statistics
Total Trades
8
Average Win
0.23%
Average Loss
0%
Compounding Annual Return
-0.165%
Drawdown
2.100%
Expectancy
0
Net Profit
-0.026%
Sharpe Ratio
-0.028
Probabilistic Sharpe Ratio
31.260%
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
-0.005
Beta
-0.192
Annual Standard Deviation
0.028
Annual Variance
0.001
Information Ratio
0.135
Tracking Error
0.162
Treynor Ratio
0.004
Total Fees
$6.00
Estimated Strategy Capacity
$540000.00
Lowest Capacity Asset
IBM 2ZNFM7EZGPFGM|IBM R735QTJ8XC9X
Portfolio Turnover
0.95%
#region imports
from AlgorithmImports import *
#endregion

class CoveredputAlgorithm(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2014, 1, 1)
        self.SetEndDate(2014, 3, 1)
        self.SetCash(100000)

        option = self.AddOption("IBM")
        self.symbol = option.Symbol

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

        self.put = None

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

    def OnData(self, slice):

        if self.put and self.Portfolio[self.put].Invested:
            return

        chain = slice.OptionChains.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]

        covered_put = OptionStrategies.CoveredPut(self.symbol, atm_put.Strike, expiry)
        self.Buy(covered_put, 1)

        self.put = atm_put.Symbol