Yahoo Finance

Get stock prices, quotes, fundamentals, earnings, options, dividends, and analyst ratings using

Yahoo Finance is a community skill for financial market data retrieval, covering stock prices and quotes, fundamental financial data, earnings reports, options data, dividend information, and analyst ratings for investment research and analysis.

What Is This?

Overview

Yahoo Finance provides AI agents with access to comprehensive financial market data through the yfinance library without requiring API keys. It covers stock price retrieval that fetches real-time and historical quotes including open, high, low, close, and volume data, fundamental data that provides company financials like revenue, earnings, assets, and debt from balance sheets and income statements, earnings reports that show quarterly and annual earnings per share with consensus estimates, options data that lists available contracts with strikes, expiration dates, and Greeks for options trading, and dividend information that tracks payout history and yield calculations. The skill also supports analyst ratings and price targets, giving users a broader picture of market sentiment. It helps investors and analysts access market data programmatically without managing complex data pipelines.

Who Should Use This

This skill serves financial application developers building comprehensive investment analysis tools, AI agents providing real-time market insights and portfolio performance analysis, and quantitative researchers conducting backtesting studies and systematic strategy development. It is also well suited for individual investors who want to automate routine data gathering tasks.

Why Use It?

Problems It Solves

Accessing financial market data typically requires paid API subscriptions and complex authentication setup. Manually collecting stock prices, fundamentals, and earnings data from multiple sources is time-consuming and error-prone. Building investment analysis tools requires parsing different data formats and handling missing or delayed data points. Creating portfolio tracking and alert systems involves continuous polling and state management infrastructure. Yahoo Finance consolidates these varied data needs into a single, consistent interface that significantly reduces development overhead.

Core Highlights

Price fetcher retrieves real-time and historical stock quotes with volume data. Fundamentals reader extracts financial statements and company metrics. Earnings tracker shows quarterly results with analyst estimates. Options scanner lists contracts with pricing and Greeks data.

How to Use It?

Basic Usage

import yfinance as yf

ticker = yf.Ticker('AAPL')

info = ticker.info
print(
    f'Price: '
    f'{info["currentPrice"]}')

hist = ticker.history(
    period='1mo')
print(
    hist[['Close', 'Volume']])

print(
    f'Market Cap: '
    f'{info["marketCap"]}')
print(
    f'P/E Ratio: '
    f'{info.get("trailingPE")}')

Real-World Examples

ticker = yf.Ticker('MSFT')

balance = \
    ticker.balance_sheet
print('Total Assets:')
print(
    balance.loc[
        'Total Assets'])

income = \
    ticker.financials
print('Total Revenue:')
print(
    income.loc[
        'Total Revenue'])

earnings = \
    ticker.earnings
print(earnings)

divs = ticker.dividends
print(
    f'Recent dividends:'
    f'\n{divs.tail()}')

opts = ticker.option_chain(
    ticker.options[0])
print('Call options:')
print(
    opts.calls[[
        'strike',
        'lastPrice']])

Advanced Tips

Use the download function to fetch data for multiple tickers simultaneously with improved performance. Set the period parameter to max for complete historical data when conducting long-term backtests. Cache frequently accessed data locally to reduce API load and improve response times for repeated queries. When working with options chains, always verify expiration dates are valid before requesting contract data to avoid unnecessary errors.

When to Use It?

Use Cases

Build a stock screening tool that filters companies based on fundamental metrics like P/E ratio and revenue growth. Create portfolio tracking applications that monitor positions with real-time price updates and performance metrics. Develop quantitative trading strategies that backtest historical price data with technical indicators. You can also use this skill to generate automated earnings summaries or dividend income reports for a watchlist of securities.

Related Topics

Financial APIs, stock market data, investment research, portfolio management, quantitative analysis, and trading automation.

Important Notes

Requirements

Python with the yfinance library installed via pip for accessing Yahoo Finance data. Network access to Yahoo Finance servers for fetching real-time and historical market data. No API key or authentication required since yfinance uses public Yahoo Finance endpoints.

Usage Recommendations

Do: implement caching for frequently accessed data to reduce API load and improve performance. Handle missing data gracefully since not all tickers have complete fundamental or options information. Use batch downloads for multiple tickers to optimize network usage and processing time.

Don't: rely on Yahoo Finance data for professional trading decisions without verifying from official sources. Assume real-time data accuracy since there may be delays of several minutes. Make excessive requests in tight loops since this may trigger rate limiting.

Limitations

Yahoo Finance data may have delays of up to 15 minutes for real-time quotes depending on exchange rules. The service occasionally experiences outages or changes data formats without notice, breaking existing code. Some international stocks and less liquid securities may have incomplete or missing data in the system. It is advisable to build error handling and fallback logic into any production application that depends on this data source.