A hedge fund needed an implementation of Value at Risk (VaR) on a daily time horizon to estimate the risk of its portfolio. VaR involves estimating the probability distribution of a portfolio’s future value. Because the prices of the components of a portfolio are correlated, this correlation structure must be estimated from historical data. Some components are roughly linearly correlated, but derivative instruments may be nonlinearly related to each other.
Data comes from disparate sources with missing data. For some components, like many commodities, the relevant data are futures contracts with limited lifetimes, so time series must be spliced together in a nontrivial fashion. Additionally, some components have behaviors like seasonality that must be accounted for. The VaR application needed to be a service that other web applications in the client’s infrastructure could use to provide live VaR estimates.
Enthought started with the RiskMetrics VaR methodology, which is a de facto standard in the financial industry. The instruments in the portfolio are mapped to a constrained set of ‘risk factors’ that represent the majority of the variation in the market. For many instruments, these mappings are linear multipliers against the risk factor, but some are nonlinear and are estimated with a quadratic mapping.
We made a library that can map a variety of derivative instruments on the market. The correlations of the risk factors are estimated from historical data. The time series that are the sources for the risk factors and the methods for assembling them are configurable by a text file.
In fact, there were two configurations in common use, one that followed the RiskMetrics methodology closely, and one that deviated with some improvements like taking seasonality into account. We found the RiskMetrics-recommended Expectation Maximization algorithm for accounting for missing data to be entirely inadequate, so we implemented a new algorithm from recent research papers. For nonlinear portfolios, we also avoided the RiskMetrics algorithm for failure to converge, and implemented a method based on characteristic functions of probability distributions.
Want to learn more about what we can help you achieve? Contact Us