# Yahoo Finance Scraper - Stock Quotes, Fundamentals & History (`sumitr_mardy/yahoo-finance-scraper`) Actor

Yahoo Finance scraper, $1 per 1,000 tickers: price, change, volume, market cap, P/E, EPS, dividends, margins, analyst targets, sector, profile and optional price history for stocks, ETFs, indices and crypto. No API key.

- **URL**: https://apify.com/sumitr_mardy/yahoo-finance-scraper.md
- **Developed by:** [Sumitr Mardy](https://apify.com/sumitr_mardy) (community)
- **Categories:** Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.70 / 1,000 ticker quotes

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 - Stock Quotes, Fundamentals & History

Get Yahoo Finance data for any list of tickers: **price, change, volume, market cap, P/E, EPS, dividends, margins, cash flow, analyst price targets and recommendation, sector, industry, employees and company profile**, plus optional **price history** (daily, weekly or monthly OHLC with adjusted close and volume) for any date range.

Works for **stocks on every exchange Yahoo covers** (AAPL, VOD.L, SAP.DE, 7203.T, 0700.HK, RELIANCE.NS…), **ETFs** (SPY), **indices** (^GSPC), **crypto** (BTC-USD), **currencies** (EURUSD=X) and **futures** (GC=F).

**$1 per 1,000 tickers**, and **$1 per 1,000 for price history, whatever its length**: ten years of daily bars costs the same as one month. Unknown tickers are free. No API key, no login.

### What you get

One row per ticker, the same keys on every row:

| Group | Fields |
|---|---|
| Identity | `symbol`, `name`, `type` (EQUITY, ETF, INDEX, CRYPTOCURRENCY, CURRENCY, FUTURE), `exchange`, `currency`, `marketState`, `marketTime` |
| Trading | `price`, `change`, `changePercent`, `previousClose`, `open`, `dayLow`, `dayHigh`, `volume`, `averageVolume`, `fiftyTwoWeekLow`, `fiftyTwoWeekHigh`, `fiftyDayAverage`, `twoHundredDayAverage` |
| Valuation | `marketCap`, `enterpriseValue`, `peRatio`, `forwardPE`, `eps`, `forwardEps`, `pegRatio`, `priceToBook`, `priceToSales`, `beta` |
| Dividends & shares | `dividendRate`, `dividendYield`, `exDividendDate`, `payoutRatio`, `sharesOutstanding`, `floatShares`, `shortPercentOfFloat`, `heldPercentInsiders`, `heldPercentInstitutions` |
| Financials | `revenue`, `revenueGrowth`, `grossMargins`, `operatingMargins`, `profitMargins`, `ebitda`, `freeCashflow`, `totalCash`, `totalDebt`, `debtToEquity`, `returnOnEquity` |
| Analysts | `targetMeanPrice`, `targetHighPrice`, `targetLowPrice`, `recommendation`, `analystCount`, `nextEarningsDate` |
| Profile | `sector`, `industry`, `employees`, `website`, `country`, `city`, `description` |
| Funds & crypto | `fundFamily`, `fundCategory`, `expenseRatio`, `totalAssets`, `circulatingSupply` |
| History | `history`: `[{date, open, high, low, close, adjClose, volume}]`, oldest first; `historyFetched` |
| Run | `url`, `status` (`ok`, `not_found`, `failed`, `invalid_input`), `scrapedAt` |

Numbers are `null` when Yahoo has no value for that instrument (an index has no P/E). Ratios, yields, margins and `changePercent` are fractions: `0.0031` means 0.31%.

Measured on a 43-ticker run: stocks fill nearly every field; ETFs, crypto, indices, currencies and futures fill the trading fields and leave company-only fields (P/E, margins, profile) empty.

### How to use it

- **Ticker symbols**: one per line, as Yahoo writes them (search the ticker on finance.yahoo.com if unsure). A Yahoo quote URL works too. Duplicates are skipped.
- **Include price history**: on to add the `history` array.
- **History from / to**: date range (default: the last 12 months).
- **History interval**: daily, weekly or monthly bars.

### Pricing

Pay per event, cheaper on higher Apify plans:

| Event | Price | When |
|---|---|---|
| `quote` | $0.001 | every ticker returned |
| `price-history` | $0.001 | per ticker, only when the history was read, any number of bars |

Unknown tickers, failures and invalid inputs are free. Apify adds its standard tiny start event per run. The run stops cleanly at your *Max cost per run*.

### Speed

Measured on Apify at 256 MB: 3 tickers in 4 seconds; 40 tickers with two years of daily history in 66 seconds.

### Honest limits

- Prices are what Yahoo Finance shows on its public pages: real time for some markets, delayed (usually 15–20 minutes) for others. `marketTime` tells you when the price was set.
- No intraday (minute) bars, options chains, full financial statements or news in this version.
- Use the data in line with Yahoo's terms. Not investment advice.

### Use it from AI agents (MCP)

Hosted, with OAuth sign-in:

```json
{
    "mcpServers": {
        "yahoo-finance": {
            "url": "https://mcp.apify.com/?tools=sumitr_mardy/yahoo-finance-scraper"
        }
    }
}
```

With an API token instead of OAuth:

```json
{
    "mcpServers": {
        "yahoo-finance": {
            "url": "https://mcp.apify.com/?tools=sumitr_mardy/yahoo-finance-scraper",
            "headers": { "Authorization": "Bearer YOUR_APIFY_TOKEN" }
        }
    }
}
```

Local stdio:

```json
{
    "mcpServers": {
        "yahoo-finance": {
            "command": "npx",
            "args": ["-y", "@apify/actors-mcp-server", "--actors", "sumitr_mardy/yahoo-finance-scraper"],
            "env": { "APIFY_TOKEN": "YOUR_APIFY_TOKEN" }
        }
    }
}
```

Agent tip: ask for quotes only (`includeHistory: false`) unless the question needs past prices; use monthly bars for long ranges.

### Run it from code

Python:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("sumitr_mardy/yahoo-finance-scraper").call(run_input={
    "symbols": ["AAPL", "MSFT", "NVDA"],
    "includeHistory": True,
    "historyStart": "2024-01-01",
    "historyInterval": "1wk",
})
for q in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(q["symbol"], q["price"], q["peRatio"], len(q["history"]))
```

cURL (waits for the run and returns the rows):

```bash
curl -X POST "https://api.apify.com/v2/acts/sumitr_mardy~yahoo-finance-scraper/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"symbols":["SPY","^GSPC","BTC-USD"]}'
```

### FAQ

**How far back does history go?** As far as Yahoo has it: decades for large stocks (monthly bars from 2010 tested for AAPL).

**Can I track a watchlist every day?** Schedule the actor and connect the dataset to Google Sheets or a webhook.

**Why is a field `null`?** Yahoo does not publish it for that instrument, for example P/E for an index or employees for crypto.

# Actor input Schema

## `symbols` (type: `array`):

Yahoo Finance symbols, one per line: stocks (AAPL, VOD.L, 7203.T), ETFs (SPY), indices (^GSPC), crypto (BTC-USD), currencies (EURUSD=X), futures (GC=F). A finance.yahoo.com quote URL also works.

## `includeHistory` (type: `boolean`):

Add daily, weekly or monthly open/high/low/close/adjusted close/volume bars for the date range below (one extra page per ticker).

## `historyStart` (type: `string`):

Start date of the price history (YYYY-MM-DD). Default: one year ago.

## `historyEnd` (type: `string`):

End date of the price history (YYYY-MM-DD). Default: today.

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

One bar per day, week or month.

## Actor input object example

```json
{
  "symbols": [
    "AAPL",
    "MSFT",
    "BTC-USD"
  ],
  "includeHistory": false,
  "historyInterval": "1d"
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

# 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 = {
    "symbols": [
        "AAPL",
        "MSFT",
        "BTC-USD"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("sumitr_mardy/yahoo-finance-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 = { "symbols": [
        "AAPL",
        "MSFT",
        "BTC-USD",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("sumitr_mardy/yahoo-finance-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 '{
  "symbols": [
    "AAPL",
    "MSFT",
    "BTC-USD"
  ]
}' |
apify call sumitr_mardy/yahoo-finance-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,sumitr_mardy/yahoo-finance-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/YY8zKn4erq2QvGa6F/builds/VbJBMmvmySyxLls6t/openapi.json
