# Yahoo Finance Scraper - Stocks & Financials (`antishock/yahoo-finance-stock-data-scraper`) Actor

Extract stock market data from Yahoo Finance for a list of tickers: current price, change and percent change, currency, exchange, 52-week high and low, dividend yield, OHLCV history over a chosen range and interval, dividend history and recent news. For portfolio tracking and market research.

- **URL**: https://apify.com/antishock/yahoo-finance-stock-data-scraper.md
- **Developed by:** [Ryan Zinburg](https://apify.com/antishock) (community)
- **Categories:** Other, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 result scrapeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Yahoo Finance Scraper - Quotes, OHLCV History & Dividends

Extract market data for a list of tickers from **Yahoo Finance**: the current quote, the historical price series, dividends and recent news, all in one row per instrument.

### What you get per ticker

| Field | Example |
|---|---|
| `ticker`, `name` | AAPL, Apple Inc. |
| `price`, `change`, `changePercent` | current quote and move |
| `currency`, `exchange` | USD, NasdaqGS |
| `quoteType` | EQUITY, ETF, INDEX, CRYPTOCURRENCY |
| `52w_high`, `52w_low` | annual range |
| `dividend_yield` | trailing yield |
| `ohlcv` | historical open, high, low, close and volume series |
| `dividends` | dividend payment history |
| `news` | recent headlines for the instrument |
| `regularMarketTime` | timestamp of the quote |
| `source`, `sourceUrls` | provenance |

### Input

- **tickers** - the symbols to fetch, e.g. `["AAPL", "MSFT", "BTC-USD", "^GSPC"]`
- **modules** - which blocks to include, for example history, dividends or news
- **historyRange** - how far back, e.g. `1mo`, `1y`, `5y`, `max`
- **historyInterval** - granularity, e.g. `1d`, `1wk`, `1mo`
- **maxResults** - cap on how many tickers to process

### Example input

```json
{
  "tickers": ["AAPL", "MSFT", "NVDA"],
  "historyRange": "1y",
  "historyInterval": "1d"
}
```

### Use cases

- **Portfolio tracking** - refresh quotes and history for a holdings list on a schedule
- **Backtesting and quantitative research** - pull clean OHLCV series for a basket of instruments
- **Dividend income planning** - export payment histories and trailing yields
- **Market dashboards** - feed a spreadsheet or BI tool without a paid market data subscription
- **Comparative analysis** - fetch the same range and interval across instruments so series line up
- **News monitoring** - collect headlines per instrument alongside the price move

### Coverage beyond equities

Yahoo's symbol space covers far more than US stocks: ETFs, indices such as `^GSPC`, currency pairs such as `EURUSD=X`, commodities and crypto such as `BTC-USD` all work in the same request. That makes a single run enough to build a mixed-asset dashboard.

### Notes

- `ohlcv` and `dividends` grow quickly with long ranges. Use `1wk` or `1mo` intervals for multi-year pulls unless you specifically need daily bars.
- Quotes are delayed, as Yahoo's public data always is. This is a research and tracking source, not a trading feed.
- Yahoo adjusts historical prices for splits and dividends, so a series pulled today can differ slightly from one pulled last year.
- Data is provided for personal and research use; check Yahoo's terms before redistributing it commercially.

# Actor input Schema

## `tickers` (type: `array`):

Stock ticker symbols to scrape, e.g. AAPL, MSFT, GOOGL.

## `modules` (type: `array`):

Data modules to include in every output item.

## `historyRange` (type: `string`):

Yahoo chart range for OHLCV history.

## `historyInterval` (type: `string`):

Yahoo chart interval for OHLCV history.

## `maxResults` (type: `integer`):

Maximum number of ticker result items to store.

## Actor input object example

```json
{
  "tickers": [
    "AAPL",
    "MSFT"
  ],
  "modules": [
    "quote",
    "ohlcv",
    "dividends",
    "keyStats"
  ],
  "historyRange": "1y",
  "historyInterval": "1d",
  "maxResults": 100
}
```

# Actor output Schema

## `results` (type: `string`):

Scraped records in the default dataset.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "tickers": [
        "AAPL",
        "MSFT"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("antishock/yahoo-finance-stock-data-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "tickers": [
        "AAPL",
        "MSFT",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("antishock/yahoo-finance-stock-data-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "tickers": [
    "AAPL",
    "MSFT"
  ]
}' |
apify call antishock/yahoo-finance-stock-data-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,antishock/yahoo-finance-stock-data-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/mEqgQrKJHRahEYpY7/builds/qM0X6MtxKaVUxZHDk/openapi.json
