Hi. I have a script that added equities in this form:
self.tickers = ["TLT", "GLD", "VTI"]
for ticker in self.tickers:
self.AddEquity(ticker, Resolution.Daily)
However, now I want to add custom data in this form from the NIFTY example.
gold1 = self.AddData(GoldPhys, "IGLN.L", Resolution.Daily).Symbol
bond1 = self.AddData(Treas20, "IDTL.L", Resolution.Daily).Symbol
spy1 = self.AddData(VanSPY, "VDNR.L", Resolution.Daily).Symbol
OR
self.AddData(GoldPhys, "IGLN.L", Resolution.Daily).Symbol
self.AddData(Treas20, "IDTL.L", Resolution.Daily).Symbol
self.AddData(VanSPY, "VDNR.L", Resolution.Daily).Symbol
With data classes like so:
class GoldPhys(PythonData):
'''IGLN.L Custom Data Class'''
def GetSource(self, config, date, isLiveMode):
return SubscriptionDataSource("https://www.dropbox.com/s/????????/IGLN.csv?dl=1", SubscriptionTransportMedium.RemoteFile)
def Reader(self, config, line, date, isLiveMode):
if not (line.strip() and line[0].isdigit()): return None
# New GoldPhys object
gold = GoldPhys()
gold.Symbol = config.Symbol
try:
# Example File Format:
# Date, Open High Low Close Volume
# 2011-09-13 7792.9 7799.9 7722.65 7748.7 116534670
data = line.split(',')
gold.Time = datetime.strptime(data[0], "%Y-%m-%d")
gold.Value = data[4]
gold["open"] = float(data[1])
gold["high"] = float(data[2])
gold["low"] = float(data[3])
gold["close"] = float(data[4])
except ValueError:
# Do nothing
return None
return gold
My question is how to combine the new data classes into a list in the same manner as the first snippet, where all ETFs become 'ticker in self.tickers' ?