How to Download Historical Data from Yahoo Finance

You will always need to collect historical data on a company’s stock for any financial analysis. Yahoo Finance allows you to quickly retrieve that information in the frequency and period you need. If you choose to, you could retrieve daily details from today’s date to when the company first entered the stock exchange.

How to Download Historical Data from Yahoo Finance

Read the article below to learn how to download historical data from Yahoo Finance.

Downloading Historical Data from Yahoo Finance

Yahoo Finance allows you to download historical data on a company directly from their website. You can quickly retrieve this data without a Yahoo Finance account on your computer or phone.

From Your Computer

To download historical data from the Yahoo Finance website to your computer, follow these steps:

  1. Go to Yahoo Finance.
  2. Enter a quote in the search field and then select the quote to view it.
  3. Click “Historical Data.”
  4. Adjust the “Time Period,” “Data to Show,” and “Frequency” parameters.
  5. Click “Apply” and then “Download” to save the data.

The file will automatically save in your downloads folder and is ready for you to use.

From Your Mobile

  1. Go to Yahoo Finance.
  2. Enter a company name or stock symbol in the “Quote Lookup” field.
  3. Tap the quote in the results to view it.
  4. Slide the menu to the left and select “Historical Data.”
  5. Change the “Time Period,” “Data to Show,” and “Frequency” parameters.
  6. Tap “Apply” and “Download” to save the data to your phone.

To download historical data from Yahoo Finance to your mobile, follow the steps below:

Once the download is complete, the file is ready for you to use. You will have to download a spreadsheet app such as Google Sheets for Android or iOS to analyze the results. You can also use Microsoft Excel for Android or iOS.

Downloading Historical Data from the API

Yahoo Finance allowed users to download historical data via an API. The API was shut down in 2017. However, there are still unofficial APIs that do the same work. If you use one of these APIs, be aware that they can violate Yahoo’s Terms of Service.

Below is the sample code you could have used in the Yahoo Finance API and will still work in the unofficial APIs.

Arguments

Below are the arguments you will use to build the code needed to retrieve historical data from the API:

  • ticker: case insensitive ticker of a stock
  • start_date: date the data begins in format mm/dd/yyyy
  • end_date: date the data ends in format mm/dd/yyyy
  • index_as_date: {True, False}. The default will be True. The dates of the records will be set as the index. If false, the dates return in a separate column.
  • Interval: time period to sample data. “1d” = daily; “1wk” = weekly; “1mo” = monthly

How to Download Historical Data From Yahoo Finance API

Once you’ve established what your arguments will be, you can build your code. Below is an example code for retrieving weekly historical data from Amazon.

from yahoo_fin.stock_info import get_data()

amazon_weekly= get_data("amzn", start_date="12/04/2009", end_date="12/04/2019", index_as_date = True, interval="1wk")

amazon_weekly

You can edit the code to include your preferred arguments, and the API will retrieve your needed historical data. When ready, copy the code into the API and run it.

Be advised that because the APIs are not official, they may not return all of the data or may provide inaccurate data. Since the Yahoo Finance API is defunct, there is no way to improve this.

Downloading Historical Data From Yahoo Finance for Use with Excel

The Yahoo Finance website will allow you to download historical data into a CSV. You can then open this data into Excel and re-format it, including changing the file type.

From Your Computer

To download Yahoo Finance historical data to Excel on your computer, follow the instructions below:

  1. Go to Yahoo Finance.
  2. Type a quote in the search field and select the quote from the search results to view it.
  3. Click “Historical Data.”
  4. Adjust the “Time Period,” “Data to Show,” and “Frequency” parameters.
  5. Click “Apply” and then “Download” to save the data as a CSV.

The data will automatically download to your computer as a CSV. You can open the dataset and change “Save As” into an Excel Worksheet.

From Your Mobile Device

To download Yahoo Finance historical data to Excel on your mobile, follow these steps:

  1. Go to Yahoo Finance.
  2. Find the “Quote Lookup” field, and enter a company name or stock symbol.
  3. Tap the quote in the search results.
  4. Slide the menu to the left and select “Historical Data.”
  5. Adjust the “Time Period,” “Data to Show,” and “Frequency” parameters.
  6. Tap “Apply” and then “Download” to save the data as a CSV.

The data will automatically download to your phone as a CSV. To view or change the file format of the CSV, you will need the Excel app from the Google Play Store for Android devices or the Apple App Store for iPhones.

Yahoo Finance: Quick Histories

Yahoo Finance makes downloading historical data quick and straightforward. You can download the data to your computer or phone to ensure that you have the data you need when you need it most.

Have you downloaded historical data from Yahoo Finance? What method did you use? Let us know all about it in the comments below!

Disclaimer: Some pages on this site may include an affiliate link. This does not effect our editorial in any way.