Yahoo Finance Historical Data Scraper

Yahoo Finance Historical Data Scraper

by eraydiler

Easily scrape historical stock prices and volume from Yahoo Finance for multiple tickers and custom date ranges. Perfect for backtesting, financial analysis, and building datasets.

175 runs
13 users
Try This Actor

Opens on Apify.com

About Yahoo Finance Historical Data Scraper

Need historical stock data for your analysis or app? I've been using this Yahoo Finance scraper to pull clean price and volume history for years. It saves you the headache of building and maintaining your own scraper against Yahoo's structure, which can be a real pain when they tweak their layout. You just feed it a list of ticker symbols and specify your date range—whether you need a decade of daily closes or just the last quarter. It handles multiple stocks in a single run, returning structured JSON or CSV with open, high, low, close, adjusted close, and volume data. I use it regularly to backtest trading strategies, populate financial models, and create datasets for machine learning projects. It's reliable, gets the job done without fuss, and lets you focus on your actual work instead of data collection. If you're a developer, analyst, or researcher looking for a straightforward way to get market history, this actor is a solid choice.

What does this actor do?

Yahoo Finance Historical Data Scraper is a web scraping and automation tool available on the Apify platform. It's designed to help you extract data and automate tasks efficiently in the cloud.

Key Features

  • Cloud-based execution - no local setup required
  • Scalable infrastructure for large-scale operations
  • API access for integration with your applications
  • Built-in proxy rotation and anti-blocking measures
  • Scheduled runs and webhooks for automation

How to Use

  1. Click "Try This Actor" to open it on Apify
  2. Create a free Apify account if you don't have one
  3. Configure the input parameters as needed
  4. Run the actor and download your results

Documentation

Yahoo Finance Historical Data Scraper

This Apify actor scrapes daily historical stock data from Yahoo Finance for one or more ticker symbols over a specified period.

Overview

The actor fetches daily stock metrics—Open, High, Low, Close, Adjusted Close, and Volume—for given ticker symbols. It outputs structured JSON records to an Apify dataset, with each record tagged by its symbol for easy identification. You can run it locally or on the Apify platform.

Key Features

  • Fetches historical daily stock data (Open, High, Low, Close, Adjusted Close, Volume).
  • Supports multiple ticker symbols in a single run.
  • Configurable date range via yearsOfData input (1-50 years).
  • Outputs clean JSON to the default Apify Dataset.
  • Handles common cookie consent pop-ups.

Input

Configure the actor using an INPUT.json file or via the Apify Console/API.

Input fields:
- tickerSymbols (Array of strings, required): Stock ticker symbols (e.g., ["AAPL", "MSFT"]). Default is ["^GSPC"].
- yearsOfData (Integer, required): Number of years of historical data to fetch. Min: 1, Max: 50. Default is 1.

Example INPUT.json:

{
  "tickerSymbols": ["MSFT", "GOOG"],
  "yearsOfData": 3
}

Output

Results are stored in the Apify dataset. Each item is a JSON object for one day of data.

Example output item:

{
  "date": "May 30, 2025",
  "open": 170.50,
  "high": 172.30,
  "low": 170.10,
  "close": 171.95,
  "adjClose": 171.95,
  "volume": 25000000,
  "symbol": "AAPL"
}

Output fields: date, open, high, low, close, adjClose, volume, symbol.

How to Use

Running Locally

  1. Ensure Node.js and npm are installed.
  2. Clone the project and install dependencies: npm install.
  3. Optionally, place your INPUT.json file at apify_storage/key_value_stores/default/INPUT.json.
  4. Run the actor: apify run (use apify run --purge to clear previous storage).

Running on Apify Platform

  1. Push the actor to your Apify account: apify push.
  2. On the platform, find your actor and click "Run".
  3. Provide input parameters in the "Input" tab.
  4. Start the run. Results will be available in the run's "Dataset" tab, downloadable as JSON, CSV, Excel, etc.

Limitations

  • Relies on Yahoo Finance's website structure; significant changes may break the actor.
  • Fetching long periods (e.g., 30+ years) for multiple tickers can increase run time and resource use.
  • Does not handle pagination if Yahoo Finance changes its data loading method.
  • Cookie consent handling is based on common selectors; major changes to Yahoo's consent mechanism may require updates.

Support

For issues or suggestions, open an issue on GitHub or contact eray.diler@gmail.com.

Common Use Cases

Market Research

Gather competitive intelligence and market data

Lead Generation

Extract contact information for sales outreach

Price Monitoring

Track competitor pricing and product changes

Content Aggregation

Collect and organize content from multiple sources

Ready to Get Started?

Try Yahoo Finance Historical Data Scraper now on Apify. Free tier available with no credit card required.

Start Free Trial

Actor Information

Developer
eraydiler
Pricing
Paid
Total Runs
175
Active Users
13
Apify Platform

Apify provides a cloud platform for web scraping, data extraction, and automation. Build and run web scrapers in the cloud.

Learn more about Apify

Need Professional Help?

Couldn't solve your problem? Hire a verified specialist on Fiverr to get it done quickly and professionally.

Find a Specialist

Trusted by millions | Money-back guarantee | 24/7 Support