Python questions

1) (1 points) Pull 20 years of monthly stock price and trading volume data for any 20 stocks of your pick from Yahoo Finance.

(2) (2 points) Calculate the monthly returns and 12-month moving average of each stock.

(3) (3 points) Construct an equal-weighted portfolio of the 20 stocks and plot the time series of the portfolio returns and the time series of 12-month moving average of the portfolio returns.

(4) (4 points) Drop the bottom decile of stocks with lowest trading volumes each month, and repeat the same task in question (3).

Sample Solution