Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
AttributeError: 'list' object has no attribute 'sid'

I didnt see a post on this AttributeError so I thought I would make a post asking for some help. Below is how I have initialize() and make_pipeline() set up. The error is pointing to pipe = make_pipeline(). For context, I am trying to calculate the drawdown of SPY and then rebalance the portfolio (context.w) based on the drawdown percentage of SPY. As a result, I am trying to create a pipeline for a single stock. Perhaps there is a better way of going about doing this?

def initialize(context):

    context.w = {symbol('VTI'): 0.30,  
                 symbol('TLT'): 0.40,  
                 symbol('IEI'): 0.15,  
                 symbol('GLD'): 0.075,  
                 symbol('GSG'): 0.075}

    pipe = make_pipeline()  
    attach_pipeline(pipe, name='my_pipeline')  
    schedule_function(rebalance, date_rules.week_start(), time_rules.market_open(hours=1))

def make_pipeline():  
    asset = [symbols('SPY')]  
    spy_screen = StaticAssets(asset)  
    drawdown = DrawdownFactor()

    return Pipeline(  
        columns={  
            'drawdown': drawdown  
        },  
        screen=spy_screen,  
    )  
3 responses

FWIW pipe = make_pipeline() works in the attached notebook.

@Kyle,

To get help faster, I would recommend attaching a backtest to your posts.

This may help.

Apologies, I didnt think I would be able to attach the backtest because it never actually ran due to the error.

You suggested change worked, thank you.