46

I need to download in some way a list of all stock symbol of specified market.

I've found in this link ho can I do it someway.

It uses following link in order to retrieve stock list that statisfies some parameters:

https://www.google.com/finance?start=0&num=3000&q=%5B(exchange%20%3D%3D%20%22NASDAQ%22)%20%26%20(last_price%20%3E%200.1)%20%26%20(last_price%20%3C%201500)%5D&restype=company&noIL=1

I've modified the query removing contraints

https://www.google.com/finance?q=%5B%28exchange+%3D%3D+%22NASDAQ%22%29%5D

Now I have all stock list but in a web page that I must navigate.

Is there a way to obtain the full list in some standard format, like xml, json or whatever?

Community
  • 1
  • 1
Jepessen
  • 9,377
  • 11
  • 64
  • 111

4 Answers4

97

Exchanges will usually publish an up-to-date list of securities on their web pages. For example, these pages offer CSV downloads:

NASDAQ Updated their site, so you will have to modify the URLS:

NASDAQ

AMEX

NYSE

Depending on your requirement, you could create the map of these URLs by exchange in your own code.

Capn Sparrow
  • 1,838
  • 1
  • 14
  • 28
  • I like it, but I want to create a list of most of exchanges and then downloading their data by choosing one. with the query it will be more simple to have it, instead of find a way to download all of them manually that can be a long search... – Jepessen Aug 16 '14 at 13:43
  • It is important the get the list of symbols from the data provider you're going to use (ie. Google, Y! etc.), because some symbols may repeat on different exchanges, so providers add pre- or suffixes to differentiate. Example: Vodafone is listed as VOD in LSE and NASDAQ, so in Y! Finance the LSE one is VOD.L and you have to make sure your code knows about it. – mac13k Jul 01 '16 at 13:41
  • 1
    Any idea how can I get the NYSEAMERICAN quotes. ? – Sebastian SALAMANCA Dec 19 '17 at 01:42
  • 1
    Got it. you have to put AMEX instead of NYSE http://www.nasdaq.com/screening/companies-by-industry.aspx?exchange=AMEX&render=download – Sebastian SALAMANCA Dec 19 '17 at 01:50
  • 19
    I made a really quick and dirty api after coming back to this answer multiple times over the years. http://dumbstockapi.com/ – 1mike12 Jul 20 '18 at 22:55
  • @1mike12 looks great! Might be helpful to show which URLs you're scraping also. – Capn Sparrow Jul 21 '18 at 00:42
  • It's still very much work in progress, but once it's nailed down I'll try to have it in documentation. The thing that's complicated is that sometimes there's multiple files and they have to be cross referenced to generate the required data. So I'm not even sure how to structure it right now, let alone how to display that to end users haha – 1mike12 Aug 02 '18 at 03:45
  • 2
    Unfortunately, NASDAQ has changed their site and no longer seems to be offering free CSV downloads of US-listed companies. – Andrew Basile Sep 15 '19 at 04:07
  • Looks like you can still get all the data here, but there's more work to do to scrape and format it: https://quotes.wsj.com/company-list/ – Capn Sparrow Sep 15 '19 at 22:36
  • 1
    I made a repository with a python file, containing a dictionary which you can import and pass it as a parameter to a DataFrame constructor to get the companies listed in Nasdaq. The dict is named `nasdaq_dict`, so after importing just use this line `df = pd.DataFrame(nasdaq_dict)` and you have your DataFrame ready. Hope you find it useful. URL: https://github.com/tastyycode/pyfinance – ccolin Sep 26 '19 at 20:00
  • 5
    As an FYI for those who come across this, you can download a _combined_ CSV for **all** exchanges (i.e., NYSE, NASDAQ and AMEX) from [https://old.nasdaq.com/screening/companies-by-name.aspx?letter=0&render=download&exchange=](https://old.nasdaq.com/screening/companies-by-name.aspx?letter=0&render=download&exchange=) Leaving the `exchange` variable value empty causes the NASDAQ website's API to return data for all exchanges. – Spencer D Dec 24 '19 at 17:22
  • doesn't work with curl for some reason. – chovy Dec 21 '20 at 05:51
  • https://quant.stackexchange.com/questions/1640/where-to-download-list-of-all-common-stocks-traded-on-nyse-nasdaq-and-amex – T.Todua Mar 02 '21 at 09:37
  • These links are terribly outdated and the company names included aren't really useful for parsing. – chovy Apr 20 '21 at 18:14
5

There does not seem to be a straight-forward way provided by Google or Yahoo finance portals to download the full list of tickers. One possible 'brute force' way to get it is to query their APIs for every possible combinations of letters and save only those that return valid results. As silly as it may seem there are people who actually do it (ie. check this: http://investexcel.net/all-yahoo-finance-stock-tickers/).

You can download lists of symbols from exchanges directly or 3rd party websites as suggested by @Eugene S and @Capn Sparrow, however if you intend to use it to fetch data from Google or Yahoo, you have to sometimes use prefixes or suffixes to make sure that you're getting the correct data. This is because some symbols may repeat between exchanges, so Google and Yahoo prepend or append exchange codes to the tickers in order to distinguish between them. Here's an example:

Company:  Vodafone
------------------
LSE symbol:    VOD
 in Google:    LON:VOD
 in Yahoo:     VOD.L
NASDAQ symbol: VOD
 in Google:    NASDAQ:VOD
 in Yahoo:     VOD
mac13k
  • 1,749
  • 17
  • 23
4

This may be old, but... if you change the link in google stock list as below:

https://www.google.com/finance?q=%5B(exchange%20%3D%3D%20%22NASDAQ%22)%5D&restype=company&noIL=1&num=30000

  • note for the noIL=1&num=30000

It means, starting for row 1 to 30000. It shows all results in one page.

You may automate it using any language or just export the table to excel.

Hope it helps.

2

You can download a list of symbols from here. You have an option to download the whole list directly into excel file. You will have to register though.

Eugene S
  • 6,119
  • 7
  • 52
  • 82
  • Thanks this is a better solution. but I'd like to know if there's a way without registration, because I'd like to integrate this download in a trading app that I'm developing... – Jepessen Aug 16 '14 at 15:00
  • 1
    @Jepessen Well, you can always create a simple automated logon script. Shouldn't be an issue with this website. – Eugene S Aug 17 '14 at 12:57
  • Their data contains all actual symbols, but is also full of rubbish, ie. you can encounter symbols that are not from the exchange you're interested in or are otherwise invalid and cannot be found. Also see my comment under @Capn Sparrow's answer as this issue still exists in this case. – mac13k Jul 01 '16 at 13:44