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. With Yahoo Finance, you can get that information quickly in the frequency and period of time you need. If you choose, you can get daily data from today’s date to when the company first went public.

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

Download historical data from Yahoo Finance

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

From your computer

Follow these steps to download historical data from the Yahoo Finance website to your computer:

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

The file is automatically saved to your download folder and is ready 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 parameters “Time period”, “Data to display” and “Frequency”.
  6. Tap “Apply” and “Download” to save the data to your phone.

Follow the steps below to download historical data from Yahoo Finance to your mobile:

Once the download is complete, the file is ready to use. You will need 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.

Download historical data from the API

Yahoo Finance allowed users to download historical data through an API. The API was discontinued in 2017. However, there are still unofficial APIs that do the same job. If you use any of these APIs, be aware that they may violate Yahoo’s Terms of Service.

Below is the sample code that you could have used in the Yahoo Finance API that still works 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 stock ticker
  • start_date: date when data starts in mm/dd/yyyy . format
  • end_date: date on which the data ends in mm/dd/yyyy . format
  • index_as_date: True, False. The default value is True. The data of the records is set as index. If false, the dates return in a separate column.
  • Interval: Time period to sample data. “1d” = daily; “1wk” = weekly; “1mo” = monthly

Download historical data from Yahoo Finance API

Once you’ve determined what your arguments will be, you can build your code. Below is sample 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 you’re done, copy the code into the API and run it.

Please note that because the APIs are unofficial, they may not return all data or provide inaccurate data. Since the Yahoo Finance API is defunct, there is no way to improve it.

Download historical data from Yahoo Finance for use with Excel

The Yahoo Finance website allows you to download historical data to a CSV. You can then open this data in Excel and reformat it, including changing the file type.

From your computer

Follow the instructions below to download historical data from Yahoo Finance to Excel on your computer:

  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 on ‘Historical data’.
  4. Adjust the parameters “Time period”, “Show data” and “Frequency”.
  5. Click “Apply” and then “Download” to save the data as CSV.

The data is automatically downloaded to your computer as a CSV. You can open the dataset and change “Save As” in an Excel worksheet.

From your mobile device

Follow these steps to download historical data from Yahoo Finance to Excel on your mobile:

  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 parameters “Time period”, “Show data” and “Frequency”.
  6. Tap “Apply” and then “Download” to save the data as CSV.

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

Yahoo Finance: Quick History

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

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

Be the first to comment

Leave a Reply

Your email address will not be published.


*