An evaluation of a computer programme to aid users in determining investors’ Value at Risk of their portfolios.
Value at Risk (VaR) is the worst possible loss in an investment in a reasonable bound. VaR is widely used for educational purposes and mostly for industrial purposes. Almost every investor is concerned about the question of what is the maximum that can be lost in an investment. VaR tries to give an answer within certain boundaries and so it is very useful and the application of VaR is increasing significantly. It can be implemented in various ways. Special software is needed to compare and contrast the methods of the implementation of VaR. For financial market players who are interested in option strategies like straddles, strips, straps, and strangles, there is no straight forward software application to give the forecasted profit/loss data in the chosen strategies. People have had to calculate the strategies and respective profit or loss charts with pen and paper. Software is necessary to produce the best possible strategy; an excellent graph and profit/loss data can be obtained by a few mouse clicks.
There are quite few ways to implement VaR, such as historical simulation, the variance-covariance method, Monte Carlo simulation and the statistical method. This program produces the correct answers to each method mentioned here in a user-friendly way. The programme considers the derivative market as well and calculates VaR in forward contracts. It uses the latest Equity Option data from the web and calculates profit and loss diagrams, so that the user gets the most updated profit/loss graph. The users, especially the investors and option market players, will find it very easy, friendly and helpful to work with.
The program is built to compute VaR for various methods and to produce a very handy tool for the option traders. It is based on some literature on VaR for different methods, MS Excel and the lecture notes of Derivatives taken during our Spring Semester. It uses the up-to-date data to produce results and graphs. It is able to compute VaR for both small and big investors’ portfolios. It is easy to use and user-friendly.
2.1. Background and Context
Value at Risk is used world-wide in almost all commercial and investment banks, but the questions that come to mind are what is Value at Risk and why is it important?
2.1.1. What is Value at Risk (VaR)?
Value at Risk is the worst possible loss in an investment in a reasonable bound. It measures the potential loss in value of a risky asset or portfolio for a certain time and given confidence interval. So, if the VaR on an asset is £100 million at a 95% confidence interval in one week there is only a 5% chance that the value of that asset will drop more than £100 million in one week. In a nutshell, the Value at Risk can be described as follows – 
- VaR estimates the probability of the loss, with a confidence interval and time frame.
- VaR can differ through different probability functions like normal Distribution and log-normal distribution.
- The focus in VaR is clearly on downside risk and potential losses.
- The VaR has three key elements – a specified level of loss in value, a fixed time period and a confidence interval.
VaR has been effectively used since the mid–1990s. ‘The concept and use of Value at Risk is recent. Value at Risk was first used by major financial firms in the late 1980s to measure the risks in their trading portfolios ’. The idea of using VaR as a software application has quite recently been developed by RiskWave. ‘The impetus for the use of VaR measures, though, came from the crises that beset financial service firms over time and the regulatory responses to these crises ’. But the mathematical insinuations behind VaR were largely developed by Harry Markowitz and others years ago. Their efforts were geared towards measuring the market risk and devising optimal portfolios for equity investors. In particular, their work led to the idea of how VaR could be computed. Now today, there is software which calculates VaR, mostly on the basis of MS Excel.
2.2. Scope and Objectives
The aim of this software is to produce a complete tool for people in financial markets to develop their portfolios. Investors should compute the VaR in normal distribution, log-normal distribution, historical simulation, Monte Carlo simulation and variance-covariance method. The software should be able to compute VaR for multiple assets and foreign market forward contracts as well. The answers should be correct and match any reliable program like MS Excel. The software should be chosen rather than MS Excel for its user-friendly properties and good graphics. The most user-friendly way to accept the data is the by means of a table, so the Java software should use the JTable in a very sophisticated way. The programme should count the data in both a self-generated and user-friendly way, but it should do it in very polite manner, so that the user can accept and understand it. In the case of the foreign market, the labels should be updated by selecting the appropriate currency; the user should understand how the currency works and should be able to change the currency list. For multiple assets, the user should be able to give the number of assets he has and the software should produce the correct size and length of table for a variance-covariance matrix. The tables should appear in correct sequence and order. The software is built for many kinds of investors, so the input data range may need to be very big; up to millions. The programme should be very sophisticated in order to deal with this factor and the answers produced by it should be acceptable to the user. For example, with its memory power, a computer can compute correct results up to 10 decimal places or even more. But for the user, a correct answer up to three or four decimal places is perfectly adequate, so the software should approximate the data when necessary. The graphs, which should be drawn for normal and log-normal distribution, should be well labelled, so that the user can easily understand their portfolio value and associated probability from the diagram. A table should be there to support the graph and labels statistically.
My software is very useful for both investors and option traders. It is a good tool for helping those involved in finance to compute their risk, and profit and loss over both their portfolios and stock. The software can compute VaR for the data given by the user; it is also able to handle every kind of incorrect input given by the user, can identify faults and give advice as what should be done next. It also helps the user to select the correct option in choosing a particular option strategy. It draws the graph on a high-definition drawing panel and calculates a table to show each profit/loss data for each and every movement in the stock price.
The software is able to produce the correct answer in both normal and log-normal distribution. It draws graphs and tables with both labels and probability. The programme is also able to measure the data and produce it in a sophisticated way, like in millions or not. There are extra buttons and labels, which makes the software more user-friendly and the text fields and labels are updated automatically when the user presses the right button. The colours of the input, output and drawing panels are acceptable to the users. There are more facilities such as changing the currency for the input and output panel and the conversion rate can be changed if the user so wishes. The panels can be either visible or invisible and in the correct order, so that the user is not bothered with unwanted information. For example, the tables are drawn when the ‘produce table’ button is clicked and the answer is shown when the ‘produce answer’ button is clicked. For multiple assets, the programme takes the data and draws the table in correct rows and columns. For example, if the user has only three assets, the table will have 3×3 rows and columns, but if there are nine assets, the table will have 9×9 rows and columns. These all are done by removing the first table and adding the second table on the same panel, so it looks cool. The labels are updated immediately the input and output currency are changed. All the answers in all methods support the results in the literature and MS Excel. The data shown in the answer panel are rounded off to up to four decimal places.
3. Computation of Value at Risk (VaR)
The computation of VaR has been done using various methods. It has three main parts as discussed above. The following figure provides more information about the overall structure of the VaR problem. The investment of a single asset is all that has only been considered in this part of assignment.
3.1. Statistical Methods To Compute VaR For A Single Asset
The most frequently used statistical method to compute VaR in Excel is normal distribution, but, other methods are available, like log-normal distribution. Both methods mentioned here have been implemented in the software in a very sophisticated way.
3.1.1. Normal Distribution
Normal distribution is a well known statistical method used to measure populations. It is used widely used in critical calculation. In this software, only symmetric normal distribution is used.  .Working Schemes: To produce VaR in normal distribution mode, the user needs to input the correct value in the right area. The user must submit the initial portfolio value, mean, standard deviation and expected minimum value of the portfolio correctly. Then the user needs to click the button to compute VaR in normal distribution and the Java software calculates the VaR in the output panel. Here, the default percentage to compute VaR is 1%,but, the user is able to get the VaR in ant percentage by editing the text field in the output panel and clicking the ‘is’ button next to it, after the VaR is computed once. The software also gives the probability of the end-of-year portfolio, when it is less than the minimum expected value (cut-off). The user can also edit the cut-off value in the output panel and the answer is computed when the second ‘is’ button in that panel is clicked. It updates the new value in the input panel.
Most significantly, the software draws a normal distribution curve on the basis of the inputted value. The portfolio value is shown in the x-axis and the probability of each of the values is shown in the y-axis of the curve. At the bottom of the curve, there is a table to show some hand-picked data in symmetric intervals and their probability. (Here, the data is referred to for the range of the end-of-year portfolio value. The curve and the table show that portfolio value and their probability.) This gives the opportunity for the user to see his portfolio value with the probability and some measurement of the portfolio risk as well.
Again, the software is able to handle big data. There is a facility for the user to choose the ‘in millions’ option to tell the software that the input data is in millions. The software can handle these cases perfectly. It reads the output data, determines whether it is in millions or not and produces the output.
Methodology: In the output panel, there are three main outputs: the VaR, the probability of the end-of year portfolio value less than your minimum expected value, and the probability density curve. These three results are computed by three different methodologies using a normal distribution curve. The VaR is computed by the inverse cumulative normal distribution function and the probability of the minimum expected value has been obtained by using the cumulative normal distribution function  . The density curve is drawn using the probability density function. Whenever the user clicks a button, the input data is handled by the software and the correct method is called for with the right button. The graphics related to the panels start being updated as soon as the commands for the method are given.
Assumptions: To implement normal distribution with all types, some assumptions are made in the software. The answers match perfectly with Excel, but in the case of drawing a curve and updating the table, an approximation has been done. There is a separate class in the software package, where the computation of inverse cumulative distribution has been done quite tactically. There are two ways to calculate the results. One is invented by me and the second one is borrowed from the ‘Java API 6’ . For big data, the software uses my method and for small data (Ex.-not in millions), the ‘Normal Distribution Interface’  is being used. The method invented by me is able to handle big data, but the answer is correct up to a certain number of decimal places. The software counts 10 intervals, keeping the mean value of the portfolio in the middle and the graph is drawn only in that range. The number is rounded off when the data is small. If the data is inputted as being in the millions, the rounding off method does not work. The portfolio values shown in the table do not reflect currency changes and the table informs this fact.
The software works well for computing Value at Risk. The user can register with the system successfully and is able to use the software embedded in the webpage. Only registered users can log on to use it. The software works well, with all its facilities in the webpage.
All the methods to compute VaR have been successfully implemented. The distributions are working properly in the program and their answers are correct in all cases. The software has a very user-friendly interface and it can check all kinds of wrong data inputted by the users. It is also able to show the message which has the error and how to correct it. It uses Java dialogue boxes, panels and many other Java swing components which make it more sophisticated from the user’s point of view. The panels and labels can be updated with the different choices of the user’s strategies. There are tables which take into account the inputted data and also produce results through updating the answer panels. The conversion rates in the software can be inputted and edited
The software meets the objective set in section 2.2, ‘to produce a complete tool for people in financial markets to develop their portfolios’. This refers to people who are investors in the domestic and foreign markets and who are interested in knowing about the VaR in their portfolios. It also refers to option traders and the people who want to make profits through various option strategies. The webpage structure and software package are both working properly.
The distribution curves drawn to compute VaR are not 100% perfect. It is fine for normal distribution, but big data is not handled well by the log-normal distribution. It was not possible to draw the labels beside the graph due to the behaviour of the log-normal density curve at this stage of the software. However, it is possible to count the biggest value and rearrange the whole draw panel to fit the density curve properly. The answers are always rounded off in the answer panels but for the big data (ex. – if the amount of money is in millions), this facility does not work. This is because the Java class inside the programme body is not able to handle big data. There are some assumptions in implementing the Monte Carlo simulations. This is because the procedure discussed in the RiskWave , is not very clear. Historical simulations are working well and are user-friendly. For investors who have multiple assets, the software produces exactly the same result as with MS Excel. Investors in the foreign market will find this software is very good for considering all the data in their portfolios and computing Value at Risk. However, this has been built on the basis of only one reference to the literature: pp 32-33 of .
4.3. Future Work
This program is just the beginning of new, essential software packages for the financial markets. This program was initially built up on the basis of a few literature reviews and some examples of problems solved in these sources. In future, further practical problems can be reviewed and included in this software. The use of different methodologies like the Monte Carlo simulation can be extended further. High definition graphic panels can be used for showing the normal and log-normal distribution curves. The computing and rounding off methodologies can be improved for big data. The graphic structure of tables and labels can be improved by the sophisticated use of Java Graphics.
This application can be extended to a mobile application. The user only needs a web-enabled mobile phone to use this excellent software package. But as the display panels are too big at this stage, they should be resized and more be sophisticated from a mobile user’s point of view. Instant messaging could be used to alert the users of the unexpected rise or fall of the user’s chosen stock options. The software should be available in both PC and Mobile version.
VALUE AT RISK (VAR). [Online] http://pages.stern.nyu.edu/~adamodar/pdfiles/papers/VAR.pdf
Risk Measurement: An Introduction to Value at Risk. [Online] http://www.exinfm.com/training/pdfiles/valueatrisk.pdf
The Early History of Option. [Online] http://www.sfu.ca/~poitras/heinz_$$.pdf
Hoadley Trading & Investment Tools. [Online] http://www.hoadley.net/options/develtoolsvar.htm.
@Risk. [Online] http://www.palisade.com/risk/?gclid=CNesw5uWiaICFR2Y2AodmGuTUQ
@Risk (Monte Carlo Simulation). [Online] http://www.palisade.com/risk/monte_carlo_simulation.asp.
Option-Aid [Online] http://www.mindxpansion.com/options/index.php
Visual Options Analyzer [Online] http://www.voptions.com/index.htm
TD Ameritrade. [Online] http://www.tdameritrade.com/welcome1.html
Java. [Online] http://www.java.com/en/
Java™ Platform, Standard Edition 6 API Specification [Online] http://download-llnw.oracle.com/javase/6/docs/api/
Eclipse [Online] http://www.eclipse.org/
Apache Commons (Normal Distribution Interface) [Online] http://commons.apache.org/math/
The Java™ Tutorial [Online] http://download.oracle.com/javase/tutorial/index.html
JFreeChart [Online] http://www.java2s.com/Code/Java/Chart/JFreeChartXYSeriesDemo.htm
Web Server [Online] http://shark.cs.stir.ac.uk/
HTML [Online] http://www.w3schools.com/html/
PHP [Online] http://www.php.net/
Dreamweaver [Online] http://www.adobe.com/products/dreamweaver/
Normal Distribution [Online] http://en.wikipedia.org/wiki/Normal_distribution
Normal Distribution [Online] http://mathworld.wolfram.com/NormalDistribution.html
Log-Normal Distribution [Online] http://en.wikipedia.org/wiki/Log-normal_distribution
Inverse Log-Normal Distribution “Microsoft Excel Help Section”
Error Function [Online] http://en.wikipedia.org/wiki/Error_function
Error Function [Online] http://mathworld.wolfram.com/Erf.html
RiskWave (MIZUHO) [Online]
Object to Double [Online] http://www.roseindia.net/java/java-conversion/ObjectToDouble.shtml
Sorting Array [Online] http://mathbits.com/mathbits/compsci/arrays/Exchange.htm
Financial Modeling, Simon Benninga, (third edition), chapter 15, Value at Risk
Bull Spreads [online] http://en.wikipedia.org/wiki/Bull_spread
Bear Spreads [online] http://en.wikipedia.org/wiki/Bear_spread
Butterfly Spreads [Online] http://en.wikipedia.org/wiki/Butterfly_%28options%29
Covered Call [Online] http://en.wikipedia.org/wiki/Covered_call
Protective Put [Online] http://www.optionseducation.org/strategy/protective_put.jsp
Collar [Online] http://en.wikipedia.org/wiki/Collar_%28finance%29
Straddles [Online] http://en.wikipedia.org/wiki/Straddle
Strips and Straps[Online] http://www.finance-lib.com/financial-term-strip-strap.html
Strangles [Online] http://en.wikipedia.org/wiki/Strangle_%28options%29
Intrinsic Value [Online] http://en.wikipedia.org/wiki/Intrinsic_value_%28finance%29
Time Value [Online] http://en.wikipedia.org/wiki/Option_time_value
Financial Time Market Data for UK Equity Option by Stock [Online]
Rounding off numbers [Online] http://www.roseindia.net/java/beginners/RoundTwoDecimalPlaces.shtml
Draw Image [Online] http://www.cs.stir.ac.uk/~sbj/examples/Java-examples-advanced/DrawImage/
PHP File Writing [Online] http://www.tizag.com/phpT/filewrite.php
DB pear [Online] http://pear.php.net/package/DB/redirected