tailRisk Library 0.2 Release
TailRisk Library Release
tailRisk is a C++ library for the calculation of various tail risk measures. Tail Risk is a core concept in Quantitative Risk Management , relevant in particular in Market Risk and Credit Risk Management. Tail Risk is both an informal term denoting unusually occurring tail events and a more precise term denoting concrete classes of risk measures
Motivation and Objective
Tail risk phenomena where a system exhibits non-trivial behavior for low-probability scenarios are a central concern in many areas of risk management. Over time many refined definitions and approaches have been proposed. In financial applications prominent examples include extensions of the Value at Risk concept including concepts such as Expected Shortfall .
The tailRisk library aims to be a reference implementation for all commonly used tail risk measure definitions.
- User Documentation for the library (under development) is provided here
- The code is available at GitHub.
- A pre-packaged container is available at our Docker Hub page.
Example
The data directory contains sample datafiles with various sampled distributions
// Read in some data for a type 0 representation (discrete distribution)
int LossGrid = 1000;
int DataType = 0;
RandomVar L(LossGrid, DataType);
L.ReadFromJSON("../data/example5.json");
L.Print();
// Calculate various measures
double alpha = 0.8;
int threshold = 0;
std::cout << "Mean Value: " << L.Mean() << std::endl;
std::cout << "Median Value: " << L.Median() << std::endl;
std::cout << "STD Value: " << L.StandardDeviation() << std::endl;
std::cout << "Kurtosis: " << L.Kurtosis() << std::endl;
std::cout << "Skeweness: " << L.Skeweness() << std::endl;
std::cout << "Quantile @ " << alpha << ": " << L.Quantile(alpha) << std::endl;
std::cout << "Quantile Index @ " << alpha << ": " << L.Quantile_Index(alpha) << std::endl;
std::cout << "VaR @ " << alpha << ": " << L.VaR(alpha) << std::endl;
std::cout << "Expected Shortfall @ " << alpha << ": " << L.ExpectedShortFall(alpha) << std::endl;
std::cout << "Exceedance Probability: " << L.ExceedanceProbability(threshold) << std::endl;
std::cout << "Mean Excess: " << L.MeanExcess(threshold ) << std::endl;