Python for Finance: Analyze Big Financial Data

(Elle) #1
Figure 11-13. Minimum risk portfolios for given return level (crosses)

The efficient frontier is comprised of all optimal portfolios with a higher return than the


absolute minimum variance portfolio. These portfolios dominate all other portfolios in


terms of expected returns given a certain risk level.


Capital Market Line


In addition to risky securities like stocks or commodities (such as gold), there is in general


one universal, riskless investment opportunity available: cash or cash accounts. In an


idealized world, money held in a cash account with a large bank can be considered riskless


(e.g., through public deposit insurance schemes). The downside is that such a riskless


investment generally yields only a small return, sometimes close to zero.


However, taking into account such a riskless asset enhances the efficient investment


opportunity set for investors considerably. The basic idea is that investors first determine


an efficient portfolio of risky assets and then add the riskless asset to the mix. By adjusting


the proportion of the investor’s wealth to be invested in the riskless asset it is possible to


achieve any risk-return profile that lies on the straight line (in the risk-return space)


between the riskless asset and the efficient portfolio.


Which efficient portfolio (out of the many options) is to be taken to invest in optimal


fashion? It is the one portfolio where the tangent line of the efficient frontier goes exactly


through the risk-return point of the riskless portfolio. For example, consider a riskless


interest rate of rf = 0.01. We look for that portfolio on the efficient frontier for which the


tangent goes through the point ( f,rf) = (0,0.01) in risk-return space.


For the calculations to follow, we need a functional approximation and the first derivative


for the efficient frontier. We use cubic splines interpolation to this end (cf. Chapter 9):


In  [ 66 ]: import scipy.interpolate as sci

For the spline interpolation, we only use the portfolios from the efficient frontier. The


following code selects exactly these portfolios from our previously used sets tvols and


trets:


In  [ 67 ]: ind =   np.argmin(tvols)
evols = tvols[ind:]
erets = trets[ind:]

The new ndarray objects evols and erets are used for the interpolation:


In  [ 68 ]: tck =   sci.splrep(evols,   erets)

Via this numerical route we end up being able to define a continuously differentiable


function f(x) for the efficient frontier and the respective first derivative function df(x):


In  [ 69 ]: def f(x):
”’ Efficient frontier function (splines approximation). ”’
return sci.splev(x, tck, der= 0 )
def df(x):
”’ First derivative of efficient frontier function. ”’
return sci.splev(x, tck, der= 1 )

What we are looking for is a function t(x) = a + b · x describing the line that passes


through the riskless asset in risk-return space and that is tangent to the efficient frontier.


Equation 11-4 describes all three conditions that the function t(x) has to satisfy.


Equation 11-4. Mathematical conditions for capital market line

Free download pdf