Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Pipeline to filtering out financial stocks?

Based on code I saw for is_primary_share that limits to only primary shares, that is also shown below.
So was trying to create a filter/eliminate financial stocks.
Can't figure out how.
I thought " financial = sector_code.ne(103)" would work. but does not.
Is there a list of operators that are available?
Is there way to extend that list?

    # Construct a Filter for only primary shares.  
    share_class = share_class_reference.is_primary_share.latest  
    is_share_class_primary = share_class.eq(1)


    sector_code = asset_classification.morningstar_sector_code.latest  
    financial = sector_code.ne(103)

1 response

It's probably doing floating-point comparisons on the sector code. Maybe try filtering based on <103.5 and >102.5 ?