[R-SIG-Finance] How can I retrieve list of all companies listed of a given Index say S&P 500

Dirk Eddelbuettel edd at debian.org
Sun Nov 22 10:22:53 CET 2009


On 21 November 2009 at 22:18, FX Going wrote:
| Hey Folks,I understand I could grab list of all companies listed on S&P 500 from wikipedia http://en.wikipedia.org/wiki/List_of_S&P_500_companies 
| However what I am looking for is a function whose input is a User specified an Index {better yet, a list of indexes}..For each of the index, The function should be able to retrieve companies listed on that index alongwith their symbols  and dump into a flat file/database.. 
| Is there a function in R metrics or fImport You know  that can do the same.. If not , no problem, I guess I will write a function :-)..but before putting the effort just wanted to check if one already exists then I could use it.Thanksfoxonie.    		 	   		  

I don't think there is a function that does it for you given just an index
name. But starting with csv file for the SP500, I did exactly what you
describe for a little demo: loop over the symbols, and fetch the data with
one of the many data downloaders available for R.  As of mid-November, the
SP500 had 477 constituents ...

On 21 November 2009 at 23:29, FX Going wrote:
| My related question is.I am trying to download a list of stocks that meet specific criteria (say download all  penny stocks listed on all indexes).. Is there an easy way to do the same.Thanksfoxonie

Same thing: at some point you may have to start to do your own homework.

Hope this helps, Dirk

-- 
Three out of two people have difficulties with fractions.



More information about the R-SIG-Finance mailing list