Time limit per test: 0.25
second(s)

Memory limit: 65536 kilobytes

Memory limit: 65536 kilobytes

input: standard

output: standard

output: standard

In economics and finance, (VaR) is a measure of how the market value of an asset or of a portfolio of assets is likely to decrease over a certain time period (usually over 1 day or 10 days) under usual conditions. It is typically used by security houses or investment banks to measure the market risk of their asset portfolios (market value at risk), but is actually a very general concept that has broad application.

VaR has three parameters.

- The time horizon (period) to be analyzed (i. e. the period of time over which one plans to hold the assets in the portfolio—the "holding period"). The typical holding period is 1 day, although 10 days are used, for example, to compute capital requirements under the European Capital Adequacy Directive (CAD). For some problems, even a holding period of 1 year is appropriate.
- The confidence level at which the estimate is made. Popular confidence levels are usually 99% and 95%.
- The unit of the currency which will be used to denominate the value at risk (VaR).

In the purposes of this problem we will use the fixed confidence level value of 95% and Berland dollar as a currency unit.

The VaR is the maximum amount at risk to be lost from an investment (under 'normal' market conditions) over a given holding period, at a particular confidence level. As such, it is the converse of shortfall probability, in that it represents the amount to be lost with a given probability, rather than the probability of a given amount to be lost.

Consider an example of trading portfolio. Its market value in Berland dollars today is known, but its market value tomorrow is not known. The investment bank holding that portfolio might report that its portfolio has a 1-day VaR of $4 million at the 95% confidence level. This implies that (provided usual conditions will prevail over the 1 day) the bank can expect that, with a probability of 95%, the value of its portfolio will decrease by at most $4 million during 1 day, or, in other words, that, with a probability of 5%, the value of its portfolio will decrease by $4 million or more during 1 day.

The key thing to note is that the target confidence level (95% in the above example) is the given parameter here; the output from the calculation ($4 million in the above example) is the maximum amount at risk (the ) for that confidence level.

In the following, means percentage change in value.

A variety of models exist for estimating VaR. Each model has its own set of assumptions, but the most common assumption is that historical market data is our best estimator for future changes. The important assumption of "variance-covariance" model () is that risk factor returns are always (jointly) normally distributed and that the change in portfolio value is linearly dependent on all risk factor returns. There are also "historical simulation" and "Monte Carlo simulation" models, but here we will touch only the VCV model.

In the following, we will take the simple case, where the only risk factor for the portfolio is the value of the assets themselves. The following two assumptions enable to translate the VaR estimation problem into a linear algebraic problem:

The implication of (1) and (2) is that the portfolio return is normally distributed because it always holds that a linear combination of jointly normally distributed variables is itself normally distributed.

We will use the following notation:

- there are
*N*assets; *m*_{i}= expected value of the return on asset*i*;*m*_{P}= expected value of the return on the portfolio;*s*_{i}= standard deviation of the return on asset*i*;*s*_{P}= standard deviation of the the return on the portfolio;*V*_{i}= initial value of asset*i*(in currency units);*V*_{P}= initial value of the portfolio (in currency units);*w*_{i}=V_{i}/V_{P};*W*= vector of all*w*_{i}(*W*^{T}means transposed);*S*= covariance matrix, i. e. matrix of covariances between all*N*assets, i. e. an*NxN*matrix.

The covariance between two real-valued random variables

The calculation goes as follows.

The normality assumption allows us to z-scale the calculated portfolio standard deviation to the appropriate confidence level. So for the 95% confidence level VaR we get:

You will be given historical data of the assets prices and the quantity of each asset in the portfolio. You should calculate the value at risk for that portfolio.

Each of the next

sample input |
sample output |

5 2 200 10 31.11 489.75 31.04 488.04 31.10 497.28 31.15 504.28 31.22 505.00 30.69 501.02 |
150.89 |

Online Contester Team © 2002 - 2010. All rights reserved. |