You can now check that the asset weights indeed add up to 1; i.e., Iwi = 1, where I is the
number of assets and wi ≥ 0 is the weight of asset i. Equation 11-1 provides the formula
for the expected portfolio return given the weights for the single securities. This is
expected portfolio return in the sense that historical mean performance is assumed to be
the best estimator for future (expected) performance. Here, the ri are the state-dependent
future returns (vector with return values assumed to be normally distributed) and i is the
expected return for security i. Finally, w
T
is the transpose of the weights vector and is
the vector of the expected security returns.
Equation 11-1. General formula for expected portfolio return
Translated into Python this boils down to the following line of code, where we multiply
again by 252 to get annualized return values:
In [ 42 ]: np.sum(rets.mean() * weights) * 252
# expected portfolio return
Out[42]: 0.064385749262353215
The second object of choice in MPT is the expected portfolio variance. The covariance
between two securities is defined by ij = ji = E(ri – i)(rj – j)). The variance of a
security is the special case of the covariance with itself: . Equation 11-2
provides the covariance matrix for a portfolio of securities (assuming an equal weight of 1
for every security).
Equation 11-2. Portfolio covariance matrix