# How to get a list of stocks symbol of a specific exchange? [duplicate]

Possible Duplicate:
Where to download list of all common stocks traded on NYSE, NASDAQ and AMEX?

Is it possible to download a list of stocks that belong to a specific exchange (e.g. NASDAQ, AMEX, NYSE)? The tseries package has a function to download the price history of a stock, but how to get all the stocks of an exchange?

-

## migrated from stackoverflow.comAug 22 '11 at 19:14

This question came from our site for professional and enthusiast programmers.

## marked as duplicate by Tal Fishman, Steve, Louis Marascio, olaker♦Sep 10 '11 at 19:15

–  Joshua Ulrich Aug 16 '11 at 14:27
@Joshua I have seen the second link, it looks awesome, but it only works for NASDAQ, NYSE and AMEX. is there another function to downaload other exchanges? –  Dail Aug 16 '11 at 15:03
@Joshua is still TTR package broken in R-Cran? –  Dail Aug 16 '11 at 15:13
Unfortunately, TTR on CRAN is still broken. I don't know of a function to download symbols from any other exchanges. –  Joshua Ulrich Aug 16 '11 at 15:23
JOshua i have seen i can use it for these three exchanges and i also can use TTR to get historical price from yahoo, right? –  Dail Aug 16 '11 at 16:05

I think you are confused about "markets". Of the three you listed, only NASDAQ is an exchange, the other two are information services. For the three major US exchanges, you go to: (NASDAQ, AMEX, NYSE):

http://www.nasdaq.com/screening/company-list.aspx

Pick the one you are interested in and answer their silly robot barrier "puzzle" and download the csv file, in which the ticker symbol is the first column.

Edit: With TTR_0.20-3 from r-forge, the list appears more complete than with the prior version:

require(TTR)
SYMs <- TTR::stockSymbols()
#Fetching AMEX symbols...
#Fetching NASDAQ symbols...
#Fetching NYSE symbols...
table(SYMs\$Exchange)

##  AMEX NASDAQ   NYSE
#   308   2820   3261


Whereas the csv file from NASDAQ for NASDAQ had 2820 symbols. On the other hand the TTR authors may have eliminated some of the duplicates, warrants or outdated symbols.

-
TTR::stockSymbols does this for you. See the two links in my comment to the OP. –  Joshua Ulrich Aug 16 '11 at 14:30
yes i think it too. Good! –  Dail Aug 16 '11 at 16:03
@Dwin: looks like you're using TTR_0.20-2. stockSymbols is broken in that version. I really need to push an update to CRAN. Also, it doesn't eliminate any symbols. –  Joshua Ulrich Aug 16 '11 at 16:17
Yes. My system reported that as the current CRAN version. –  DWin Aug 16 '11 at 16:26