Scrape Yahoo Finance for stocks, ETFs, indexes, crypto and currencies: quotes and key statistics (price, market cap, P/E, dividend, earnings date), price history with adjusted close and dividends, or options chains with bid, ask, open interest, implied volatility, greeks and max pain.
This repository has ready scripts for the Yahoo Finance Scraper: Options Chain, History, Stock Quotes Actor on Apify. The Actor does the fetching, paging and cleaning; the scripts here run it with your input and save the results as a CSV or JSON file.
- Create an Apify account and copy your API token from Console > Settings > Integrations.
- Install the client and run the script with the example input:
pip install "apify-client>=2"
export APIFY_TOKEN=your_token
python run.py input.json -o results.csv --max-items 50Edit input.json for your own run. You can also run the Actor in the browser on its
Apify page, schedule it there, and connect its output to Google Sheets, Slack, Zapier or Make.
The example input (input.json):
{
"tickers": [
"AAPL",
"MSFT",
"NVDA",
"AMZN",
"GOOGL",
"META",
"TSLA",
"SPY",
"QQQ",
"^GSPC",
"BTC-USD",
"EURUSD=X"
],
"maxItems": 20
}| Field | Type | What it does |
|---|---|---|
tickers |
array | Yahoo Finance symbols, one per entry: stocks such as AAPL or BRK-B, ETFs such as SPY, indexes such as ^GSPC, crypto such as BTC-USD, currency pairs such as E... |
dataType |
string | quotes: one row per ticker with price, change, volume and key statistics. |
startDate |
string | First day of the price history as YYYY-MM-DD, for example 2020-01-01. |
endDate |
string | Last day of the price history as YYYY-MM-DD. |
interval |
string | One row per trading day, week or month. |
optionType |
string | Which contracts to return. |
expirations |
integer | How many expiration dates to read per ticker, starting from the nearest one. |
expirationDates |
array | Read these expiration dates instead of the nearest ones, as YYYY-MM-DD, for example 2026-12-18. |
minStrike |
integer | Skip contracts with a lower strike price. |
maxStrike |
integer | Skip contracts with a higher strike price. |
minOpenInterest |
integer | Skip contracts with less open interest. |
minVolume |
integer | Skip contracts that traded fewer contracts today. |
riskFreeRate |
number | Yearly interest rate in percent, such as a Treasury bill yield, used for the greeks, for example 4.25. |
maxItems |
integer | The run stops after this many result rows. |
One row per result. A real row from a run of the example input (more in
examples/sample-output.json):
{
"symbol": "AAPL",
"name": "Apple Inc.",
"quoteType": "EQUITY",
"exchange": "NasdaqGS",
"currency": "USD",
"marketState": "OVERNIGHT",
"price": 350.69,
"change": 8.32001,
"changePercent": 2.43012,
"previousClose": 342.37,
"open": 344.935,
"dayLow": 344.78,
"dayHigh": 352.28,
"fiftyTwoWeekLow": 243.42,
"fiftyTwoWeekHigh": 355.38,
"volume": 47499490,
"averageVolume": 42880493,
"marketCap": 5096291172352,
"trailingPE": 39.05234,
"forwardPE": 33.235027,
"epsTrailing": 8.98,
"dividendRate": 1.08,
"dividendYield": 0.32,
"exDividendDate": "2026-11-12",
"beta": 1.089,
"earningsDate": "2027-01-28",
"targetMeanPrice": 340.4655,
"recommendation": "buy",
"sector": "Technology",
"industry": "Consumer Electronics",
"regularMarketTime": "2026-11-09T21:00:01Z",
"url": "https://finance.yahoo.com/quote/AAPL/",
"scrapedAt": "2026-11-10T02:40:31Z"
}Fields: symbol, name, quoteType, exchange, currency, marketState, price, change, changePercent, previousClose, open, dayLow, dayHigh, fiftyTwoWeekLow, fiftyTwoWeekHigh, volume, averageVolume, marketCap, trailingPE, forwardPE, epsTrailing, dividendRate, dividendYield, exDividendDate, beta, earningsDate, targetMeanPrice, recommendation, sector, industry, regularMarketTime, url, scrapedAt.
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('v0iddo/yahoo-finance-scraper').call({"tickers": ["AAPL", "MSFT", "NVDA", "AMZN", "GOOGL", "META", "TSLA", "SPY", "QQQ", "^GSPC", "BTC-USD", "EURUSD=X"], "maxItems": 20});
const { items } = await client.dataset(run.defaultDatasetId).listItems();Full example: examples/node/run.mjs.
curl -X POST "https://api.apify.com/v2/acts/v0iddo~yahoo-finance-scraper/run-sync-get-dataset-items" \
-H "Authorization: Bearer $APIFY_TOKEN" -H 'Content-Type: application/json' \
-d '{"tickers": ["AAPL", "MSFT", "NVDA", "AMZN", "GOOGL", "META", "TSLA", "SPY", "QQQ", "^GSPC", "BTC-USD", "EURUSD=X"], "maxItems": 20}'The response is the JSON array of results.
The Actor is paid per result: $0.50 per 1,000 results, nothing per run. maxItems caps the rows, and so the cost, of one run. A new Apify account gets $5 of platform credit every month.
MIT for the code in this repository. Made by vøiddo.