Overall Statistics |
Total Orders 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Start Equity 100000 End Equity 100000 Net Profit 0% Sharpe Ratio 0 Sortino Ratio 0 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio -1.264 Tracking Error 0.103 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset Portfolio Turnover 0% |
from AlgorithmImports import * from datetime import datetime, timedelta class VIXGapStrangle(QCAlgorithm): def Initialize(self): self.SetStartDate(2024, 10, 1) # Set start date self.SetCash(100000) # Set strategy cash self.SetWarmup(timedelta(minutes=30)) self.vix = self.AddIndex("VIX", Resolution.Minute).Symbol self.spx = self.AddIndex("SPX", Resolution.Minute).Symbol # regular option SPX contracts self.spx_options = self.add_index_option("SPX") self.spx_options.set_filter(lambda u: (u.strikes(-3, 3).expiration(0, 0))) # 0dte only # weekly option SPX contracts spxw = self.add_index_option("SPX", "SPXW") spxw.set_filter(lambda u: (u.strikes(-10, 10) .expiration(0, 0) .include_weeklys())) # 0dte only self.spxw_option = spxw.symbol self.previous_vix_close = None # Schedule the strategy check for 9:30 AM EST each day self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.At(9, 30), self.CheckVIXGap) # Schedule recording previous day's VIX close at 4:15 PM EST self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.At(16, 15), self.RecordVIXClose) def RecordVIXClose(self): """Record VIX close at 4:15 PM EST""" vix_price = self.Securities[self.vix].Price self.Debug(f"VIX close: {vix_price}") self.previous_vix_close = vix_price def CheckVIXGap(self): """Check for VIX gap down""" if self.previous_vix_close is None: return current_vix = self.Securities[self.vix].Price self.Debug(f"VIX open: {current_vix}") vix_gap = self.previous_vix_close - current_vix self.Debug(f"VIX gap is {vix_gap:.2f}") def on_data(self, data): pass