**Risk Analytics using Parallel Processing**

--

In this article we will understand the application of **parallel computing** for **Risk Analytics**. We introduced ourselves to the concept of parallel processing in my previous article that can be found *here***.**

Risk Management is an area of finance that has been evolving over the years. Risk analytics is no stranger to innovation. There are periodic enhancements that market participants come up for measuring risk more efficiently. Sophisticated mathematical and statistical techniques are applied for developing models for risk analytics. With the rise of big-data, the use of technology in finance has risen manifold. Parallel computing is one such approach that has been adopted by the industry to make an efficient use of the available computation power of contemporary processors/systems.

In my earlier post on parallel computing, we had explored the use of parallel computation for option pricing. In this post we will extend this further to calculate the Monte Carlo Value at Risk (VaR) of an option position by leveraging the strength of parallel computing.

In this article we will understand the basics of VaR and subsequently implement a parallel computing engine for calculation of VaR of an option contract.

**Risk Measurement:**

Risk measurement happens to be a very important step in the overall process of risk management. There are various parameters/techniques which can explain the risk that is embedded in a financial product. For example, Duration for fixed income products, Greeks for options, DV01 for swaps etc. However, by far the most popular measure adopted by the industry when it comes to measuring the portfolio risk is **VaR.** VaR is popular amongst regulators and industry participants alike owing to the fact that it gives one single number which encapsulates the risk embedded in a portfolio. This not only makes interpretation of the portfolio risk easy but also makes risk monitoring convenient.

There are multiple techniques for measurement for VaR. We will implement the Monte Carlo approach for VaR that is driven by fast processing power for parallel computing.

**Parallel computing for VaR:**

We have a hypothetical option trade. We will calculate the Value at Risk for this option. We implement the Monte Carlo simulations approach; therefore, this is a computationally heavy activity. We will optimize our model to use parallel execution which will minimize the execution time and give us a risk measure faster.

We will assume our option to be European Call option. We will use an option pricing model for valuing the option today. Further, we will use simulations to generate multiple scenarios in our case ** 1 million paths. **Subsequently, we will compute the VaR of the option trade. Lets understand the implementation of this algorithm below!

Below are the steps for implementing this algorithm using Python:

- Import the required libraries to be used for this implementation along with the required details pertaining to the option trade.

2. Pricing the option today

3. We simulate **1 million** asset price paths using parallel processing. Subsequently we compute the discounted value of the option payoff

4. We calculate the simulated P&L and then look up the VaR of the option position

# Way Ahead !

In this post we implemented a popular application of parallel computing for finance. With financial institutions increasing their investments towards building large technology infrastructure, it is expected that the adoption of parallel computing will increase further. Also, other computationally heavy applications like stress testing etc. may find the idea of parallel processing to be very appealing.

Python continues to be in the forefront at the moment with its rich set of ever-increasing libraries. However, Julia programming seems to be another language that the industry is exploring. Although Julia programming is a relatively new language, it is expected to be a viable alternative to Python in the future. It is still too early to comment on the industry adoption of Julia computing, however, if it provides a faster implementation and is backed by a strong set of libraries that may get added over years to come, then this may be a language to watch for!