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

Hello,

Quantopians,

First of all, let me say that I am very new to Quantopian and also quite new to python. I have a simple question that I don't know how to do.

I want to know the up and down of industry leaders each day. You can see a sample here...

http://www.bloomberg.com/visual-data/industries/

My strategy would include buying and selling on a certain security depending on how industry leaders are doing. Now, I can list all the current industry leaders and backtest my strategy. However, that would introduce survivor-ship bias since the present day industry leaders are not the same as those of 5 years ago.

So, how do I know which stocks are industry leaders ? or Is there any easy way to put all the stocks from each sector that is in S&P 500 ?

Any help and tips are appreciated.. Thank you all..

Best,

5 responses

Hello Nyan,

The Quantopian database has OHLCV bar data only. I suggest investigating fetcher in the help doc and in examples posted on the forum to import other data.

Also, there is a limit to the number of securities available to a given algorithm:

Your algorithm's universe can be defined from your Fetcher data file by using the optional universe_func parameter in Fetcher. universe_func allows you to create a universe of up to 200 securities (SIDs) without manually entering each security in the initialize function.

So, out of a basket of 200 securities, you should be able to periodically re-assign the industry leaders based on data you have fed into the algo via fetcher (or if you use a metric that can be computed with OHLCV data only, then fetcher won't be required).

Grant

Hi Grant,

Thank you your reply. I have considered that fetcher is the way to do it. But even then, I would need to put the data in the csv file in it. I currently don't know how to get historical ones for those. Do you have any tip for that ?

if you use a metric that can be computed with OHLCV data only, then fetcher won't be required

Can you please tell me what you mean by that ? I was just thinking to rank the companies according to market capitalization. ( Because the biggest market capitalization might correspond to the industry leaders. )For that, I would need the number of available shares at each point ? Or is it good enough just to use the present current number of outstanding shares since quantopian already took care of the shares split ?

I am sorry for dumb questions. :)

Cheers !

Nyan,

I think that you're correct to observe that Quantopian normalizes the price data so that if you know today's market cap, you can find historical market cap values for a given security. As I see it, market cap is proportional to split-adjusted price, so you just need to find the constant of proportionality for each security.

Grant

Nyan

Data1: Leaders & Laggards by Market Capitalization for Sectors http://biz.yahoo.com/p/csv/sum_mktd.csv
Data2: Leaders & Laggards by Market Capitalization for Sectors > Basic Materials http://biz.yahoo.com/p/csv/1mktd.csv
Data3: Market Capitalization by Sectors > Basic Materials > Agricultural Chemicals http://biz.yahoo.com/p/csv/112mktd.csv

or GOOGLEFINANCE Fetches current or historical securities information from Google Finance.
(Real Time) https://docs.google.com/spreadsheets/d/1yGYV_yTDuDCF3a5jQ7_eL14v4hQ5NqRgPUIawGasif8/pubhtml

or YQL console Yahoo
select MarketCapitalization from yahoo.finance.quotes where symbol in ("YHOO","AAPL")

Usage Limits
Per application limit (identified by your Access Key): 100,000 calls per day
Per IP limits: /v1/public/*: 2,000 calls per hour; /v1/yql/*: 20,000 calls per hour

Quatonpian encapsulate data and The Global Industry Classification Standard (GICS®) in fetcher

José

Thank you everyone ! Jose, this is interesting data that you have provided... where can i get those ?