Python for Finance: Analyze Big Financial Data

(Elle) #1
Figure 10-19. Absolute returns of jump diffusion (30d)

For this process and parameterization, the VaR over 30 days at the 90% level is almost


identical, while it is more than three times as high at the 99.9% level as with the geometric


Brownian motion (71.8 vs. 20.2 currency units):


In  [ 76 ]: percs   =   [0.01,  0.1,    1., 2.5,    5.0,    10.0]
var = scs.scoreatpercentile(R_jd, percs)
print “%16s %16s” % (‘Confidence Level’, ‘Value-at-Risk’)
print 33 * “-”
for pair in zip(percs, var):
print “%16.2f %16.3f” % ( 100 - pair[ 0 ], -pair[ 1 ])
Out[76]: Confidence Level Value-at-Risk
–––––––––––
99.99 75.029
99.90 71.833
99.00 55.901
97.50 45.697
95.00 25.993
90.00 8.773

This illustrates the problem of capturing the tail risk so often encountered in financial


markets by the standard VaR measure.


To further illustrate the point, we lastly show the VaR measures for both cases in direct


comparison graphically. As Figure 10-20 reveals, the VaR measures behave completely


differently given a range of typical confidence levels:


In  [ 77 ]: percs   =   list(np.arange(0.0, 10.1,   0.1))
gbm_var = scs.scoreatpercentile(R_gbm, percs)
jd_var = scs.scoreatpercentile(R_jd, percs)
In [ 78 ]: plt.plot(percs, gbm_var, ‘b’, lw=1.5, label=‘GBM’)
plt.plot(percs, jd_var, ‘r’, lw=1.5, label=‘JD’)
plt.legend(loc= 4 )
plt.xlabel(‘100 - confidence level [%]’)
plt.ylabel(‘value-at-risk’)
plt.grid(True)
plt.ylim(ymax=0.0)
Free download pdf