Download historical daily stock prices for all S&P 500 stocks

Hello,

Is there a way to download historical daily prices for all constituents of a stock index (e.g. S&P 500, NYSE, NASDAQ etc) for as many days possible back in the past? Either way would work i.e. through Excel or Eikon Web/GUI or Python etc..

Thanks in advance!

Best Answer

  • For an index with a small number of constituents you may be able to retrieve price history in a single request. E.g. the following Excel worksheet function retrieves daily price history for the last 30 years for current constituents of Dow Jones Industrial Average Index.

    =TR("0#.DJI","TR.CLOSEPRICE","EDate=-30Y SDate=0D RH:Date CH:In")
    For indices with larger number of constituents you'd need to split the request: first retrieve the list of constituents, then slice the list and retrieve price history for a few stocks at a time (or maybe even just one stock at a time if you choose to use Eikon Data APIs).