Overall Statistics |
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe 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 -5.52 Tracking Error 0.073 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
class VAlgorithm(QCAlgorithmFramework): def Initialize(self): self.SetStartDate(2012, 2, 1) self.SetEndDate(2012, 3, 3) self.SetCash(100000) self.spy = self.AddEquity("SPY", Resolution.Daily).Symbol self.vix = self.AddIndex('VIX', Resolution.Minute).Symbol self.lookbackSTD = 21 self.lookbackSMA = 1 self.SetWarmup(self.lookbackSTD + self.lookbackSMA, Resolution.Daily) self.rollingWindow = RollingWindow[TradeBar](self.lookbackSTD) self.first = True self.Consolidate(self.vix, Resolution.Daily, self.CustomBarHandler) def OnData(self, data): if self.IsWarmingUp: return if not self.rollingWindow.IsReady: return if self.rollingWindow.IsReady and self.first: self.Debug("Window ready at "+str(self.Time)) self.first = False if self.IsMarketOpen(self.spy) and (self.Time.hour == 9 and self.Time.minute == 31): self.Plot("VIX", "VIX Price 21 days ago", self.rollingWindow[self.rollingWindow.Count-1].Close) self.Debug(f"{self.Time} !!!Most recent item in rolling window {self.rollingWindow[0].Close}") self.Debug(f"{self.Time} !!!Last item in rolling window {self.rollingWindow[self.rollingWindow.Count-1].Close}") def CustomBarHandler(self, bar): self.rollingWindow.Add(bar)