from scipy import stats
p = [0.5, 0.1, 0.05, 0.025, 0.01, 0.001]
VaR = -stats.norm.ppf(p)
ES = stats.norm.pdf(stats.norm.ppf(p))/p
for i in range(len(p)):
print("VaR " + str(round(p[i]*100,3)) + "%: " + str(round(VaR[i],3)))
print("ES " + str(round(p[i]*100,3)) + "%: " + str(round(ES[i],3)), "\n")
using Distributions;
p = [0.5, 0.1, 0.05, 0.025, 0.01, 0.001]
VaR = quantile.(Normal(0,1), p)
ES = pdf.(Normal(0,1), quantile.(Normal(0,1),p))./p
println(ES)