Python for Finance: Analyze Big Financial Data

(Elle) #1

The following figure finally shows the full frequency distribution of the portfolio present


values. You can clearly see in Figure 18-4 the offsetting diversification effects of


combining a call with a put option:


In  [ 39 ]: pvs =   pv1 +   pv2
plt.hist(pvs, bins= 50 , label=‘portfolio’);
plt.axvline(pvs.mean(), color=‘r’, ls=‘dashed’,
lw=1.5, label=‘mean = %4.2f’ % pvs.mean())
plt.xlim( 0 , 80 ); plt.ylim( 0 , 7000 )
plt.grid(); plt.legend()

Figure 18-4. Portfolio frequency distribution of present values

What impact does the correlation between the two risk factors have on the risk of the


portfolio, measured in the standard deviation of the present values? The statistics for the


portfolio with correlation are easily calculated as follows:


In  [ 40 ]: #   portfolio   with    correlation
pvs.std()
Out[40]: 16.736290069957963

Similarly, for the portfolio without correlation, we have:


In  [ 41 ]: #   portfolio   without correlation
pv1 = 5 * portfolio.valuation_objects[‘eur_call_pos’].\
present_value(full=True)[ 1 ]
pv2 = 3 * portfolio.valuation_objects[‘am_put_pos’].\
present_value(full=True)[ 1 ]
(pv1 + pv2).std()
Out[41]: 21.71542409437863

Although the mean value stays constant (ignoring numerical deviations), correlation


obviously significantly decreases the portfolio risk when measured in this way. Again, this


is an insight that it is not really possible to gain when using alternative numerical methods


or valuation approaches.

Free download pdf