Yahoo Finance API Python Client

Extract Yahoo Finance data with our Yahoo Finance API Python client. Get programmatic access to stock quotes, historical prices, price targets, earnings dates, analyst recommendations, dividends, fund data, and more using simple Python code. Start free, no credit card required.

POWERING THE WORLD'S TOP DATA-DRIVEN TEAMS

Integrate our Yahoo Finance API

The Apify API client for Python is the official library that allows you to use Yahoo Finance API in Python, providing convenience functions and automatic retries on errors. Get started with simple pip installation and robust error handling built-in.

Python

Python

1from apify_client import ApifyClient
2
3# Initialize the ApifyClient with your Apify API token
4# Replace '<YOUR_API_TOKEN>' with your token.
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7# Prepare the Actor input
8run_input = {
9 "tickers": [
10 "MSFT",
11 "AMZN",
12 ],
13 "proxy": { "useApifyProxy": True },
14}
15
16# Run the Actor and wait for it to finish
17run = client.actor("canadesk/yahoo-finance").call(run_input=run_input)
18
19# Fetch and print Actor results from the run's dataset (if there are any)
20print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
21for item in client.dataset(run["defaultDatasetId"]).iterate_items():
22 print(item)
23
24# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

Get data with Yahoo Finance API Python client

Use our Python API client to extract Yahoo Finance data by providing ticker symbols with your configured filters and parameters. The API returns structured data, including stock quotes, historical prices, price targets, earnings dates, analyst recommendations, dividends, fund data, and more, which is perfect for pandas DataFrames, data analysis, and Python applications.

Input

{
"delay": 3,
"proxy": {
"useApifyProxy": true
},
"period": "1y",
"process": "gh",
"tickers": [
"MSFT"
],
"interval": "1d",
"rounding": "max",
"storecsv": "no"
}

Output

[
{
"data": [
{
"low": "312.55394893846466",
"Date": "2023-10-05",
"high": "317.59611925564633",
"open": "316.7127353294032",
"close": "316.980712890625",
"volume": "16965600"
}
],
"type": "history",
"ticker": "MSFT"
}
]

How to use Yahoo Finance API

1Sign up for Apify account

Creating an account is quick and free — no credit card required. Your account gives you access to more than 5,000 scrapers and APIs.

Get started for free

2Install Apify Python client

Install the Apify Python client using pip: pip install apify-client. This package provides a simple interface to interact with Yahoo Finance API from your Python applications.


3Get your Apify API token

Go to settings in the Apify console and navigate to the “API & Integrations” tab. There, create a new token and save it for later.


4Integrate Yahoo Finance API

Navigate to the Yahoo Finance API page and click on the API dropdown menu in the top right corner. In the dropdown menu, you can see API clients, API endpoints, and more. Use the provided Python code examples to integrate Yahoo Finance API into your Python application.

Open Yahoo Finance Python API

5Get your Yahoo Finance data via API

The Yahoo Finance API returns structured JSON data that works perfectly with pandas, NumPy, and other Python data analysis libraries.

Why use Apify?

Never get blocked

Every plan (free included) comes with Apify Proxy, which is great for avoiding blocking and giving you access to geo-specific content.

Customers love us

We truly care about the satisfaction of our users and thanks to that we're one of the best-rated data extraction platforms on both G2 and Capterra.

Monitor your runs

With our latest monitoring features, you always have immediate access to valuable insights on the status of your web scraping tasks.

Export to various formats

Your datasets can be exported to any format that suits your data workflow, including Excel, CSV, JSON, XML, HTML table, JSONL, and RSS.

Integrate Apify to your workflow

You can integrate your Apify runs with platforms such as Zapier, Make, Keboola, Google Drive, or GitHub. Connect with practically any cloud service or web app.

Large developer community

Apify is built by developers, so you'll be in good hands if you have any technical questions. Our Discord server is always here to help!

Frequently asked questions

Yahoo Finance does not offer an official API for public use. However, we provide our own unofficial Yahoo Finance API that gets all the up-to-date financial data you need, serving as an alternative to access Yahoo Finance information programmatically for your projects and applications.

Yes, you can try our Yahoo Finance API for free! No credit card required, no strings attached. Just create an Apify account with free $5 monthly prepaid usage, get your API token, and start using the Yahoo Finance API.

Yahoo Finance API allows you to get data such as stock quotes with open/high/low/close prices, historical data with customizable periods and intervals, company information and profiles, analyst recommendations and price targets, earnings dates and schedules, fund and ETF data, dividend information, financial news articles, and volume data with formatted dates for comprehensive financial analysis.

Getting started with our Yahoo Finance API is easy — simply create a free Apify account, get your API token, and start using the Yahoo Finance API in Python, JavaScript, CLI, cURL, OpenAPI, or MCP.

Get started with Yahoo Finance API Python client today

Get your first Yahoo Finance data in Python in less than 5 minutes. No credit card required. No commitment. Cancel anytime.