Get data from Yahoo! Finance for Microsoft, McDonalds, and Johnson & Johnson for 2016-2021 and save them
Fantastic news! We've Found the answer you've been seeking!
Question:
Get data from Yahoo! Finance for Microsoft, McDonalds, and Johnson & Johnson for 2016-2021 and save them to .csv files.Then, give codes for a Python program that finds the portfolio weights on the three stocks that maximizes the Sharpe ratio.
- Calculate the log returns for each stock.
- Calculate the covariances between each pair of stocks.
- Use these covariances to create the covariance matrix in Python.
You can use the average return over the time period as the expected return. (This is a silly assumption, but we need to get numbers from somewhere!)
DO NOT forget to attach the CSV Files you worked on!
Related Book For
Posted Date: