Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Can somebody give me a hand to make my_filter working.

Can somebody give me a hand to make my_filter working.

full_list = QTradableStocksUS()  
excludes = Q500US()

    my_filter = [x for x in full_list if x not in excludes]  
2 responses

I believe this is what you are looking for?

full_list = QTradableStocksUS()  
excludes = Q500US()  
my_filter = full_list & ~excludes

Or, all in one line...

my_filter = QTradableStocksUS() & ~Q500US()

Take a look at the documentation for the operators that can be used on filters https://www.quantopian.com/help#quantopian_pipeline_filters_Filter

Dan,
You exceed my expectation.
You really are The Best Quantopian Forum Helper.