Overall Statistics |
Total Orders 269 Average Win 0.57% Average Loss -0.68% Compounding Annual Return 0.689% Drawdown 11.300% Expectancy 0.044 Start Equity 1000000 End Equity 1061023 Net Profit 6.102% Sharpe Ratio -0.542 Sortino Ratio -0.521 Probabilistic Sharpe Ratio 0.159% Loss Rate 43% Win Rate 57% Profit-Loss Ratio 0.83 Alpha -0.014 Beta -0.04 Annual Standard Deviation 0.031 Annual Variance 0.001 Information Ratio -0.63 Tracking Error 0.159 Treynor Ratio 0.421 Total Fees $0.00 Estimated Strategy Capacity $69000000.00 Lowest Capacity Asset SPX 32K4X0ZMMZAMM|SPX 31 Portfolio Turnover 0.03% |
# region imports from AlgorithmImports import * # endregion class VolatilityTradingOptionAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2016, 1, 1) self.set_cash(1_000_000) self._vix = self.add_index('VIX') self.settings.automatic_indicator_warm_up = True self._bb = self.bb(self._vix.symbol, 90, 1, resolution=Resolution.DAILY) self._spx = self.add_index_option('SPX') self._spx.set_filter(lambda universe: universe.straddle(30)) def on_data(self, data): if self.portfolio.invested: return chain = data.option_chains.get(self._spx.symbol, None) if not chain: return expiry = min([x.expiry for x in chain if x.expiry > self.time]) strike = sorted(chain, key=lambda x: abs(x.strike - chain.underlying.price))[0].strike strategy = OptionStrategies.straddle(self._spx.symbol, strike, expiry) quantity = 1 if self._vix.price > self._bb.upper_band.current.value else -1 self.plot('VIX', 'Value', self._vix.price) self.plot('VIX', '+1 STD', self._bb.upper_band.current.value) self.order(strategy, quantity) def on_order_event(self, order_event): if order_event.status == OrderStatus.FILLED and order_event.is_assignment: self.liquidate()