2
$\begingroup$

Is there anyway to get the stock symbols of an exchange classified by industry? For example: AMD-semiconductor

The best I could find was this page:

https://money.cnn.com/data/sectors/tech/electronic/?sector=1300&industry=1305

I wasn't sure if my best bet would be to make something that grabs data off this site or if there was something more convenient already. What do you all think?

Thanks

$\endgroup$
3
$\begingroup$

First of all, you need to know they are different sector classifications. The main ones are:

In fact any index provider has to maintain its own list. This means that you should not focus on obtaining a very specific classification, any rough list should be enough.

My advice would be to look at ETF compositions. A lot of ETF indexed on sectors are available, and you will easily find a web site with the composition of an ETF. For instance, I googled "Consumer Staples ETF composition" and found the web page of the iShares Global Consumer Staples ETF. There is an excel spread sheet to download there, with the list of stocks included in this ETF. If you look for a 10 to 15 sectors classification, it is about a dozen of google search and a python code to import these lists every week to have a point in time database.

Another solution I found on the web is to rely on wikipedia pages, like its List of S&P 500 companies. This blog post comments a code to obtain this list in python.

$\endgroup$
3
$\begingroup$

For US stocks, you can use Quantopian's Research platform to access Morningstar's Industry & Sector Classification data for free.

All you need is some basic python programming skills. This dataset (and many others) can be accessed using Quantopian's Pipeline API (check out this tutorial).

The following example outputs a pandas DataFrame containing industry codes for all stocks that traded on major US exchanges last Friday (06/22/2018):

from quantopian.pipeline import Pipeline
from quantopian.pipeline.data import Fundamentals
from quantopian.research import run_pipeline

def make_pipeline():
    industry_code = Fundamentals.morningstar_industry_code.latest
    return Pipeline(
        columns={
            'industry_code': industry_code,
        }
    )

df = run_pipeline(make_pipeline(), start_date='2018-06-22', end_date='2018-06-22')

enter image description here

From here you can do all kinds of analyses and filtering using python. Check out Quantopian's Help page to get mappings from industry code to industry name.

$\endgroup$
  • $\begingroup$ Just for clarification, it is not possible to extract the data outside of quantopian and abide by their terms of service at the same time right? $\endgroup$ – Ceeerson Jun 26 '18 at 2:27
  • $\begingroup$ Correct. Quantopian's data is available for use only within the platform. $\endgroup$ – ernestoeperez88 Jun 26 '18 at 16:26

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.