Overall Statistics |
Total Orders 2 Average Win 0% Average Loss 0% Compounding Annual Return 0.007% Drawdown 0.100% Expectancy 0 Start Equity 500000 End Equity 500003 Net Profit 0.001% Sharpe Ratio -4.34 Sortino Ratio -9.555 Probabilistic Sharpe Ratio 89.927% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.012 Beta -0.006 Annual Standard Deviation 0.002 Annual Variance 0 Information Ratio 1.023 Tracking Error 0.22 Treynor Ratio 1.655 Total Fees $2.00 Estimated Strategy Capacity $4500000.00 Lowest Capacity Asset GOOCV WSOXW45FPLYE|GOOCV VP83T1ZUHROL Portfolio Turnover 0.05% |
from AlgorithmImports import * class BearCallSpreadStrategy(QCAlgorithm): def initialize(self): self.set_start_date(2018, 2, 1) self.set_end_date(2018, 3, 5) self.set_cash(500000) option = self.add_option("GOOG", Resolution.MINUTE) self._symbol = option.symbol option.set_filter( lambda universe: universe.include_weeklys().call_spread(30, 5) ) 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 contracts ordered_calls = sorted(calls, key=lambda x: x.strike) itm_call = ordered_calls[0] otm_call = ordered_calls[-1] # Place the order option_strategy = OptionStrategies.bear_call_spread( self._symbol, itm_call.strike, otm_call.strike, expiry ) self.buy(option_strategy, 1)