Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Stocks introduced each year (QRP/Seaborn) + error

Just a quick share:

This very simply finds out the number of stocks introduced each year, and plots the result on a Seaborn chart.

1) Why are there are so many introduced in 1993? This must be biased some how?
2) Changing the range from (1993, 2015) to (1994, 2015) results in an error:

length of rgba sequence should be either 3 or 4  
3 responses

So it seems any stock that started trading prior to 1993, has its start_date as 1993, hence the huge bar at the start. [Obviously, there is no data for any stock in Q universe before 2002.]

The error is still up in the air, but I'm sure that'll get ironed out with time.

For Apple,

Security(24, symbol=u'AAPL', security_name=u'APPLE INC', exchange=u'NASDAQ GLOBAL SELECT MARKET', start_date=u'Mon, 04 Jan 1993 00:00:00 GMT', end_date=u'Mon, 23 Mar 2015 00:00:00 GMT', first_traded=None)

So, yes, it appears that the start date may just correspond to when the stock was first entered into the database. The question in my mind, now, is "What is the start date?" Does it tell me when a stock was first offered on the exchange listed? Or something else?

That's what I was thinking. And the end date has similar questions, "is it when its finally delisted?". In lots of cases I see NaN for many days before the end_date.

I had been using the stock start and end dates in get_pricing calls, but I end up doing

dates = data.index[ data['close_price'] > 0 ] # i.e. 'not nan'  
start_dt = dates[0]  
end_dt = dates[-1]  

to get the first and last trade dates, otherwise you get years worth of NaN rows.