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

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.

  1. Calculate the log returns for each stock.
  2. Calculate the covariances between each pair of stocks.
  3. 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!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!