ffn - Financial Functions for Python
If you are looking for a full backtesting framework, please check out bt. bt is built atop ffn and makes it easy and fast to backtest quantitative strategies.
Overview
ffn is a library that contains many useful functions for those who work in quantitative finance. It stands on the shoulders of giants (Pandas, Numpy, Scipy, etc.) and provides a vast array of utilities, from performance measurement and evaluation to graphing and common data transformations.
import ffn
returns = ffn.get('aapl,msft,c,gs,ge', provider='yahoo', start='2010-01-01').to_returns().dropna()
print(returns.calc_mean_var_weights().as_format('.2%'))
Example output:
aapl 62.54%
c -0.00%
ge 36.19%
gs -0.00%
msft 1.26%
dtype: object
Installation
The easiest way to install ffn is from the Python Package Index
using pip.
pip install ffn
The Yahoo examples require the optional provider dependency:
pip install 'ffn[yahoo]'
Other providers can be passed as callables or installed as plugins. See how to use a data provider.
Since ffn has many dependencies, we strongly recommend installing the Anaconda Scientific Python Distribution. This distribution comes with many of the required packages pre-installed, including pip. Once Anaconda is installed, the above command should complete the installation.
Documentation
Read the docs at https://pmorissette.github.io/ffn/.
Contribute
See the development guide for setup, tests, documentation builds, and Copier template updates.
Metadata
Release files for ffn 1.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ffn-1.4.1.tar.gz | 44.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ffn-1.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 89.7 kB
Release files / ffn-1.4.1.tar.gz
| Download URL | ffn-1.4.1.tar.gz |
|---|---|
| Size | 44.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
470c02fcd8be8a148b8033e9b80fb10ddd8e2102b18b94135c04492e6319779a
|
|
BLAKE2b-256 checksum How to use checksums |
b9b819ea55a1db388c8f042f5574e0b053b407a30875e42ba0bcf55e11b9c84c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / ffn-1.4.1-py3-none-any.whl
| Download URL | ffn-1.4.1-py3-none-any.whl |
|---|---|
| Size | 45.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3ce7bf828db8e392b8f9b0a11fd74a93c094fe0a7a0d173c9e5f060a12e5f3be
|
|
BLAKE2b-256 checksum How to use checksums |
f57c5645777a1b8ce283f5450eb2c071b4c41d5d02821d0b2b3a5193767c2215
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Security for ffn 1.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.