Python financial data libraries

Updated Nov 2026

Python financial data libraries pull stock prices, crypto quotes, economic series, and company fundamentals into Python code. A client wraps a market data API or exchange feed and returns each series as a DataFrame or typed records. These libraries let trading bots, research notebooks, and AI agents work from current and historical market data.

Popularity

yfinance has the most monthly downloads in this comparison, at 17.0M.

LibraryMonthly downloadsStarsLast releaseLicense
yfinance
17.0M
25.9KNov 2026Apache-2.0
CCXT
2.7M
44.9KNov 2026MIT
Databento
1.4M
314Nov 2026Apache-2.0
Alpaca-py
1.4M
1.6KNov 2026Apache-2.0
AKShare
1.2M
23.4KNov 2026MIT
fredapi
1.1M
1.7KMay 2024Apache-2.0
wbdata
981.7K
214Oct 2025GPL-2.0
ib_async
769.2K
1.8KDec 2025BSD-2-Clause
Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Libraries and code examples

Retrieves market data, ticker information, and financial statements from Yahoo Finance.

Downloads / mo
17.0M
Stars
25.9K
Last release
1.8.0
License
Apache-2.0

Strengths

  • Downloads several tickers together. Retrieve market data for a list of ticker symbols.
  • Combines prices and financial statements. Use a Ticker for price history and quarterly income statements.

Limitations

  • Intraday history has limited retention. Use another source when intraday data must extend beyond the retained window.
  • Prices adjust automatically by default. Disable auto_adjust when the workflow requires unadjusted price columns.

Quickstart

From yfinance.md
$ pip install yfinance
import yfinance as yf
dat = yf.Ticker("MSFT")
dat.history(period='1mo')

yfinance examples

From open-source projects on GitHub

Trades and reads market data on more than 100 cryptocurrency exchanges through one API.

Downloads / mo
2.7M
Stars
44.9K
Last release
4.5.93
License
MIT

Quickstart

From README.md
$ pip install ccxt
import ccxt
exchange = ccxt.kraken()
exchange.fetch_ticker('BTC/USD')

CCXT examples

From open-source projects on GitHub

Provides the official Python client for Databento.

Downloads / mo
1.4M
Stars
314
Last release
0.90.0
License
Apache-2.0

Quickstart

From README.md
$ pip install -U databento
import databento as db

client = db.Historical('YOUR_API_KEY')
data = client.timeseries.get_range(
    dataset='GLBX.MDP3',
    symbols='ES.FUT',
    stype_in='parent',
    start='2022-06-10T14:30',
    end='2022-06-10T14:40',
)

Databento examples

From open-source projects on GitHub

Provides the official Python SDK for Alpaca APIs.

Downloads / mo
1.4M
Stars
1.6K
Last release
0.45.0
License
Apache-2.0

Quickstart

From README.md
$ pip install alpaca-py
from alpaca.data.historical import CryptoHistoricalDataClient
from alpaca.data.requests import CryptoBarsRequest
from alpaca.data.timeframe import TimeFrame
from datetime import datetime

# no keys required for crypto data
client = CryptoHistoricalDataClient()

request_params = CryptoBarsRequest(
                        symbol_or_symbols=["BTC/USD", "ETH/USD"],
                        timeframe=TimeFrame.Day,
                        start=datetime(2022, 7, 1)
                 )

bars = client.get_crypto_bars(request_params)

Alpaca-py examples

From open-source projects on GitHub

Provides a financial data interface library for Python.

Downloads / mo
1.2M
Stars
23.4K
Last release
1.20.65
License
MIT

Quickstart

From tutorial.md
$ pip install akshare --upgrade
import akshare as ak

stock_df = ak.stock_zh_a_hist_tx(
    symbol="sz000001", start_date="20261020", end_date="20261027", adjust="qfq"
)
print(stock_df)

AKShare examples

From open-source projects on GitHub

Retrieves Federal Reserve Economic Data from the St. Louis Fed.

Downloads / mo
1.1M
Stars
1.7K
Last release
0.5.2
License
Apache-2.0

Quickstart

From README.md
$ pip install fredapi
from fredapi import Fred
fred = Fred(api_key='insert api key here')
data = fred.get_series('SP500')

fredapi examples

From open-source projects on GitHub

Accesses World Bank data.

Downloads / mo
981.7K
Stars
214
Last release
1.1.0
License
GPL-2.0

Quickstart

From index.md
$ pip3 install -U wbdata
import wbdata
wbdata.get_sources()

wbdata examples

From open-source projects on GitHub

Provides a sync and async framework for the Interactive Brokers API.

Downloads / mo
769.2K
Stars
1.8K
Last release
2.1.0
License
BSD-2-Clause

Quickstart

From README.md
$ pip install ib_async
from ib_async import *
# util.startLoop()  # uncomment this line when in a notebook

ib = IB()
ib.connect('127.0.0.1', 7497, clientId=1)

# Request historical data
contract = Forex('EURUSD')
bars = ib.reqHistoricalData(
    contract, endDateTime='', durationStr='30 D',
    barSizeSetting='1 hour', whatToShow='MIDPOINT', useRTH=True)

# Convert to pandas dataframe (pandas needs to be installed):
df = util.df(bars)
print(df.head())

ib.disconnect()

FAQ

yfinance suits research on stock prices and fundamentals from Yahoo Finance. CCXT suits cryptocurrency exchanges through one unified API. Databento and Alpaca-py suit licensed historical and live market data.

yfinance retrieves market data, ticker information, and financial statements from Yahoo Finance. The code license of the library and the terms for using the data are separate.

Databento is the official Python client for the Databento market data service. Historical data and live streams use separate clients, and each needs an API key and dataset permissions.

AKShare is a financial data interface library that returns pandas DataFrames from many sources, including Chinese equity, ETF, and macroeconomic series.

CCXT is a cryptocurrency trading API that covers many exchanges through one interface. It fetches market data and candles where an exchange supports them, and its Pro version adds WebSocket streams.

For coding agents

Found your financial data library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official