I'm trying to find a method to import the universe selection functions from a different file using the classic algorithm framework. But my method generates an error. Here's the code for both main.py and universe_selection.py
# main.py
from universe_selection import *
class VerticalQuantumInterceptor(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2019, 7, 12)# Set Start Date
self.SetEndDate(2019, 7, 16)
self.SetCash(100000) # Set Strategy Cash
self.UniverseSettings.Resolution = Resolution.Daily
self.tickers = ["AAPL", "TSLA", "FB"]
self.AddUniverse(CoarseSelection, FineSelection)
def OnData(self, data):
for ticker in self.tickers:
self.Debug("TICKER: " + ticker)
######
# univserse_selection.py
def CoarseSelection(self, coarse):
filteredCoarse = [x.Symbol for x in coarse if x.Symbol.Value in self.tickers and x.HasFundamentalData]
return filteredCoarse
def FineSelection(self, fine):
return [x.Symbol for x in fine]