If you're looking for an API that can provide you with financial data, Yahoo Finance is a great option. The Yahoo Finance API offers access to a wide range of data, including stock quotes, historical prices, company information, and more.
This makes it the perfect choice for businesses and developers who need to incorporate financial data into their applications or websites. In this article, we'll take a closer look at what the SyncWith Yahoo Finance API has to offer. We'll discuss its features and how you can put it to use in your own projects
What We’ll Cover
Overview of the different endpoints
Sample queries
Sample results
Ability to live test the API right in this webpage
That’s right - as an example here’s the quoteSummary/{symbol} endpoint being called - feel free to change the symbol and see what the API endpoint sends back including the raw JSON with the View raw data toggle.
Try It Out
Please fill in any necessary fields and click Run.
GET
Preview
View the API data, get a live Google Sheet dashboard
Current Price
Target - High Price
Target - Low Price
Recommendation
# Analyst Opinions
numberOfAnalystOpinions.longFmt
Total Cash
Cash per Share
EBITDA
Total Debt
Total Revenue
debtToEquity
revenuePerShare
Gross Profit
Free Cash Flow
Revenue Growth
Gross Margins
Get a live Google Sheet
Export your data to a google sheet, with the Crypto Coin Tracker Addon, or download to CSV
Automatically updated
Schedule your data to update hourly or daily
Add data sources
Import additional data from other apps
Build reports & dashboards
Easily build live reports within Google Sheets
Just Want Yahoo Finance Data sync’d?
We get a lot of people asking us if there is a way to not have to call the API directly, fortunately all the live example’s use SyncWith’s technology which is available for Google Sheets, Excel and Airtable. If you just want your yahoo finance data sync’d you can use our addons to do that easily.
Want to call the API directly yourself, lets dig into it:
An Introduction to the Yahoo Finance API
Before we get into its uses, let's break down the specifics of the Yahoo Finance API.
What is the Yahoo Finance API?
The Yahoo Finance API is a RESTful API that provides access to financial data. This data includes stock quotes, historical prices, and company information. The API is free to use and does not require an API key.
The Yahoo Finance API is available in both JSON and XML format. This makes it easy to integrate the data into your applications or websites. You can also access the API through a number of third-party libraries.
What is Yahoo Finance?
Yahoo Finance is a website that provides financial news, data, and analysis. The site also includes a stock ticker and portfolio tracker. Yahoo Finance is one of the most popular finance websites on the internet.
Features of the Yahoo Finance API
One of the most useful features of the Yahoo Finance API is its ability to return historical price data for stocks. This data goes back as far as 1962 and is available for all US stocks and ETFs.
In addition to stock data, the Yahoo Finance API also provides access to currency exchange rates, futures contracts, and market indices.
What Data is Available?
The Yahoo Finance API provides access to a wide range of data, including:
Stock prices
Company information
News headlines
Financial reports
Currency exchange rates
Futures contracts
Market indices
To access this data, you will need to sign up for a free Yahoo Finance API key. Once you have your key, you can start making requests to the API.
Pros of using the Yahoo Finance API
There are a number of benefits to using the Yahoo Finance API, including:
It's free to use (for individuals)
It's well-documented
It has a wide range of data available
Cons of using the Yahoo Finance API
There are also a few drawbacks to using the Yahoo Finance API, including:
The data is only updated once per day
The data is delayed by 15 minutes
Despite its drawbacks, the Yahoo Finance API is still a valuable tool for developers working on finance-related applications. The wide range of data available makes it an essential part of any financial application.
Is it Actually Free?
The Yahoo Finance API is free to use for personal projects. However, commercial usage of the API requires a paid subscription. This means that developers working on commercial projects will need to pay for a Yahoo Finance API subscription.
How is the Data Updated?
The Yahoo Finance API is updated once per day. This means that developers will need to use other data sources if they want real-time data.
Data you can retrieve from the Yahoo Finance API
As we've already mentioned, there is a huge range of data that you can get from the Yahoo Finance API. To give you some idea of the functionality, we'll be breaking down some of the most popular features.
Getting Details About a Stock
Retrieving stock details is one of the most popular uses for the Yahoo Finance API. The following example shows how you can get information about Google stock:
Using the endpoint:
https://query1.finance.yahoo.com/v10/finance/quoteSummary/{symbol}?modules={csv of modules}
Available Modules
The modules query parameter takes a csv of the various modules you’d like. The modules available are:
The following modules are available:
assetProfile - The assetProfile object contains general information about the company, such as industry, fullTimeEmployees, and website and is useful for getting an overview of the company's assets.
defaultKeyStatistics - The defaultKeyStatistics object contains information about a company's stock. This is useful for getting an idea of a company's stock.
recommendationTrend - recommendationTrend object contains information about analyst recommendations. This is useful for getting an idea of whether a stock is being bought or sold by analysts.
financialData - The financialData object contains information about a company's financial situation. This is useful for getting an idea of a company's financial situation.
majorHoldersBreakdown - The majorHoldersBreakdown object contains information about the top holders of a stock. This is useful for getting an idea of who is buying or selling a stock.
earnings - The earnings object contains information about a company's earnings. This is useful for getting an idea of a company's profitability.
earningsHistory - The earningsHistory object contains information about a company's earnings history. This is useful for getting an idea of a company's past profitability.
earningsTrend - The earningsTrend object contains information about a company's earnings trend. This is useful for getting an idea of a company's current and future profitability.
indexTrend - The indexTrend object contains information about the direction of a stock market index. This is useful for getting an idea of the overall direction of the market.
industryTrend - The industryTrend object contains information about the direction of an industry. This is useful for getting an idea of the overall direction of an industry.
netSharePurchaseActivity - The netSharePurchaseActivity object contains information about the net share purchase activity of a company. This is useful for getting an idea of the overall direction of a company's stock.
sectorTrend -The sectorTrend object contains information about the direction of a stock market sector. This is useful for getting an idea of the overall direction of a particular stock market sector.
insiderHolders - The insiderHolders object contains information about the insider holders of a company's stock. This is useful for getting an idea of who owns a company's stock.
upgradeDowngradeHistory - The upgradeDowngradeHistory object contains information about the upgrades and downgrades that analysts have given a company's stock. This is useful for getting an idea of analyst opinion on a company's stock
Example 1: Apple’s Earnings History
The query will have the form: https://query1.finance.yahoo.com/v10/finance/quoteSummary/{symbol} ?modules={modules}
So for Apple's earnings we get (cut and paste into a browser to see what Yahoo returns):
Takes the query parameter metrics, of which you can specify the following values (multiple values must be comma separated)
The metrics returned include:
Date - The date metric returns the date of the stock price. This is used for indexing the DataFrame.
High - The high metric returns the highest price of the stock for that day. This is used for computing the percent change.
Low - The low metric returns the lowest price of the stock for that day. This is used for computing the percent change.
Open - The open metric returns the opening price of the stock for that day. This is used for computing the percent change
Close - The close metric returns the closing price of the stock for that day. This is used for computing the percent change.
Volume - The volume metric returns the number of shares traded for that day. This is used for computing the average daily trading volume.
Adj Close - The adjusted close metric returns the closing price of the stock for that day, adjusted for splits and dividends. This is used for computing the percent change.
Currency - The currency metric returns the stock price in US dollars. This is used for computing the percent change.
InstrumentType - instrumentType shows whether the stock is equity, index, currency, or commodity. This is used for filtering the data.
Available Query Parameters
There are five adjustable parameters that can be used to get different results.
interval - The time interval between two data points. Can be 1m2m5m15m30m60m90m1h1d5d1wk1mo3mo
range - The range for which the data is returned. Can be "max" or "previous".
period1 - UNIX timestamp representation of the date you wish to start
at
period2 - UNIX timestamp representation of the date you wish to end
at
close - Adjusts the price type to be returned. valid values are adjusted and unadjusted
events=div%7Csplit - will include dividends and splits
includePrePost which takes true or false
Using these additional parameters will help you fine-tune your requests to get the data that you need. For example, to get the last five years of Google stock price with one row per day, you would change the parameters to:
Example: Apple's High stock price for the last 5d days
The query will have the form: https://query1.finance.yahoo.com/v8/finance/chart/aapl?metrics=high?&interval=1d&range=5d you can see the 4 additions to the base URL
aapl
range=5d
Interval=1d
metrics=high
So for Apple's High stock price for the day we get (cut and paste into a browser to see what Yahoo returns)
Provides information on a single stock ticker. The {symbol} is the stock ticker you are interested in. For example, to get information about Google, use GOOG.
This endpoint returns a CSV. The full list of columns is:
Date - The date of the observation
Open - The opening price of the stock for the day
High - The highest price of the stock for the day
Low - The lowest price of the stock for the day
Close - The closing price of the stock for the day
Adj Close - An adjusted close. Prices are already adjusted for splits, the "Adjusted Close" price is further adjusted for dividends.
Volume - How many shares traded hands during the interval
Available Query Parameters
There are five adjustable parameters that can be used to get different results.
interval - The time interval between two data points. Can be 1m2m5m15m30m60m90m1h1d5d1wk1mo3mo
period1 - UNIX timestamp representation of the date you wish to start
at
period2 - UNIX timestamp representation of the date you wish to end
at
You will get essentially the same results as the /v10/finance/quoteSummary/{symbol} endpoint mentioned above
Will provide you with advanced details on a stock, including:
A summary of the stock - open, close, high, low
A dividend summary - ex-date, payment date, amount
An earnings summary - EPS estimate for current year and next year, actual EPS for last four quarters
An earnings report - includes actual EPS, surprise, and fiscal period
A financial data summary - includes shares outstanding, float, beta, and more
A list of major holders - includes institutional holders and mutual fund ownership
A list of major holders changes - includes net and percent change in holdings
Analyst recommendations - includes current rating and target price
Modules
This endpoint requires the modules query parameter to specify what information you want returned back. The modules query parameter takes a csv of the various modules you’d like. The modules available are:
The following modules are available:
assetProfile - The assetProfile object contains general information about the company, such as industry, fullTimeEmployees, and website and is useful for getting an overview of the company's assets.
defaultKeyStatistics - The defaultKeyStatistics object contains information about a company's stock. This is useful for getting an idea of a company's stock.
recommendationTrend - recommendationTrend object contains information about analyst recommendations. This is useful for getting an idea of whether a stock is being bought or sold by analysts.
financialData - The financialData object contains information about a company's financial situation. This is useful for getting an idea of a company's financial situation.
majorHoldersBreakdown - The majorHoldersBreakdown object contains information about the top holders of a stock. This is useful for getting an idea of who is buying or selling a stock.
earnings - The earnings object contains information about a company's earnings. This is useful for getting an idea of a company's profitability.
earningsHistory - The earningsHistory object contains information about a company's earnings history. This is useful for getting an idea of a company's past profitability.
earningsTrend - The earningsTrend object contains information about a company's earnings trend. This is useful for getting an idea of a company's current and future profitability.
indexTrend - The indexTrend object contains information about the direction of a stock market index. This is useful for getting an idea of the overall direction of the market.
industryTrend - The industryTrend object contains information about the direction of an industry. This is useful for getting an idea of the overall direction of an industry.
netSharePurchaseActivity - The netSharePurchaseActivity object contains information about the net share purchase activity of a company. This is useful for getting an idea of the overall direction of a company's stock.
sectorTrend -The sectorTrend object contains information about the direction of a stock market sector. This is useful for getting an idea of the overall direction of a particular stock market sector.
insiderHolders - The insiderHolders object contains information about the insider holders of a company's stock. This is useful for getting an idea of who owns a company's stock.
upgradeDowngradeHistory - The upgradeDowngradeHistory object contains information about the upgrades and downgrades that analysts have given a company's stock. This is useful for getting an idea of analyst opinion on a company's stock
To get started, simply make a GET request to the endpoint, specifying the ticker symbol for the stock you're interested in. For example, to get details on Apple Inc.'s stock (AAPL), use:
{
"quoteSummary":{
"result":[
{
"assetProfile":{
"address1":"One Apple Park Way",
"city":"Cupertino",
"state":"CA",
"zip":"95014",
"country":"United States",
"phone":"408 996 1010",
"website":"https://www.apple.com",
"industry":"Consumer Electronics",
"sector":"Technology",
"longBusinessSummary":"Apple Inc. designs, manufactures, and markets smartphones, personal computers, tablets, wearables, and accessories worldwide. It also sells various related services. In addition, the company offers iPhone, a line of smartphones; Mac, a line of personal computers; iPad, a line of multi-purpose tablets; AirPods Max, an over-ear wireless headphone; and wearables, home, and accessories comprising AirPods, Apple TV, Apple Watch, Beats products, HomePod, and iPod touch. Further, it provides AppleCare support services; cloud services store services; and operates various platforms, including the App Store that allow customers to discover and download applications and digital content, such as books, music, video, games, and podcasts. Additionally, the company offers various services, such as Apple Arcade, a game subscription service; Apple Music, which offers users a curated listening experience with on-demand radio stations; Apple News+, a subscription news and magazine service; Apple TV+, which offers exclusive original content; Apple Card, a co-branded credit card; and Apple Pay, a cashless payment service, as well as licenses its intellectual property. The company serves consumers, and small and mid-sized businesses; and the education, enterprise, and government markets. It distributes third-party applications for its products through the App Store. The company also sells its products through its retail and online stores, and direct sales force; and third-party cellular network carriers, wholesalers, retailers, and resellers. Apple Inc. was incorporated in 1977 and is headquartered in Cupertino, California.",
"fullTimeEmployees":154000,
"companyOfficers":[
{
"maxAge":1,
"name":"Mr. Timothy D. Cook",
"age":60,
"title":"CEO & Director",
"yearBorn":1961,
"fiscalYear":2021,
"totalPay":{
"raw":16386559,
"fmt":"16.39M",
"longFmt":"16,386,559"
},
"exercisedValue":{
"raw":0,
"fmt":null,
"longFmt":"0"
},
"unexercisedValue":{
"raw":0,
"fmt":null,
"longFmt":"0"
}
},
{
"maxAge":1,
"name":"Mr. Luca Maestri",
"age":57,
"title":"CFO & Sr. VP",
"yearBorn":1964,
"fiscalYear":2021,
"totalPay":{
"raw":5018883,
"fmt":"5.02M",
"longFmt":"5,018,883"
},
"exercisedValue":{
"raw":0,
"fmt":null,
"longFmt":"0"
},
"unexercisedValue":{
"raw":0,
"fmt":null,
"longFmt":"0"
}
},
{
"maxAge":1,
"name":"Mr. Jeffrey E. Williams",
"age":57,
"title":"Chief Operating Officer",
"yearBorn":1964,
"fiscalYear":2021,
"totalPay":{
"raw":5017437,
"fmt":"5.02M",
"longFmt":"5,017,437"
},
"exercisedValue":{
"raw":0,
"fmt":null,
"longFmt":"0"
},
"unexercisedValue":{
"raw":0,
"fmt":null,
"longFmt":"0"
}
},
{
"maxAge":1,
"name":"Ms. Katherine L. Adams",
"age":57,
"title":"Sr. VP, Gen. Counsel & Sec.",
"yearBorn":1964,
"fiscalYear":2021,
"totalPay":{
"raw":5014533,
"fmt":"5.01M",
"longFmt":"5,014,533"
},
"exercisedValue":{
"raw":0,
"fmt":null,
"longFmt":"0"
},
"unexercisedValue":{
"raw":0,
"fmt":null,
"longFmt":"0"
}
},
{
"maxAge":1,
"name":"Ms. Deirdre O'Brien",
"age":54,
"title":"Sr. VP of People & Retail",
"yearBorn":1967,
"fiscalYear":2021,
"totalPay":{
"raw":5061191,
"fmt":"5.06M",
"longFmt":"5,061,191"
},
"exercisedValue":{
"raw":0,
"fmt":null,
"longFmt":"0"
},
"unexercisedValue":{
"raw":0,
"fmt":null,
"longFmt":"0"
}
},
{
"maxAge":1,
"name":"Mr. Chris Kondo",
"title":"Sr. Director of Corp. Accounting",
"exercisedValue":{
"raw":0,
"fmt":null,
"longFmt":"0"
},
"unexercisedValue":{
"raw":0,
"fmt":null,
"longFmt":"0"
}
},
{
"maxAge":1,
"name":"Mr. James Wilson",
"title":"Chief Technology Officer",
"exercisedValue":{
"raw":0,
"fmt":null,
"longFmt":"0"
},
"unexercisedValue":{
"raw":0,
"fmt":null,
"longFmt":"0"
}
},
{
"maxAge":1,
"name":"Ms. Mary Demby",
"title":"Chief Information Officer",
"exercisedValue":{
"raw":0,
"fmt":null,
"longFmt":"0"
},
"unexercisedValue":{
"raw":0,
"fmt":null,
"longFmt":"0"
}
},
{
"maxAge":1,
"name":"Ms. Nancy Paxton",
"title":"Sr. Director of Investor Relations & Treasury",
"exercisedValue":{
"raw":0,
"fmt":null,
"longFmt":"0"
},
"unexercisedValue":{
"raw":0,
"fmt":null,
"longFmt":"0"
}
},
{
"maxAge":1,
"name":"Mr. Greg Joswiak",
"title":"Sr. VP of Worldwide Marketing",
"exercisedValue":{
"raw":0,
"fmt":null,
"longFmt":"0"
},
"unexercisedValue":{
"raw":0,
"fmt":null,
"longFmt":"0"
}
}
],
"auditRisk":2,
"boardRisk":1,
"compensationRisk":9,
"shareHolderRightsRisk":1,
"overallRisk":2,
"governanceEpochDate":1656633600,
"compensationAsOfEpochDate":1640908800,
"maxAge":86400
}
}
],
"error":null
}
}
Now if you switch the modules query param to be ?modules=financialData you get the following response for AAPL:
Please fill in any necessary fields and click Run.
GET
Preview
View the API data, get a live Google Sheet dashboard
maxAge
currentPrice
targetHighPrice
targetLowPrice
targetMeanPrice
targetMedianPrice
recommendationMean
recommendationKey
numberOfAnalystOpinions
totalCash
totalCashPerShare
ebitda
totalDebt
quickRatio
currentRatio
totalRevenue
debtToEquity
revenuePerShare
returnOnAssets
returnOnEquity
grossProfits
freeCashflow
operatingCashflow
earningsGrowth
revenueGrowth
grossMargins
ebitdaMargins
operatingMargins
profitMargins
financialCurrency
Get a live Google Sheet
Export your data to a google sheet, with the Crypto Coin Tracker Addon, or download to CSV
Automatically updated
Schedule your data to update hourly or daily
Add data sources
Import additional data from other apps
Build reports & dashboards
Easily build live reports within Google Sheets
This endpoint is great at getting the kind of information is critical for making sound investment decisions because it gives you an idea of what others in the market think about a particular stock. It also helps you track how sentiment around a stock has changed over time.
Options include stocks, indexes, and ETFs. For stocks, the parameter should be the stock ticker. For indexes, the parameter should be the index symbol. For ETFs, the parameter should be the ETF ticker.
Try it Out
options
Please fill in any necessary fields and click Run.
GET
Preview
View the API data, get a live Google Sheet dashboard
result.underlyingSymbol
result.expirationDates
result.strikes
result.hasMiniOptions
result.quote
result.options
error
Get a live Google Sheet
Export your data to a google sheet, with the Crypto Coin Tracker Addon, or download to CSV
will search Yahoo for relevant equities, news articles lists and navigation options and return tthem to you you. This is done with the q query parameter.
For instance if we search for berkshire hathaway we get:
A bunch of Berkshirt Hathaway listings across different classes and exchanges:
Please fill in any necessary fields and click Run.
GET
Preview
View the API data, get a live Google Sheet dashboard
explains
count
quotes
news
nav
lists
researchReports
screenerFieldResults
totalTime
timeTakenForQuotes
timeTakenForNews
timeTakenForAlgowatchlist
timeTakenForPredefinedScreener
timeTakenForCrunchbase
timeTakenForNav
timeTakenForResearchReports
timeTakenForScreenerField
timeTakenForCulturalAssets
Get a live Google Sheet
Export your data to a google sheet, with the Crypto Coin Tracker Addon, or download to CSV
Automatically updated
Schedule your data to update hourly or daily
Add data sources
Import additional data from other apps
Build reports & dashboards
Easily build live reports within Google Sheets
Summary of Yahoo Finance API Data Quality
The Yahoo Finance API data quality is quite good overall. However, there are a few things to be aware of.
First, the data is only as good as the underlying data that Yahoo! Finance has. So, if there is an error in the original source data, it will be reflected in the API data.
Second, the API doesn't always have the most up-to-date information. For example, if a company files its quarterly results after market close, the API data will still reflect the last closing price until Yahoo! Finance updates its records.
Finally, while most of the fields are well-documented, some of them are not. This can make it difficult to know what certain fields represent or how to use them.
Despite these limitations, the Yahoo! Finance API is still a valuable resource for data-driven investors. With a little bit of know-how, you can use it to get the information you need to make informed investment decisions.
Discussion of Alpha Advantage vs Yahoo Finance API
Alpha Advantage and Yahoo Finance are both popular sources of stock market data. Both have their pros and cons, but which one is the better choice for you?
Alpha Advantage offers more comprehensive data coverage than Yahoo Finance, including global markets and sector-specific data. However, it can be more expensive to access (but offer a free tier), and its documentation can be difficult to understand.
Yahoo Finance offers less comprehensive data than Alpha Advantage, but it is typically easier and cheaper to access. However, its documentation can be difficult to understand, and it does not always provide accurate or up-to-date information.
So which one should you choose? It really depends on your needs. If you need global market data or sector-specific data, then Alpha Advantage is the better choice. However, if you just need basic stock information, then Yahoo Finance might be a better option for you.
Using Yahoo Finance API in Python
Making use of the Yahoo Finance API in Python is easy thanks to the yfinance package. With just a few lines of code, you can get the data you need from Yahoo Finance.
To use the Yahoo Finance API in Python, we first have to install the yfinance package. We can do this by running the following command in the terminal: pip install finance.
Once we have installed the yfinance package, it can be made use of using Python code. We start by importing it into the code: import yfinance as yf.
We then use the download method to fetch data from Yahoo Finance: data = yf.download("AAPL", start="2020-01-01", end="2020-04-30").
This will return a pandas dataframe with the data from Apple for the specified date range.
We can then access this data in our code by using the column names of the dataframe. For example, we can access the close price of Apple stock by using the following code: df["Close"].plot().
This will plot the close price of AAPL over time.
As you can see, it is very easy to get started with the Yahoo Finance API in Python thanks to yfinance.
Yahoo Finance API Alternatives
There are a number of alternatives to the Yahoo Finance API that provide similar functionality.
Morning Star - Morning Star offers an Excel Add-In that allows you to access their data directly from Excel.
Quandl - Quandl is a provider of alternative data sets. They offer a Python package that makes it easy to get started with their data.
Twelve Data - Twelve Data is an alternative data provider that offers a Python SDK to access their data.
Fidelity Investment - Fidelity Investments is a provider of financial data and services. They offer an API to access their data.
Finnhub - Finnhub is a provider of financial data and services. They offer an API to access their data.
Trending Finance - Trending Finance acts as a provider of financial news and analysis. They offer an API to access their data.
IEX Cloud - IEX Cloud is a provider of financial data and services. They offer an API to access their data.