Overall Statistics
Total Trades
8
Average Win
0.14%
Average Loss
-0.37%
Compounding Annual Return
-4.264%
Drawdown
1.100%
Expectancy
-0.316
Net Profit
-0.698%
Sharpe Ratio
-2.455
Probabilistic Sharpe Ratio
6.137%
Loss Rate
50%
Win Rate
50%
Profit-Loss Ratio
0.37
Alpha
-0.031
Beta
-0.056
Annual Standard Deviation
0.012
Annual Variance
0
Information Ratio
-0.051
Tracking Error
0.144
Treynor Ratio
0.536
Total Fees
$6.00
Estimated Strategy Capacity
$2200000.00
Lowest Capacity Asset
IBM VOBM1Z09FM2U|IBM R735QTJ8XC9X
Portfolio Turnover
1.57%
#region imports
from AlgorithmImports import *
#endregion

class ProtectiveCallAlgorithm(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.call = None

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

    def OnData(self, slice):

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

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

        # Find ATM call with the farthest expiry
        expiry = max([x.Expiry for x in chain])
        call_contracts = sorted([x for x in chain
            if x.Right == OptionRight.Call and x.Expiry == expiry],
            key=lambda x: abs(chain.Underlying.Price - x.Strike))

        if not call_contracts:
            return

        atm_call = call_contracts[0]

        protective_call = OptionStrategies.ProtectiveCall(self.symbol, atm_call.Strike, expiry)
        self.Buy(protective_call, 1)

        self.call = atm_call.Symbol