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.
Introduction: 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!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2019
Categories |