Overall Statistics |
Total Orders 3 Average Win 0.74% Average Loss 0% Compounding Annual Return -6.723% Drawdown 0.700% Expectancy -1 Start Equity 500000 End Equity 497085 Net Profit -0.583% Sharpe Ratio -7.559 Sortino Ratio -8.132 Probabilistic Sharpe Ratio 0.180% Loss Rate 100% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.014 Beta -0.102 Annual Standard Deviation 0.008 Annual Variance 0 Information Ratio -8.177 Tracking Error 0.064 Treynor Ratio 0.603 Total Fees $2.00 Estimated Strategy Capacity $3700000.00 Lowest Capacity Asset GOOCV WIJN29E3NU86|GOOCV VP83T1ZUHROL Portfolio Turnover 0.52% |
from AlgorithmImports import * class BearCallSpreadStrategy(QCAlgorithm): def initialize(self): self.set_start_date(2017, 2, 1) self.set_end_date(2017, 3, 5) self.set_cash(500000) option = self.add_option("GOOG", Resolution.MINUTE) self.symbol = option.symbol option.set_filter(self.universe_func) def universe_func(self, universe): return universe.include_weeklys().strikes(-15, 15).expiration(timedelta(0), timedelta(31)) def on_data(self, slice: Slice) -> None: if self.portfolio.invested: return # Get the OptionChain chain = slice.option_chains.get(self.symbol, None) if not chain: return # Get the furthest expiry date of the contracts expiry = sorted(chain, key = lambda x: x.expiry, reverse=True)[0].expiry # Select the call Option contracts with the furthest expiry calls = [i for i in chain if i.expiry == expiry and i.right == OptionRight.CALL] if len(calls) == 0: return # Select the ITM and OTM contract strike prices from the remaining contracts call_strikes = sorted([x.strike for x in calls]) itm_strike = call_strikes[0] otm_strike = call_strikes[-1] option_strategy = OptionStrategies.bear_call_spread(self.symbol, itm_strike, otm_strike, expiry) self.buy(option_strategy, 1)