I am new to Quantopian and have very limited knowledge. I am trying to learn new things and Quantopian caught my attention.
I was writing a very simple algo using the examples available on the community for my learning purpose.
The algo is using pipeline to get top 5 stocks with 10 day sma, 30 day sma and latest close with a filter of sma_10 < latest_close.
Then for each stock in this updated universe, I am calculating 5 day average price and buying if current price is more than 1% of 5 day average or selling if current price is less than 5 day average.
And I record all this with current price.
I get the below error for a stock 'MYLNG' on 2011-01-13
data[sec].price: TypeError: exceptions must be old-style classes or derived from BaseException, not NoneType
This stock comes up in my universe twice before on 2011-01-06 and 2011-01-07 and gives no error.
I am not able to figure out what is causing this issue.
2011-01-06
sec: Equity(38107, symbol=u'MYLNG', asset_name=u'MYLAN INC 1.25% 3/15/12 CONV', exchange=u'NASDAQ CAPITAL MARKET', start_date=Timestamp('2007-03-05 00:00:00+0000', tz='UTC'), end_date=Timestamp('2012-12-19 00:00:00+0000', tz='UTC'), first_traded=None)
sec.symbol: u'MYLNG'
average_price: 1105.6
current_price: 1110.0
cash: -437628.250318
1.01*average_price: 1116.656
number_of_shares: NameError: name 'number_of_shares' is not defined
number_of_shares*current_price: NameError: name 'number_of_shares' is not defined
data[sec].price: 1082.124
int(cash/current_price): -394
2011-01-07
sec: Equity(38107, symbol=u'MYLNG', asset_name=u'MYLAN INC 1.25% 3/15/12 CONV', exchange=u'NASDAQ CAPITAL MARKET', start_date=Timestamp('2007-03-05 00:00:00+0000', tz='UTC'), end_date=Timestamp('2012-12-19 00:00:00+0000', tz='UTC'), first_traded=None)
sec.symbol: u'MYLNG'
average_price: 1079.152
current_price: 1082.124
cash: -459659.331104
1.01*average_price: 1089.94352
number_of_shares: NameError: name 'number_of_shares' is not defined
number_of_shares*current_price: NameError: name 'number_of_shares' is not defined
data[sec].price: 1082.124
int(cash/current_price): -424
2011-01-13
sec: Equity(38107, symbol=u'MYLNG', asset_name=u'MYLAN INC 1.25% 3/15/12 CONV', exchange=u'NASDAQ CAPITAL MARKET', start_date=Timestamp('2007-03-05 00:00:00+0000', tz='UTC'), end_date=Timestamp('2012-12-19 00:00:00+0000', tz='UTC'), first_traded=None)
sec.symbol: u'MYLNG'
average_price: 1104.966
current_price: 1105.0
cash: -104578.69921
1.01*average_price: 1116.01566
number_of_shares: NameError: name 'number_of_shares' is not defined
number_of_shares*current_price: NameError: name 'number_of_shares' is not defined
data[sec].price: TypeError: exceptions must be old-style classes or derived from BaseException, not NoneType
int(cash/current_price): -94