I find it fun to apply the concepts from Exam 9 in the real world, especially the concepts on portfolio management. In BKM Chapter 7, we learn about the Markowitz Portfolio Selection Model and the Efficient Frontier. In this post, we take the concepts further with Python and construct an efficient frontier for a portfolio with multiple securities.
For simplicity, we work with a portfolio with 4 stocks; you could modify the codes to include as many stocks as you would like.
The codes are written in Python along with commentaries, which make it less difficult to follow. Even if you are new to Python, it is NOT too hard to follow.
Section 1 shows how to pull stock prices from the Internet and organize them.
(You could skip this section if you are not familiar the Python libraries used. The dataset is saved and reloaded in Section 2.)
Section 2 shows the calculation of expected returns and standard deviation for random portfolios and portfolios on the efficient frontier, as well as the plot for efficient frontier. Matrix operation and optimization are used (Thank God, this is not tested on Exam 9!!)
Let's get the fun started!
Video Lesson #2: Covariance share 2010Q14
Video Lesson #1: Convexity 2018Q4
Write something about yourself. No need to be fancy, just an overview.