Overall Statistics |
Total Trades 10001 Average Win 0.01% Average Loss -0.01% Compounding Annual Return 6.151% Drawdown 8.700% Expectancy 0.504 Net Profit 11.503% Sharpe Ratio 0.739 Probabilistic Sharpe Ratio 34.998% Loss Rate 42% Win Rate 58% Profit-Loss Ratio 1.57 Alpha 0.063 Beta 0.005 Annual Standard Deviation 0.087 Annual Variance 0.008 Information Ratio -0.264 Tracking Error 0.216 Treynor Ratio 12.109 Total Fees $10006.16 Estimated Strategy Capacity $720000.00 Lowest Capacity Asset TLT SGNKIKYGE9NP |
class FocusedSkyBlueSalmon(QCAlgorithm): def Initialize(self): self.SetStartDate(2010, 1, 1) # Set Start and End Date self.SetEndDate(2021, 6, 15) self.SetCash(100000) #Set Cash self.SpySymbol = self.AddEquity("SPY", Resolution.Minute) #Request Data self.TMFSymbol = self.AddEquity("TLT", Resolution.Minute) self.SmaSpy = self.SMA("SPY", 100, Resolution.Daily) #Indicator Simple Moving Average 200 days self.SetWarmup(200) #Warmup Indicator Quandl.SetAuthCode("zkdoRxRXbAQdUxzXZKBy") self.shiller = self.AddData(QuandlCustomColumns, "MULTPL/SHILLER_PE_RATIO_MONTH", Resolution.Daily, TimeZones.NewYork ) self.rebal = 4 #Rebalance self.rebalTimer = self.rebal - 1 self.flag1 = 0 self.Schedule.On(self.DateRules.WeekStart("SPY"), self.TimeRules.AfterMarketOpen("SPY", 1), self.Rebalance) # Set Rebalance def OnData(self, data): if self.flag1 != 1: return if self.SmaSpy.IsReady: # When Warm Up is done self.Debug("Ready!") if self.SmaSpy is None or not self.SmaSpy.IsReady: #Final Check That Everything is ready return if self.SmaSpy.Current.Value < self.Securities["SPY"].Close: sign = 1 else: sign = 2 if sign == 1: if self.shiller.Close > 22: self.SetHoldings("SPY", .2) self.SetHoldings("TLT", .8) elif self.shiller.Close > 14 and self.shiller.Close < 22: self.SetHoldings("SPY", .4) self.SetHoldings("TLT", .6) else: self.SetHoldings("SPY", .8) self.SetHoldings("TLT", .2) else: if self.shiller.Close > 22: self.SetHoldings("SPY", .2) self.SetHoldings("TLT", .8) elif self.shiller.Close > 14 and self.shiller.Close < 22: self.SetHoldings("SPY", .4) self.SetHoldings("TLT", .6) else: self.SetHoldings("SPY", .6) self.SetHoldings("TLT", .4) def Rebalance(self): self.rebalTimer +=1 if self.rebalTimer == self.rebal: self.flag1 = 1 class QuandlCustomColumns(PythonQuandl): def __init__(self): self.ValueColumnName = "Value"