Package: creditPortfolioAnalytics
portfolioAnalyticsportfolioAnalytics is a Python powered library for the calculation of semi-analytic approximations to portfolio credit modelsAuthor:Open RiskLicense: Apache 2.0Code Documentation:Read The DocsMathematical Documentation:Open Risk ManualTraining:Open Risk AcademyDevelopment Website:GithubFunctionalityYou 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 processesNB: portfolioAnalytics is still in active development. If you encounter issues please raise them in our github repositoryVasicek Portfolio Models LibraryDependencies: scipy, sympyPortfolio Model ExamplesCheck the jupyter notebooks and python scriptsCurrent Functionsvasicek_basevasicek_base_elvasicek_base_ulvasicek_limvasicek_lim_elvasicek_lim_ulvasicek_lim_qThe 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)LimitationsThe 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 assessInstallationYou can install and use the portfolioAnalytics package in any system that supports theScipy ecosystem of toolsDependenciesportfolioAnalytics requires Python 3the thresholds module depends on the Open Risk transitionMatrix and correlationMatrix librariesIt depends on numerical and data processing Python libraries (Numpy, Scipy, Pandas)The Visualization API depends on MatplotlibThe precise dependencies are listed in the requirements.txt file.portfolioAnalytics may work with earlier versions of these packages but this has not been testedFrom PyPipip3installpandaspip3installmatplotlibpip3installportfolioAnalyticsFrom sourcesDownload the sources to your preferred directory:gitclonehttps://github.com/open-risk/portfolioAnalyticsUsing virtualenvIt is advisable to install the package in a virtualenv so as not to interfere with your system’s python distributionvirtualenv-ppython3tm_testsourcetm_test/bin/activateIf you do not have pandas already installed make sure you install it first (will also install numpy)pip3installpandaspip3installmatplotlibpip3install-rrequirements.txtFinally issue the install command and you are ready to go!python3setup.pyinstallFile structureThe distribution has the following structure:portfolioAnalytics         The library source codeestimators            Estimator methods (TODO)utils                 Helper classes and methodsthresholds            Algorithms for calibrating AR(n) process thresholds to input transition ratesvasicek               Collection of portfolio analytic solutionscreditmetrics         Analytic calculation of variance for credit metrics style modelsexamples                 Usage examplesdatasets                 Contains a variety of datasets useful for getting started with portfolioAnalyticstests                    Testing suiteTesting FrameworkIt 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 distributionUnzip the data files in the datasets directorypython3test.pyGetting StartedCheck the Examples pages in this documentationLook 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 libraryAnalysis ofCredit Migration using Python portfolioAnalytics: