In Python, we can use Coarse Universe Selection that allows scanning but uses normal market hours prices and volumes:
# In Initialize:
self.AddUniverse(self.CoarseSelectionFunction, self.FineSelectionFunction)
These functions receive the Coarse and Fine universes, where returns a list of symbols that obey our filtering criteria. E.g.::
def CoarseSelectionFunction(self, coarse):
# sort descending by daily dollar volume
sortedByDollarVolume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True)
# return the symbol objects of the top entries from our sorted collection
top5 = sortedByDollarVolume[:self.__numberOfSymbols]
# we need to return only the symbol objects
list = List[Symbol]()
for x in top5:
list.Add(x.Symbol)
return list
Please checkout the working example below.
For other examples, take a look at the open-source project.