I can't believe it's already been one year since I posted my first blog. Thank you to everyone who's still interested in my writing. I appreciate all the attention you've given to my blog. In the spirit of celebrating this "anniversary," I'll be discussing how to build a diversified portfolio in this article, continuing from the first blog I posted on how to pick stocks.
How much cash should you hold? How much money should you allocate to the stock market, bond market, and REITs? Is there a way to achieve the best profitability of a portfolio while minimising risk? If you're concerned about any of these questions, I hope this article can help you. The answer to these questions is simple - all you need to do is learn how to build a diversified portfolio. Diversification involves allocating capital to various investments with the goal of reducing portfolio volatility (risk) by offsetting losses in one asset class with gains in another.
The typical diversification strategy involves balancing various investments that have only a slight positive correlation with each other – or even better, actual negative correlation. Low correlation usually indicates that the prices of the investments are not likely to move in the same direction. However, it's important to note that in general, the lower the risk, the lower the potential profits. Therefore, we need to be clear about our investment goals and careful not to over-diversify our portfolio.
In this article, I’m going to show you how to build a diversified portfolio based on your investment objectives, market acumen, and Markowitz Portfolio Theory.
Familiarise Yourself with Different Asset Classes:
To build a diversified portfolio that aligns with your objectives, you need to be familiar with different asset classes. This familiarity will help you understand the valuation trajectories of these assets in various economic conditions and adjust the weights of these assets based on your convictions to reach your goals.
Let's look at the most common traditional assets: Stocks, Bonds, REITs, and Cash. It's essential to understand how risky/profitable these assets are and how they perform under different economic environments. Here's a summary table:
Note: These are general rules and may not always be correct.
Currently, we are in the transitional period between a slowdown and a contraction. Potential interest rate cuts are on the horizon. Therefore, based on the table above, the cash value is likely to decrease, bond prices are likely to increase in the future, and stock markets typically begin to rise well before the recovery emerges. Keep this in mind. We will revisit this at the end.
Picking specific assets from each class:
Here, I've selected the most representative assets for each class. You don’t have to choose the exact assets when constructing your own portfolio. This is simply a general example.
Stocks: S&P 500 (^GSPC) and iShares MSCI Emerging Market Index (EEM).
REITs: Digital Realty (DLR), Welltower (WELL), and AvalonBay (AVB).
Bonds: iShares USD Treasury bond 20 years (TLT).
Cash: U.S. Treasury Bills (USTB)
Note: ^GSPC, EEM, DLR, WELL, AVB, TLT are symbols that represent specific securities listed on an exchange. We will need to use these tickers in Python to retrieve the data we need. Digital Realty is a data centre REIT, Welltower is a healthcare REIT, and AvalonBay is a residential REIT.
Markowitz Portfolio Theory:
To build a diversified portfolio, we need to apply Markowitz Portfolio Theory. Markowitz Portfolio Theory, developed by economist Harry Markowitz in the 1950s, is a fundamental
concept in modern portfolio management. It provides a framework for investors to construct an optimal portfolio by balancing the trade-off between risk and return. Here are the principles of Markowitz Portfolio Theory we will use in this article:
Diversification: Markowitz emphasised the importance of diversification in reducing portfolio risk. By spreading investments across different assets or asset classes that are not perfectly correlated, investors can minimise the impact of negative events affecting any single investment.
Risk and Return: Markowitz introduced the concept of risk as the volatility of returns. He argued that investors are risk-averse and seek to maximise returns while minimising risk. The Efficient Frontier helps investors identify the optimal portfolio that provides the highest expected return for a given level of risk tolerance.
Efficient Frontier: The Efficient Frontier represents a set of portfolios that offer the highest expected return for a given level of risk or the lowest risk for a given level of return. Markowitz showed that by combining assets with different risk-return profiles, investors can construct portfolios that lie on the Efficient Frontier, optimising their risk-return trade-off.
Each point on the curve represents a different portfolio allocation.
Portfolios along the Efficient Frontier are considered efficient because they offer the highest return for a given level of risk or the lowest risk for a given level of return.
Investors can choose the portfolio that matches their risk tolerance and return objectives based on their preference for risk and return.
Using Python to Build Efficient Frontier
In the following steps, I will show you how to use Python to construct the Efficient Frontier. You can access the complete code in the attached file below.
Step 1: Collect Data.
Below is the code for getting the close prices for each asset from 2018-01-02 to 2024-04-11: We use tickers to retrieve the data for each asset from the Yahoo Finance Platform.
Step 2: Calculate the portfolio’s expected log return and volatility.
Logarithmic Return (Log Return): is calculated using the natural logarithm of the ratio of the final value to the initial value. The formula for log return is:
Where:
Pi is the initial price of the investment.
Pf is the final price of the investment.
ln represents the natural logarithm.
Simple Return: The simple return, also known as arithmetic return or percentage return, is calculated by subtracting the initial value from the final value of an investment, then dividing by the initial value, and expressing the result as a percentage. The formula for simple return is:
Compared to simple returns, log returns are preferred in finance because they have several desirable properties, including linearity over time periods and the ability to accurately represent the geometric growth rate of an investment over time. They are particularly useful for measuring returns over multiple periods and for analysing the performance of investments.
To calculate the overall log return and volatility of the entire portfolio, we first need to compute the log return and volatility of each individual asset. Afterward, we can assign weights to these assets.
In our example, the portfolio contains seven assets, so it’s better to use python to do the calculation.
Step 3: Find the efficient frontier.
After calculating the portfolio's expected return and volatility, our goal is to generate 1,000 different scenarios. To accomplish this, we must generate 1,000 different sets of weights and apply each set to the assets to calculate 1,000 portfolio returns and volatilities.
The following code stimulates 1,000 different combinations of the seven assets and creates a graph where 1,000 mean-variance simulations will be plotted to identify the most efficient combinations - the ones on the efficient frontier.
The red line above represents the efficient frontier. Combinations that lie on or above this frontier are efficient because, compared to those below it, they offer higher returns for the same level of risk.
Build the diversified portfolio!
Based on the graph above, we believe the circled combinations represent the most efficient options. Therefore, we construct our portfolio based on these five efficient combinations, aligning with our investment goals and market acumen.
Assuming we aim for a portfolio return above 7% and considering our belief in a probable transition from a slowdown to a contraction phase, with interest rate cuts on the horizon, we keep the investment in cash low. Additionally, given the tech giants' plans to invest more capital in data centres and the imminent retirement of US baby boomers, we find it wise to increase the weights of Digital Realty and Welltower REITs.
Weighing in all these factors, we should select Combination 5. This combination offers a return above 7% and consists of 26.63% S&P 500 index, 0.58% iShares MSCI Emerging Market Index, 32.67% Digital Realty, 24.95% Welltower, 11.76% AvalonBay, 1.9% iShares USD Treasury bond 20 years, and 3.5% U.S. Treasury Bills.
Feel free to use the code and build your own diversified portfolio!
Comments