Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Filter out ADRs/GDRs and non-primary shares in pipeline. (HELP)

I would like to filter out ADRs and GDRs and keep only primary shares:
I tried to do it in following way (like I did in case filtering sectors) :

class PrimaryShare(CustomFactor):  
    inputs = [morningstar.share_class_reference.is_primary_share]  
    window_length = 1  
    def compute(self, today, assets, out, is_primary_share):  
        out[:] = is_primary_share  
class DepositaryReceipt(CustomFactor):  
    inputs = [morningstar.share_class_reference.is_depositary_receipt]  
    window_length = 1  
    def compute(self, today, assets, out, is_depositary_receipt):  
        out[:] = is_depositary_receipt

def initialize(context):  
    pipe = Pipeline()  
    attach_pipeline(pipe, 'my_pipe')

   prim_share = PrimaryShare()  
   dep_receipt = DepositaryReceipt()

   pipe.add(prim_share, 'prim_share')  
   pipe.add(dep_receipt, 'dep_receipt')

    primary_share = (prim_share == True)  
    deposit_receipt = ( dep_receipt == False)

    pipe.set_screen(primary_share&deposit_receipt)

It gives following error: "TypeError: Don't know how to construct AdjustedArray on data of type object."
Without the inclusion of these two "factors" into pipeline, everything runs ok, the moment I add em, e.g. pipe.add(prim_share, 'prim_share') it raises error.

Thx for help!

1 response

I'm waiting for this to become available as built in the pipeline, was told it's presently being worked on