At present I am a final year undergraduate of Department of Computer Science and Engineering at University of Moratuwa, Sri Lanka. As a part of my degree program, I am doing a reasearch and development project together with 3 other collegues on the topic “Real time calculation and prediction of VaR”. I am yearning to write a series of blog posts regarding this project from today onwards and this is the 1^{st} blog which gives an insight to the project and its background.
Value at Risk (VaR) is a predominantly used method to assess market risk in financial domain. It is defined using 3 parameters;
 The highest possible loss
 ex: $3 or 5%
 The time period
 ex: per day, per month
 The confidence level
 ex: with 95% confidence
For example we can state that with 95% confidence, the highest possible loss one can expect from investing in bank ABC is 4$ per day.
Initially there were various methods used to assess market risk such as duration and convexity, Greeks and beta etc. However, these methods were constrained to a certain portfolio only. That is, one method which was suitable to compute risk of stock prices might not be suitable to calculate risk of bills. Therefore, the concept of VaR came up as a general way of assessing market risk for any given portfolio.
There are plenty of methods implemented to calculate VaR for a portfolio and the most widely used methods are;

Historical Simulation

VarianceCovariance Method

Monte Carlo Simulation
To know more about these 3 methods and how they can be used to calculate VaR, visit my blog post.
There is no specific time period for each method to use. However, the common practice is to calculate daily VaR and get the highest possible loss per day. Most of the investment banks calculate VaR at the end of the day thereby getting the loss amount and triggering risk mitigation processes accordingly. Investment banks omit the intraday changes of the portfolios due to the fact that the internal models used to calculate VaR depend on the close position of the portfolio values. However, with the increased collection of data and intraday price fluctuations, making decisions based on a value calculated on daily basis is more inaccurate. Hence, the investment banks nowadays are more interested in real time VaR which is calculated for a shorter interval.
This area of research was given to our team by Dr. Srinath Perera (VP – Research at WSO2 Lanka (Pvt.) Ltd.). We are supposed to come up with an efficient and feasible mechanism to calculate VaR in real time using the above 3 methods. The term “real time” can be defined as follows. We expect the system to calculate VaR every time a change occurs in the portfolio but publish that value only if it exceeds a predefined threshold. In this manner we will be able to calculate VaR in real time.
Another requirement mentioned by Dr. Srinath was, the system should employ a Machine Learning technique to forecast VaR based on the historical data. To satisfy this requirement, we are expecting to employ a set of ML techniques and evaluate them to choose the best technique.
Hence through this project, we will address the problem of calculating the Value at Risk for a given portfolio as well as predicting the VaR based on the historical data.
Following are the objectives of this project:

Write 3 Siddhi extensions to calculate VaR for different portfolios such as Bills, Bonds, Stocks, and Derivatives etc. using the 3 proposed methods. Siddhi is the complex event processing engine used in WSO2 Complex Event Processor (CEP).

Implement the VaR calculation in real time and in batch mode (where applicable).
 Perform back testing on large data sets to validate the real time implementations.
 Exploring possibility of using other machine learning techniques for improving VaR calculations and prediction.
 Apply the identified technique to forecast the VaR.
The project outputs are:

Three separate extensions written for WSO2 Complex Event Processor (CEP), each calculating VaR using the 3 most commonly used methods: Historical Simulation,VarianceCovariance Method and Monte Carlo Simulation.

A mechanism of forecasting VaR using time series analysis and Machine Learning techniques.

Evaluation of various Machine Learning techniques on their suitability to calculate and predict VaR values in real time.

A research paper capturing the details about the techniques used in implementing VaR in real time, performance of the implementation and a comprehensive evaluation of testing.
The project outcome is:
This project will enable investment banks and other financial institutions to calculate, forecast and assess their risk position in real time and allow them to trigger risk mitigation processes intraday if needed.
The next blog post will describe the three methods we are using to calculate VaR in detail.