Hi, I am stuck and cannot figure out why my algorithm is not working. If someone could help me that would be great.
Thanks,
Aditya Holla.
Its not letting me attach a backtest so the code is copied below:
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)
Quandl.SetAuthCode("zkdoRxRXbAQdUxzXZKBy")
self.shiller = self.AddData(QuandlCustomColumns, "MULTPL/SHILLER_PE_RATIO_MONTH", Resolution.Daily )
def OnData(self, data):
if self.shiller < 10:
self.SetHoldings("SPY", .40,)
self.SetHoldings("TLT", .60)
elif self.shiller < 14 and self.shiller.Current.Value > 10:
self.SetHoldings("SPY", .60,)
self.SetHoldings("TLT", .40)
else:
self.SetHoldings("SPY", .8)
self.SetHoldings("TLT", .20)
class QuandlCustomColumns(PythonQuandl):
def __init__(self):
self.ValueColumnName = "Value"