Weighting optimisation: from Markowitz's theory to practice with Python
Under a neutral interpretation, the analysis of the stock market and/or a specific company listed on it, can be carried out by means of:
Let's start with the "easy", i.e. a simple look into the companies' past.
Again, the graph in Figure 1 is included as it is useful to look at the relative frequency of daily returns over time for each of the assets (the "law" of large numbers may actually work).
For the values in the graph in Figure 3, the Montecarlo simulation method has been used with no less than 100000 iterations! The result is the point with the maximum Sharpe Ratio (ratio of return to risk).
Nothing new for those who are used to it, but the good thing about programming it (in Python in this case) is that you just have to change the names of the assets and dates to analyse and the program executes everything. Remember that we are talking about a basic analysis where we are only taking into account historical data of daily prices.
Caution! Figure 4 is just an illustrative example. It is not, under any circumstances, investment advice. It is already apparent how little diversification is represented in the correlation matrix (Figure 2) as either their returns are directly related or they are simply not, but there is no inverse relationship to smooth out possible market downturns.
Recommended by LinkedIn
Risk-free return used = 3.00 %/year
Theory used: Markowitz Portfolio Theory
Data extracted from: Yahoo Finance
Data processed with: Python
Optimisation method: SciPy optimizer - SLSQP
Impressive application of Markowitz's optimization theory in Python—this really showcases the practical side of financial theories in modern stock market analysis!