Registry / analytics / ffn
library1.1.5pypypi✓ verified 85d ago

ffn is a library for financial calculations in Python, providing performance analysis, portfolio optimization, and financial charting. Current version 1.1.5 supports Python 3.9+. Maintained, with updates as needed.

pip install ffn
INSTALL
IMPORT
SIG · FFN
F
ffn
analyticspythonv1.1.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ffn
import ffn
Standard import
Performance
from ffn import Performance
For performance analysis

Quick example: download price data, compute returns, and plot performance.

import ffn # Fetch price data ticker = 'AAPL' import yfinance as yf prices = yf.download(ticker, start='2020-01-01', end='2023-01-01')['Adj Close'] # Calculate returns returns = ffn.to_returns(prices) # Plot performance ffn.calc_perf(returns).plot()
Debug
Known issues
deprecatedffn depends on pandas-datareader which is deprecated. Use yfinance or other data sources.
fix
Install yfinance (pip install yfinance) and use it to fetch data instead of pandas-datareader.
affects: all
gotchaThe function ffn.to_returns() expects a pandas Series or DataFrame of prices; it will not work with multi-column DataFrames (e.g., from yfinance without selecting a column).
fix
Ensure to select a single price column (e.g., 'Adj Close') before calling to_returns.
affects: all
breakingffn 1.1.x changed the default plotting backend from matplotlib to plotly. This may break existing code that relies on matplotlib objects.
fix
Use ffn.set_plot_backend('matplotlib') to restore old behavior, or adapt code to work with plotly figures.
affects: >=1.1.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pandas_datareader'
ffn imports pandas_datareader internally but it may not be installed.
fix
pip install pandas-datareader
ValueError: The truth value of a DataFrame is ambiguous. Use a.any() or a.all()
Passing a multi-column DataFrame to ffn functions expecting a single series.
fix
Select a single column (e.g., df['Adj Close']) before passing to ffn.
KeyError: 'Adj Close'
The price data fetched does not contain the expected column name.
fix
Check the data structure; use yfinance with auto_adjust=True or select the correct column (e.g., 'Close').
Upgrade
Version history
1.1.5latest on PyPI · released Mar 24, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
18
OpenAI (training)
1
Resources
ffn — pip install ffn · libregistry