I'm not sure how Universes work. I've read all the documentation and many discussion posts and nothing I have found works for me. How do I get symbols from this? I'm not sure how to put this into a trading function since I can't figure out what this function does and can't see what it is returning. If I had the function
def OnData(self, data) :
if ema50 > ema200:
SetHoldings("?", 0.5 )
What do I put in place for the question mark? I'm not sure how to get the tickers from the Universe to do this.
This is the code that I'm using for my Universe
def Initialize(self):
self.SetStartDate(2000, 1, 15) # Set Start Date
self.SetEndDate(2019, 5, 15)
self.SetCash(1000) # Set Strategy Cash
self.UniverseSettings.Resolution = Resolution.Daily
self.AddUniverse(self.CoarseSelectionFunction)
def CoarseSelectionFunction(self, coarse):
# sort descending by daily dollar volume
sortedByDollarVolume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True)
# we need to return only the symbol objects
return [ x.Symbol for x in sortedByDollarVolume[:50] ]