code in R onlyHello Please check word doc i need help with #2 and #3 onlyi have attached the juypter notebook and dataset

code in R onlyHello Please check word doc i need help with #2 and #3 onlyi have attached the juypter notebook and dataset


Data Preparation Download the historial daily data of the entire 2018 for the 10 stocks universe = ['IBM', 'MSFT', 'GOOG', 'AAPL', 'AMZN', 'FB', 'NFLX', 'TSLA', 'ORCL', 'SAP'] For example, to download IBM data, use the following link to go to yahoo finance page. Find the "Download Data" link to download the csv file to you local disk. https://finance.yahoo.com/quote/IBM/history?period1=1514782800&period2=1546232400&interval=1d&filter=history&frequency=1d Replace "IBM" with other stock symbol in the above URL, you will be able to download data for other 9 stocks. You should have 10 csv files on your disk now. IBM.csv, MSFT.csv, etc. We call the 10 stocks "universe" which is the entire stock market you can trade. Retrieve the "Close" and "Adj Close" values for each stock You will create a dataframe where there are 20 columns for the 10 stocks, each row is the "Close" and "Adj Close" prices for the 10 stocks on each day, in the order of the business days in 2018. Assume all buy/sell on the "Close" prices and there is no transaction cost. You start to manage 5 million dollars fund on Jan 02, 2018 You have a strategy to manage the fund. 1. On Jan 02 2018, you split the $5m into 5 $1m, and use them to buy 5 stocks from the 10 stocks. For example, IBM close price was $154.25. With $1m, you can buy max 6482 shares with cost $999848.5 with $151.5‬ cash left. You decided to spend $1m on each of ['IBM', 'MSFT', 'GOOG', 'AAPL', 'AMZN'] respectively and keep the rest cash into a zero-interest cash account. On Jan 02 2018, your mark to market value (MTM) is $5m if combining all stocks value and cash. Your holdings of stocks and cach account is your portfolio.  ????=???ℎ?+∑?=15?ℎ??????×????????????  MTMt=casht+∑k=15Shareskt×ClosePricekt  2. Your trading strategy is "5 days rebalancing of buying low". Here is how it works. You keep your portfolio unchanged until 5 days later on Jan 09 2018. Now you want to re-check the market and adjust your portfolio. You will compute the "Adj Close" price changes from Jan 02 to Jan 09, and find the 5 stocks whose "Adj Close" prices dropped the most in terms of percentage. You sell all current holdings on Jan 09 "Close" prices to convert your portfolio to all cash. Then immediately split your cash, including your cash account, to 5 equal parts to buy the 5 stocks that dropped the most from Jan 02 to Jan 09 on 'Adj Close' prices. You always buy the max shares of stock on the "Close" price and keep the rest cash in cash account. Now the portfolio should be different from 5 days ago. This operation is called "rebalancing". Keep in mind, the MTM will change every day, even when your portfolio holdings don't change, because the stock prices change. 3. Corporations generally issue stock dividends on some days. The total dividend you get on such a day is the stock dividend times your shares if you have shares of this stock on the dividend day. If you buy shares on the dividend day, these bought shares are not qualified to get dividend. If you sell shares on the dividend day, the sold shares are qualified to get dividend. For example, on 2/8/2018, IBM issued $1.5 dividend per share. In your cash account, you will automatically get $1.5×(???? ??? ?ℎ???? ?? 2/8/2018)
May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here