Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
HELP: Issue With KeyError

Every time I run my algo, I get this key error ... Can anyone help me? I've tried a million things now ... even excluding this specific security after which I get it with the apple security later on ...

KeyError: Equity(2, symbol=u'ARNC', asset_name=u'ARCONIC INC', exchange=u'NYSE', start_date=Timestamp('2002-01-01 00:00:00+0000', tz='UTC'), end_date=Timestamp('2017-06-20 00:00:00+0000', tz='UTC'), first_traded=None, auto_close_date=Timestamp('2017-06-23 00:00:00+0000', tz='UTC'), exchange_full=u'NEW YORK STOCK EXCHANGE')
... USER ALGORITHM:206, in market_after_open
context.daily_stocks[stock] = prices/context.daily_stocks[stock]

    if (weekday == '1' or  weekday == '2' or weekday == '3') and loc_dt.hour == 9 and loc_dt.minute == 30 + context.minutes_after:  
        for stock in context.stocks:  
            prices = data.current(stock, 'price')  
            context.daily_stocks[stock] = prices/context.daily_stocks[stock]  
            winner = max(context.daily_stocks.values())  
        for stock in context.stocks:  
            if context.daily_stocks[stock] == winner:  
                winning_stock = stock  
                break  
        return winning_stock  
    else:  
        pass  
1 response

Here is the full code if anyone cares to review