Yahoo Finance API

This service is temporarily interrupted.
Visit us soon to see the new instructions …

After the restrictions imposed by Yahoo to avoid downloading historical data, we have fixed the problem and we offer all our users access to our own API in order to download historical quotes with the Yahoo Finance format.

You can customize the download, according to your needs, in this way:

You can change stock, period1, period2, interval and events according to your needs.

The API key needed to be able to download the data is:


Please make moderate use of this service and do not perform massive downloads.

20 thoughts on “Yahoo Finance API

  1. Where can I find information on how to calculate the period1 and period2 and avaialble values for interval and events?

    • period1 and 2 are coded in Universal Time format, which is somewhat
      complicated. It actually means the number of seconds since
      January 1, 1970, which you can figure out quite closely.
      To get the whole history of a stock on this site, you only need
      to bracket the history with period1 and period2; you don’t have to know the actual day of origin of the stock’s history.

      • Would you mind clarifying what you mean by “bracket the history with period1 and period2”? Or provide an example? Trying to download all historical data for a stock, but not having much success. Thanks!

        • Period is the number of seconds since 1/1/1970 which you can figure out. You want all historical data. Therefore choose period1 so it precedes the start of the data. Choose period2 as the present day. What do you do if you don’t know the start of the data? Guess, and choose period1 before that.

          This works, but unfortunately I found that the data for at least some mutual funds and ETFs is not adjusted for distributions, so it’s relatively useless, at least for me.

          • I take that back!! Something has happened and the mutual fund and ETF data does seem to be adjusted. I tested a few that a few days ago were not adjusted. I’ll need to test more thoroughtly, but there is hope! Thanks, Mr. X.

    • Try to use this API from (

      It provides the data in plain CSV, exactly the same format as Yahoo Finance, then it’s easy to switch, just by replacing URLs. And you need no to calculate period1 and period2 manually, just use from and to dates here.

  2. Apologies for last post. It does work and I could get the data.

    Still there is a problem. The adjusted close column is identical with the close column. So, despite the header, there is actually no adjusted close date.

  3. Correction. I tested XOM (Exxon) and adjusted close is there.

    However, FSUTX (Fidelity Select Utilities) has adjusted close
    identical with close. So that needs to be fixed, if possible.

  4. First of all, thank you for your post showing how to resume the downloads. You indicated that stock, period1, period2, and event can be altered to meet requirements. What is the correct entry in the “event” field to allow dividends or stock splits to be downloaded?

  5. The API key today ( above) is different from the previous key. The previous key no longer works. Does this mean that the API key will change periodically? Will we constantly have to alter our code to download data automatically? I hope that is not the case.

  6. I hope this is not the case either. If not, it’ll be good if the new API value can also be put in a dedicated url / location so that we can retrieve it first before calling the data url.

  7. I switched to using this website after the yahoo finance api stopped working. Now this has been “temporarily interrupted”. I’m looking for reliable data everyday. Is this service coming back? Will it be reliable in the future?

Leave a Comment