Hi, I'm new to quantconnect and migrating from quantopian. I have some troubles understanding the API; I am not sure how to use indicators and especially the coase universe selection in python. I am trying create a str-list of equities based on their 30 day momentum and then fire a scheduled event that uses an updated list every time it fires:

class MyAlgo(QCAlgorithm):
def Initialize(self):


self.Schedule.On(self.DateRules.MonthStart(),self.TimeRules.At(12, 35), Action(self.momentum))

def CoarseSelectionFunction(self, coarse):
#so far I have tried this
sortedByDollarVolume = sorted(coarse, key=lambda x: x.Volume, reverse=True)

vol_asset = [x.Symbol for x in sortedByDollarVolume[:100]]

slice1 = self.History(vol_asset, 30, Resolution.Daily)
price_history1 = slice1["close"].unstack(level=0)
pre_return = price_history1.pct_change()

search = pre_return.sort_values(axis=0, ascending=False, inplace=False, kind='quicksort', na_position='last')
global c_asset
c_asset = list(search.index[0:50])
return c_asset

def OnData(self, slice):

def momentum(self):

global c_asset
asset = c_asset

number = len(asset)#asset should be a python list

I have tried to define helper classes as well but without success - does anybody know how I could go about it? Thanks