Basic Portfolio Optimization

Everyone would like to make a profit out of the money they have. Unless the sum of money is small, putting it in the bank is not a wise choice. The rate of interest given by the bank is so small that inflation will just eat up most of the profit. The most profitable investment but riskier one is on the stock market. Investing on the stock market is more of an art than a science. An investor will initially take a look at the fundamental data of a company to see how it is performing. You don’t want to put your money in a company that will close in a month.

After identifying potential companies, the next question is how much of each security should one purchase in order to maximize your profit while at the same time minimizing the risk. There is a risk involved when buying such securities. The price per share of a security changes frequently in a day. As an example, if you purchased 100 shares of security A at a price of $1 per share and suppose that on the tenth day the price rose to $1.50. If you decide to sell all your shares on that day, your profit will be $50 or 50% of your initial investment. If however, the price per share declined to $0.9, you will lose $10 or 10% of your initial capital. In this discussion, we consider the closing prices.

Risk and Expected Return

How then do we calculate the risk involved in holding shares of a security? The risk depends on how long you are going to keep those shares before selling them.

Table 1 lists the price/share of a traded security for the last 10 days. Assuming you bought 1 share at day 1. If you sell it on day 10, your profit will be 0.6%. Selling it on day 6, your return will be 3.7%. The average return is 0.6%. The risk in investing in this security is represented by the standard deviation \sigma = 2.04\%.


Let \bar R_i be the ith return of security i and X_i be the fraction of the investor’s fund invested in asset i, then the expected value of the portfolio P consisting of these assets is give by

\bar R_p = \sum^N_{i=1} X_i\bar R_i

where N is the number of assets in the portfolio. The variance of portfolio P is given by

\sigma_P^2 = \sum_{j=1}^N X_j^2\sigma_j^2 + \sum_{j=1}^N\sum_{k\neq j}^N X_jX_k \sigma_{jk}

where \sigma_{jk} is the covariance between asset j and k. The covariance is the expected value of the product of two deviations: the deviations of the returns on asset j from its mean and the deviations of asset 2 from its mean.

Simple Example

Let us illustrate portfolio optimization using a simple example. Suppose the current interest rates when investing in Treasury Bills is 8%. Treasury Bills are risk free investments in that if you will get 8% more of your initial money at the end of the holding period. The holding period is the length of time your money is in the possesion of the borrower before it matures. Assuming that the inflation rate at the end of the holding period is 3%, the real amount of money you earned in investing in Treasury Bills is 8-3=5\%.

In order to make more money, we decide to invest some of our money in stocks and bonds which are more risky but the returns are high enough to justify the risk. Let A and B be two securities of a portfolio P with the following parameters:


We assume a \sigma_{ab}= 0.20. The average return of portfolio P is

r_p = 0.10w_a + 0.17 w_b

and the average risk is

\sigma_p^2 = (0.12w_a)^2 + (0.25w_b)^2 + 2(0.20)(0.12)(0.25) w_a w_b

where w_a and w_b are the fraction of your money which you invest in security A and B respectively. We require that w_a + w_b = 1, that is , we invest all our allocated money in this two securities.

The table below shows some values of \sigma versus e_r for various weights.


Figure 1 shows a plot of risk versus expected return for various combinations of w_a and w_b. The line shown is called the Capital Allocation Line. The slope of this line is called the reward-to-variability ratio and is give by

\label{reward.variability.ratio}S = \frac{E(r_p) - r_f}{\sigma_p}

The y-intercept of this line is the risk-free rate, which in our example
is 8%. The slope is the amount of return you get per unit increase in the amount of risk. The goal of portfolio optimizatio is to find the combinations of $lalex w_a$ and w_b that maximizes this quantity.


Substituting the given values of the risks and expected returns we get the optimization problem we have to solve:


S_p = \frac{E(r_p) - 0.08}{\sigma_p}

subject to

r_p  = 0.10 w_a + 0.17 w_b
\sigma_p^2 = (0.12w_a)^2 + (0.25w_b)^2 + 2(0.20)(0.12)(0.25) w_a w_b
1 = w_a + w_b

In the next post, we will use genetic algorithms to solve this optimization problem.