Skip to main content

A python wrapper around the PerformanceAnalytics R code.

Project description

pyformanceanalytics

PyPi

A python wrapper around the Econometrics PerformanceAnalytics R package.

Dependencies :globe_with_meridians:

Python 3.11.6:

R 4.3.2:

Raison D'être :thought_balloon:

PerformanceAnalytics is an outstanding Econometrics library written in R that has been battle tested by many quantitative finance firms. We have a need to use this alongside some machine learning we are doing in python, so to bridge the gap we created this wrapper library. The library very closely follows the conventions laid out in PerformanceAnalytics, for example to determine information ratio you can simply use the following code:

from pyformanceanalytics import InformationRatio

inf_rat_flt = InformationRatio(df)

The functions and modules are designed to be as close to the PerformanceAnalytics package as possible for easy porting.

Installation :inbox_tray:

This is a python package hosted on pypi, so to install simply run the following command:

pip install pyformanceanalytics

Note that upon running this package for the first time, you may notice a slight delay as it downloads the relevant R packages.

Usage example :eyes:

To get familiar with the individual functions and charts check out the documents in the pyformanceanalytics README. This library ports over 100 functions, 20 charts and 20 tables.

This supports both tables, functions and charts. An example of generating a chart:

import pandas as pd
from pyformanceanalytics.charts import PerformanceSummary

df = pd.read_csv("pyformanceanalytics/managers.csv", index_col=0)
df.index = pd.to_datetime(df.index)
PerformanceSummary(df).show()

PerformanceSummary

This outputs a PIL image, which automatically shows on colab instances.

You can feed in multiple portfolios to get your results in a DataFrame, else they may be reported as single floats.

License :memo:

The project is available under the GPL2 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyformanceanalytics-0.0.5.tar.gz (91.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page