Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
How do I manually remove a symbol from my custom universe?

I called the NASDAQ's 200 largets symbols by market cap but I keep getting errors from certain stocks that keep my backtests from completing (KeyError: Security(27358, symbol='LBTY_B', security_name='LIBERTY GLOBAL INC', exchange='NASDAQ GLOBAL SELECT MARKET', start_date=Timestamp('2004-06-08 00:00:00+0000', tz='UTC'), end_date=Timestamp('2015-03-06 00:00:00+0000', tz='UTC'), first_traded=None), for example).

Since, there's always another stock I can call instead of the problematic ones, I tried to make a no-no stock list in the same way I filter out the leveraged_etf_list.

Can anyone tell me what I'm doing wrong?

Thanks in advance.

1 response

Hello Aitor,

Here's what I worked up. It seems to fix the problem, but I would recommend checking more closely.

I'm not sure about the code to handle de-listed stocks. I'm not clear if the backtester can sell stocks that have been de-listed, so there is a risk that they remain in the portfolio; you might check if there are any stragglers.

Grant