Overall Statistics |
Total Trades 10 Average Win 0.35% Average Loss -0.61% Compounding Annual Return -0.402% Drawdown 0.400% Expectancy -0.051 Net Profit -0.134% Sharpe Ratio -0.666 Probabilistic Sharpe Ratio 12.029% Loss Rate 40% Win Rate 60% Profit-Loss Ratio 0.58 Alpha -0.004 Beta 0.022 Annual Standard Deviation 0.004 Annual Variance 0 Information Ratio -0.375 Tracking Error 0.14 Treynor Ratio -0.117 Total Fees $6.00 Estimated Strategy Capacity $450000.00 Lowest Capacity Asset GOOCV WN5253VSCTIE|GOOCV VP83T1ZUHROL |
#region imports from AlgorithmImports import * #endregion from datetime import timedelta class BullCallSpreadAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2017, 5, 1) self.SetEndDate(2017, 8, 30) self.SetCash(600000) equity = self.AddEquity("GOOG") option = self.AddOption("GOOG") self.symbol = option.Symbol # set our strike/expiry filter for this option chain option.SetFilter(-7, 7, 30, 60) # use the underlying equity GOOG as the benchmark self.SetBenchmark(equity.Symbol) def OnData(self, slice): # if there is no securities in portfolio, trade the options if self.Portfolio.Invested: return chain = slice.OptionChains.get(self.symbol) if not chain: return # sorted the optionchain by expiration date and choose the furthest date expiry = sorted(chain, key=lambda x: x.Expiry, reverse=True)[0].Expiry # filter the call options from the contracts expires on that date calls = [i for i in chain if i.Expiry == expiry and i.Right == OptionRight.Call] if len(calls) < 1: return # sorted the contracts according to their strike prices calls = sorted(calls, key=lambda x: x.Strike) # Buy call option contract with lower strike self.Buy(calls[0].Symbol, 1) # Sell call option contract with higher strike self.Sell(calls[-1].Symbol, 1) def OnOrderEvent(self, orderEvent): self.Log(f'{orderEvent}')