Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Help with creating a pipeline factor

I'm trying to create a limited version of a running pipeline algo that would just be restricted to a handful of etf's. The algo I've modified from one developed by Anthony Garner (thanks Anthony) which I like a lot. But that algo addresses hundreds of stocks at a time, and consequently would only suit large portfolios. I want something that would select the best 3 out of about 12 etf's as opposed to individual stocks.

Based on comments seen on this forum, my first attempt was to use Update_universe function and limit it to my list of etf's. This produced no error but did NOT filter by the etf's I desired.

Since that failed I though I could add a column to the pipeline that stored the symbol so that I could later
filter the resulting dataframe by that set of symbols. Here's my stab at creating the factor:


class Primary_symbol(CustomFactor):  
    inputs = [morningstar.company_reference.primary_symbol]  
    window_length = 1

    def compute(self, today, assets, out, primary_symbol):  
        out[:] = primary_symbol[-1]  

But this gives me the following error code:

ValueError: setting an array element with a sequence.

What am I doing wrong?

Thanks