Skip to content
DeepForgeby svx
All problems
EasyTime Seriests-054

Value at Risk Normal

Problem

Compute the one-period Value at Risk for normally distributed returns with mean mu, standard deviation sigma, and lower-tail standard normal quantile z (a negative number): VaR = -(mu + z * sigma).

The result is a positive loss number when the quantile lies below the mean.

Hint

z comes from the standard normal quantile, e.g. -1.645 for 95 percent confidence.

Test cases

case 1
in: [0,1,-1.6448536269514722]
expected: 1.6448536269514722
case 2
in: [0.01,0.02,-1.96]
expected: 0.029199999999999997
case 3
in: [0,0,-1.65]
expected: 0
case 4
in: [0.5,1,-2]
expected: 1.5
Starter codePython
def value_at_risk_normal(mu, sigma, z):
    # Your code here
    pass

4 test cases · run your code against them in the editor