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

KeyError: Equity(25984, symbol=u'DIET', asset_name=u'EDIETS.COM INC',
exchange=u'NASDAQ GLOBAL MARKET', start_date=Timestamp('2004-02-17
00:00:00+0000', tz='UTC'), end_date=Timestamp('2011-12-01
00:00:00+0000', tz='UTC'), first_traded=None)

Here is the relevant code:

In the initialize function

class L2Factor(CustomFactor):  
    inputs = [USEquityPricing.high, USEquityPricing.low, USEquityPricing.close]  
    def compute(self, today, assets, out, high, low, close):  
       out[:] = close-(1.1*(high-low )/6)  
L2 = L2Factor(window_length=1)  
pipe.add(L2, 'L2')  

Then in handle_data

for stock in data.keys():  
    prev_bar = history(bar_count=2, frequency='1m', field='price').iloc[0]  
    L2 = context.my_universe.L2[stock] # error happens on this line.