Overall Statistics
Total Trades
5
Average Win
0.28%
Average Loss
-0.60%
Compounding Annual Return
142.977%
Drawdown
1.000%
Expectancy
-0.262
Net Profit
6.961%
Sharpe Ratio
7.783
Probabilistic Sharpe Ratio
99.949%
Loss Rate
50%
Win Rate
50%
Profit-Loss Ratio
0.48
Alpha
0.816
Beta
0.7
Annual Standard Deviation
0.114
Annual Variance
0.013
Information Ratio
7.382
Tracking Error
0.107
Treynor Ratio
1.265
Total Fees
$3.00
Estimated Strategy Capacity
$45000.00
Lowest Capacity Asset
GOOCV WJVVXYXTEWYU|GOOCV VP83T1ZUHROL
# region imports
from AlgorithmImports import *
# endregion

class ProtectiveCollarOptionStrategy(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2017, 4, 1)
        self.SetEndDate(2017, 4, 30)
        self.SetCash(100000)
        
        equity = self.AddEquity("GOOG", Resolution.Minute)
        option = self.AddOption("GOOG", Resolution.Minute)
        self.symbol = option.Symbol

        # set our strike/expiry filter for this option chain
        option.SetFilter(-5, +5, timedelta(0), timedelta(30))

    def OnData(self, data):
        # avoid extra orders
        if self.Portfolio.Invested: return

        # Get the OptionChain of the self.symbol
        chain = data.OptionChains.get(self.symbol, None)
        if not chain: return

        # choose the furthest expiration date within 30 days from now on
        expiry = sorted(chain, key = lambda x: x.Expiry)[-1].Expiry
        # filter the call options contracts
        call = [x for x in chain if x.Right == OptionRight.Call and x.Expiry == expiry]
        # filter the put options contracts
        put = [x for x in chain if x.Right == OptionRight.Put and x.Expiry == expiry]

        if not call or not put: return

        self.otm_call = sorted(call, key = lambda x: x.Strike)[-1]
        self.otm_put = sorted(put, key = lambda x: x.Strike)[0]

        self.Sell(self.otm_call.Symbol, 1) # sell the OTM call
        self.Buy(self.otm_put.Symbol, 1) # buy the OTM put
        self.Buy("GOOG",100)	 # buy 100 shares of the underlying stock