Figure 18-2. Highly correlated risk factors
As a last numerical and conceptual example, consider the frequency distribution of the
portfolio present value. This is something impossible to generate in general with other
approaches, like the application of analytical formulae or the binomial option pricing
model. We get the complete set of present values per option position by calculating a
present value and passing the parameter flag full=True:
In [ 36 ]: pv1 = 5 * port_corr.valuation_objects[‘eur_call_pos’].\
present_value(full=True)[ 1 ]
pv1
Out[36]: array([ 0. , 22.55857473, 8.2552922 , ..., 0. ,
0. , 0. ])
In [ 37 ]: pv2 = 3 * port_corr.valuation_objects[‘am_put_pos’].\
present_value(full=True)[ 1 ]
pv2
Out[37]: array([ 22.04450095, 10.90940926, 20.25092898, ..., 21.68232889,
17.7583897 , 0. ])
First, we compare the frequency distribution of the two positions. The payoff profiles of
the two positions, as displayed in Figure 18-3, are quite different. Note that we limit both
the x- and y-axes for better readability:
In [ 38 ]: plt.hist([pv1, pv2], bins= 25 ,
label=[‘European call’, ‘American put’]);
plt.axvline(pv1.mean(), color=‘r’, ls=‘dashed’,
lw=1.5, label=‘call mean = %4.2f’ % pv1.mean())
plt.axvline(pv2.mean(), color=‘r’, ls=‘dotted’,
lw=1.5, label=‘put mean = %4.2f’ % pv2.mean())
plt.xlim( 0 , 80 ); plt.ylim( 0 , 10000 )
plt.grid(); plt.legend()