Use Yahoo Finance Market Data & Fundamentals Scraper with Python
Pull live quotes, historical OHLCV candles, financial statements, dividends, splits, news, analyst ratings and holder data from Yahoo Finance for any ticker, ETF, index, currency pair or crypto symbol.
1. Choose the data you need
Review the published README for supported collection modes, examples, and limits. The recipe below uses the current published input definition.
2. Prepare a source-based input
This JSON contains published prefills and required-field defaults. Review every value for your task before running it; it is not a promise of successful collection.
{
"concurrency": 1,
"includeAnalystPriceTargets": false,
"includeDividends": false,
"includeEarningsCalendar": false,
"includeEarningsEstimates": false,
"includeEarningsHistory": false,
"includeFinancials": false,
"includeFundData": false,
"includeHistory": false,
"includeHolders": false,
"includeInsiders": false,
"includeInsights": false,
"includeNews": false,
"includeOptions": false,
"includePrePost": false,
"includeQuarterlyFinancials": false,
"includeRecommendations": false,
"includeRelatedSymbols": false,
"includeSecFilings": false,
"includeSplits": false,
"includeUpgradesDowngrades": false,
"interval": "1d",
"language": "en-US",
"maxNews": 10,
"maxOptionContracts": 50,
"maxResults": 1,
"maxSearchResults": 10,
"mode": "tickers",
"optionContractType": "both",
"optionExpirations": 1,
"range": "5d",
"region": "US",
"screenerId": "day_gainers",
"screenerSort": "intradaymarketcap",
"searchQuery": "Apple",
"tickers": [
"AAPL"
]
}
Download input.example.json and save your reviewed copy as input.json.
| Field | Type | Required | Description |
|---|---|---|---|
mode | string | required | What to scrape. |
tickers | array | optional | Symbols or Yahoo Finance quote URLs (mode=tickers). Examples: `AAPL`, `BRK.B`, `^GSPC`, `EURUSD=X`, `BTC-USD`, `7203.T`, `https://finance.yahoo.com/quote/AAPL/`. |
searchQuery | string | optional | Company, fund, index, currency or crypto name to search for (mode=search). |
maxSearchResults | integer | optional | Maximum number of search results to return (mode=search). |
screenerId | string | optional | Yahoo predefined screener to run (mode=screener). Predefined screeners are US-centric; use mode=customScreener for a region-aware list. |
screenerSort | string | optional | Sort field for mode=customScreener. |
region | string | optional | Yahoo market region used for quotes, search, trending, localization and mode=customScreener. |
language | string | optional | Language used for names, news and localized labels. |
range | string | optional | History range used when no start/end dates are supplied (mode=tickers). |
startDate | string | optional | Earliest date for historical bars (`YYYY-MM-DD`). Overrides `range` (mode=tickers). |
endDate | string | optional | Latest date for historical bars (`YYYY-MM-DD`). Overrides `range` (mode=tickers). |
interval | string | optional | Candle interval. Intraday intervals have shorter Yahoo range limits; incompatible combinations are clamped and reported in the run status. |
includePrePost | boolean | optional | Include extended-hours bars for intraday history. |
includeHistory | boolean | optional | Include historical bars with adjusted close. |
includeDividends | boolean | optional | Include the full dividend history from Yahoo chart events. |
includeSplits | boolean | optional | Include stock-split history with numerator and denominator. |
includeNews | boolean | optional | Include ticker-related news headlines. |
maxNews | integer | optional | Maximum news items per ticker. Yahoo's news graph serves 200+ items through cursor pagination; the actor caps this request at 200. |
includeFinancials | boolean | optional | Include annual income statement, balance sheet and cash-flow statement. |
includeQuarterlyFinancials | boolean | optional | Add quarterly statements under `financials.quarterly`. Takes effect only when `includeFinancials` is also on. |
includeHolders | boolean | optional | Include institutional, mutual-fund, major-holder and insider-holder summaries. |
includeInsiders | boolean | optional | Include insider transactions, insider holders and net share-purchase activity. |
includeOptions | boolean | optional | Include option chains for optionable symbols. |
optionExpirations | integer | optional | How many upcoming option expirations to fetch (mode=tickers, includeOptions=true). |
maxOptionContracts | integer | optional | Maximum calls and maximum puts per expiration. |
optionContractType | string | optional | Which option sides to return. |
minStrike | number | optional | Drop option contracts below this strike. |
maxStrike | number | optional | Drop option contracts above this strike. |
minVolume | integer | optional | Drop option contracts below this volume. Contracts with no volume are excluded when this is set. |
minOpenInterest | integer | optional | Drop option contracts below this open interest. Contracts with no open interest are excluded when this is set. |
minImpliedVolatilityPercent | number | optional | Drop contracts below this implied volatility in percent, e.g. 25 means 25%. |
includeRecommendations | boolean | optional | Include the analyst recommendation summary and four-period recommendation trend. |
includeUpgradesDowngrades | boolean | optional | Include the latest analyst rating changes. |
includeAnalystPriceTargets | boolean | optional | Include the analyst price-target summary. |
includeEarningsHistory | boolean | optional | Include recent quarters with EPS actual, estimate, difference and surprise. |
includeEarningsEstimates | boolean | optional | Include EPS and revenue estimates plus growth estimates. |
includeEarningsCalendar | boolean | optional | Include upcoming earnings dates, estimates and dividend dates. |
includeFundData | boolean | optional | Include fund profile, top holdings and performance for ETFs and mutual funds. |
includeSecFilings | boolean | optional | Include recent SEC filings with EDGAR links and exhibits. |
includeInsights | boolean | optional | Include technical outlook, research reports and significant developments. |
includeRelatedSymbols | boolean | optional | Include Yahoo's related-symbol recommendations. |
maxResults | integer | optional | Maximum records for screener, customScreener, trending and marketSummary modes. Search uses maxSearchResults. |
concurrency | integer | optional | Number of tickers fetched in parallel (mode=tickers). |
3. Start an Actor run
Set APIFY_TOKEN in your environment. Python 3.10 or newer is sufficient; this recipe uses no third-party packages.
Execution may incur charges. Review current pricing on Apify. The request asks for a 120-second timeout and a charge limit; these settings are subject to Apify’s pricing and do not guarantee an all-inclusive spending cap.
import json
import os
import urllib.request
# Save the schema-derived example as input.json; review and edit it first.
with open("input.json", encoding="utf-8") as stream:
actor_input = json.load(stream)
token = os.environ["APIFY_TOKEN"]
request = urllib.request.Request(
"https://api.apify.com/v2/acts/pKSuSrtPEecMXeM4a/runs?timeout=120&maxTotalChargeUsd=0.50",
data=json.dumps(actor_input).encode("utf-8"),
headers={"Authorization": "Bearer " + token, "Content-Type": "application/json"},
method="POST",
)
# This starts a potentially billable run. Do not automatically retry this POST.
with urllib.request.urlopen(request, timeout=40) as response:
run = json.load(response)["data"]
print("Run ID:", run["id"])
print("Status:", run["status"])
# Inspect and download results in Apify Console once the run succeeds.
4. Inspect the actual results
Open the run in Apify Console and wait for a successful completion. Use the published output schema to locate results and the dataset schema to understand declared views. Missing or optional record fields must not be treated as guaranteed values.
Dataset with ticker quotes (including US post-market fields), OHLCV history, expanded financial statements, dividends, splits, up to 200 news items, analyst and earnings data, holders, options, fund data with bond ratings and sector weights, SEC filings, insights, search results, custom and predefined screener rows, trending symbols and market summary rows.
Questions before you run
Which inputs are required?
The published required fields are mode
What does this guide verify?
The fields, prefills, and schema links are rendered from the published build. This is a usage recipe, not a paid live extraction test. Source availability and collection results can vary.
What if the run request times out?
Check Apify Console before retrying. The first request may already have created a run. Do not automatically repeat a run-creation POST.
Generated from source build z23J6rGwf21tmdpCT and its README and schemas. Source changes regenerate this guide; no third-party editorial claims are inferred.