A python-based application that produces multi-period attribution, contribution, and benchmark-relative ex-post risk statistics.
Project description
portfolio-performance-analytics
portfolio-performance-analytics (ppar) is a python package that produces holdings-based multi-period attribution, contribution, and benchmark-relative ex-post risk statistics.
Table of Contents
Description
portfolio-performance-analytics (ppar) is a python package that produces holdings-based multi-period attribution, contribution, and benchmark-relative ex-post risk statistics. It uses the Brinson-Fachler methodology for calculating attribution effects, and uses the Carino method for logarithmically-smoothing cumulative effects over multi-period time frames.
The inputs required to produce the analytics fall into three categories:
- Periodic "classification-level" weights and returns for a portfolio and its benchmark. A "classification" can be any category such as region, country, economic sector, industry, security, etc. The weights and returns must satisfy the formula: SumOf(weights * returns) = Total Return. They will typically be beginning-of-period weights and period returns. (Required)
- Classification items and descriptions. (Optional)
- Mappings from the classification scheme of the weights and returns to a reporting classification. (Optional)
The input data may be provided directly as either:
- Pandas DataFrames.
- Polars DataFrames.
- Python dictionaries (for Classifications and Mappings).
- csv files.
For sample input data sources, please refer to the python script demo.py and the ppar/demo_data directory. Once the input data has been provided, then the analytics may be requested using different calculation parameters, time-periods, and frequencies:
- Daily (or for whatever data frequency is provided).
- Monthly
- Quarterly
- Yearly
The outputs are represented by different views and charts. See Features below. They may be delivered in different formats:
- csv files
- html strings
- json strings
- Pandas DataFrames
- png files
- Polars DataFrames
- Python "great tables"
- xml strings
Features
The below sample outputs portray a large-cap alpha strategy that has achieved a high active return of 1737 bps over the benchmark. In the total lines of the Economic Sector Attribution reports, you can see that this active return can be broken down into 359 bps in sector allocation and 1378 bps in selecting securities. From the Risk Statistics report, you can see that this has been accomplished with a lower downside probabilty than the benchmark (29% vs 36%), and a higher annualized sharpe ratio than the benchmark (2.02 vs 1.27). The largest contributor to active performance was in the Information Technology Sector. Although the portfolio was slightly under-allocated in the Information Technology sector (by -0.05%), it did an excellent job of selecting securities for a total active contribution of 431 bps in the sector.
- Attribution & Contribution:
- Ex-Post Risk Statistics:
Implementation
Typically, a user will develop their own "data source" functions that provide the data in one of the above formats. The python script "demo.py" has sample data source functions.
Users can also develop their own "presentation layer" using the various output formats as the inputs to their presentation layer.
Installation
pip install ppar
Usage
python demo.py
Technical
Being built on top of Polars dataframes, ppar is able to efficiently process large datasets through parallel processing, vectorization, lazy evaluation, and using Apache Arrow as its underlying data format.
Enhancements
Future enhancements may include:
- Break out the interaction (cross-product) effect. It is currently included in the selection effect.
- Break out the currency effect.
- Break out the long and short sides of each sector.
- Add additional multi-period smoothing algorithms (e.g. Menchero).
- Support time-series of risk-free rates (as opposed to a single annual rate).
- Calculate additional risk statistics.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ppar-0.1.1.tar.gz.
File metadata
- Download URL: ppar-0.1.1.tar.gz
- Upload date:
- Size: 310.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dae5edb8a35b7bb292d13204293a4906e181b2d32187a0f78731539014ee527f
|
|
| MD5 |
18bdac2b7a285c5624de46ab027eee0d
|
|
| BLAKE2b-256 |
0d2215632c27eb5d6f1549acb78c5a9d1fa1d6a4d61cf6555821883218570d02
|
File details
Details for the file ppar-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ppar-0.1.1-py3-none-any.whl
- Upload date:
- Size: 313.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bda2fc5d8c5504d00039b52ab9b917f3e1fb55c7a465056928ad3a8e229dcc9
|
|
| MD5 |
22f1764d7e42e4269aaa431e57db8cf8
|
|
| BLAKE2b-256 |
18242806e505b9c3d599917befa890c8026386b72eae07b691d85ab89d3d2ec5
|