Exchanges will usually publish an up-to-date list of securities on their web pages. For example, these pages offer CSV downloads:
- http://www.nasdaq.com/screening/companies-by-industry.aspx?exchange=NASDAQ&render=download
- http://www.nasdaq.com/screening/companies-by-industry.aspx?exchange=NYSE&render=download
- http://www.asx.com.au/asx/research/ASXListedCompanies.csv
NASDAQ Updated their site, so you will have to modify the URLS:
NASDAQ
- https://old.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=nasdaq&render=download
AMEX
- https://old.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=amex&render=download
NYSE
- https://old.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=nyse&render=download
Depending on your requirement, you could create the map of these URLs by exchange in your own code.