A Python powered library for calculating semi-analytic credit portfolio loss metrics
Project description
portfolioAnalytics
portfolioAnalytics is a Python powered library for the calculation of semi-analytic approximations to portfolio credit models
Author: Open Risk
License: Apache 2.0
Code Documentation: Read The Docs
Mathematical Documentation: Open Risk Manual
Training: Open Risk Academy
Development Website: Github
Functionality
You can use portfolioAnalytics to create semi-analytic loss distributions for a variety of stylized credit portfolios. The library provides semi-analytical functions useful for testing the accuracy of credit portfolio simulation models. The basic formulas are reasonably simple and well known: They underpin the calculation of RWA (risk weighted assets), and in turn required capital, thus ensuring stability for the entire banking systems worldwide. You can also use the library to estimate transition thresholds for stochastic processes
NB: portfolioAnalytics is still in active development. If you encounter issues please raise them in our github repository
Vasicek Portfolio Models Library
Dependencies: scipy, sympy
Portfolio Model Examples
Check the jupyter notebooks and python scripts
Current Functions
vasicek_base
vasicek_base_el
vasicek_base_ul
vasicek_lim
vasicek_lim_el
vasicek_lim_ul
vasicek_lim_q
The Vasicek Base family produces finite pool loss probabilities and measures (EL, UL)
The Vasicek Lim family produces asymptotic pool loss probabities and measures (EL, UL, Quantile)
Limitations
The portfolioAnalytics library provides a range of powerful modelling functionalities that are are of relevance in real credit portfolio management activities. Yet achieving the tractability and usability of a semi-analytic calculation suite is not without some tradeoffs. Several simplifications are made (extensively documented in the Mathematical Documentation). Those simplifications imply that when using the portfolioAnalytics models to assess the risk in actual portfolios it is important to assess
Installation
You can install and use the portfolioAnalytics package in any system that supports the Scipy ecosystem of tools
Dependencies
portfolioAnalytics requires Python 3
the thresholds module depends on the Open Risk transitionMatrix and correlationMatrix libraries
It depends on numerical and data processing Python libraries (Numpy, Scipy, Pandas)
The Visualization API depends on Matplotlib
The precise dependencies are listed in the requirements.txt file.
portfolioAnalytics may work with earlier versions of these packages but this has not been tested
From PyPi
pip3 install pandas
pip3 install matplotlib
pip3 install portfolioAnalytics
From sources
Download the sources to your preferred directory:
git clone https://github.com/open-risk/portfolioAnalytics
Using virtualenv
It is advisable to install the package in a virtualenv so as not to interfere with your system’s python distribution
virtualenv -p python3 tm_test
source tm_test/bin/activate
If you do not have pandas already installed make sure you install it first (will also install numpy)
pip3 install pandas
pip3 install matplotlib
pip3 install -r requirements.txt
Finally issue the install command and you are ready to go!
python3 setup.py install
File structure
The distribution has the following structure:
Testing Framework
It is a good idea to run the test-suite. Before you get started:
Adjust the source directory path in portfolioAnalytics/__init__ and then issue the following in at the root of the distribution
Unzip the data files in the datasets directory
python3 test.py
Getting Started
Check the Examples pages in this documentation
Look at the examples directory for a variety of typical workflows.
For more in depth study, the Open Risk Academy has courses elaborating on the use of the library
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file creditPortfolioAnalytics-0.4.tar.gz
.
File metadata
- Download URL: creditPortfolioAnalytics-0.4.tar.gz
- Upload date:
- Size: 148.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.8.0 tqdm/4.51.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d4c8af43395890159693c868e966fe518b06f7a30c78dd65b8eb8bd95e34c6b |
|
MD5 | 012fcabfd4db8bf0b69ca1121c78fb46 |
|
BLAKE2b-256 | 7f2e23336a5d58e0a0bcdb9c28e9295c11b0248e5105151452a992c165827130 |
File details
Details for the file creditPortfolioAnalytics-0.4-py2.py3-none-any.whl
.
File metadata
- Download URL: creditPortfolioAnalytics-0.4-py2.py3-none-any.whl
- Upload date:
- Size: 81.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.8.0 tqdm/4.51.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba410d8dae4792a5aacce03f67a96694d4fc56b83a02defa694c9b797fbf74da |
|
MD5 | 3d17437e2a5fb3989ebb87b846c467f2 |
|
BLAKE2b-256 | 31b6c1ec1b33e010196a2e8fe86e8f3a4c10026216668638c583ffc20844d631 |