explaingit

ranaroussi/yfinance

Analysis updated 2026-05-18

23,430PythonAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

Python library that downloads stock prices, company financials, and market data from Yahoo Finance with a simple, easy-to-use interface.

Mindmap

mindmap
  root((yfinance))
    What it does
      Download stock prices
      Fetch company financials
      Stream live updates
      Get market data
    How to use it
      Simple Python interface
      Works with pandas
      Install via pip
      One-liner queries
    Use cases
      Investment research
      Backtest strategies
      Build analysis tools
      Academic studies
    Tech stack
      Python
      pandas
      WebSocket
      Yahoo Finance API
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Download historical stock prices and analyze them in Python for personal investment decisions.

USE CASE 2

Backtest trading strategies by fetching years of price data and running simulations.

USE CASE 3

Build a financial dashboard that pulls live company earnings, balance sheets, and market data.

USE CASE 4

Conduct academic research on stock market trends using clean, pandas-ready historical data.

What is it built with?

PythonpandasWebSocket

How does it compare?

ranaroussi/yfinancevanna-ai/vannahkuds/deeptutor
Stars23,43023,38623,486
LanguagePythonPythonPython
Setup difficultyeasymoderatehard
Complexity2/53/54/5
Audiencedeveloperpm founderdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min
Use freely for any purpose including commercial. Keep the notice and disclose changes to the patent grant.

In plain English

yfinance is a Python library that lets you download financial and market data from Yahoo Finance. The problem it solves is access: Yahoo Finance has a wealth of stock prices, historical data, company financials, and market information, but getting that data into a Python program for analysis or research normally requires navigating complex APIs. yfinance wraps those APIs into a simple, Pythonic interface, meaning it follows Python's conventions for how code should look and behave. With yfinance you can fetch historical price data for a single stock or multiple tickers at once, get company information like earnings and balance sheets, retrieve sector and industry data, search for quotes and news, and even stream live price updates via a WebSocket connection (a type of persistent connection that pushes updates in real time). The data comes back in a format compatible with pandas, the popular Python data-analysis library, making it ready for immediate analysis, charting, or feeding into financial models. You would use this for personal investment research, building financial analysis tools, backtesting trading strategies, or academic work involving stock market data. It is intended for research and educational use only, Yahoo Finance's own terms limit the API to personal use, and yfinance is not affiliated with or endorsed by Yahoo. The library is installed via pip and works with Python 2.7 and Python 3.6 or later.

Copy-paste prompts

Prompt 1
Show me how to use yfinance to download the last 5 years of Apple stock prices and calculate the average monthly return.
Prompt 2
Write a Python script using yfinance that fetches earnings data and balance sheet info for multiple stocks at once.
Prompt 3
How do I set up yfinance to stream live stock price updates for a watchlist of tickers?
Prompt 4
Use yfinance to backtest a simple moving-average crossover strategy on historical S&P 500 data.
Prompt 5
Show me how to get sector and industry data for a stock using yfinance and compare it to competitors.

Frequently asked questions

What is yfinance?

Python library that downloads stock prices, company financials, and market data from Yahoo Finance with a simple, easy-to-use interface.

What language is yfinance written in?

Mainly Python. The stack also includes Python, pandas, WebSocket.

What license does yfinance use?

Use freely for any purpose including commercial. Keep the notice and disclose changes to the patent grant.

How hard is yfinance to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is yfinance for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub ranaroussi on gitmyhub

Verify against the repo before relying on details.