Consider a portfolio with four stocks - Apple, Microsoft, Facebook and Tesla during the two-year period between the beginning of 2016 and the end of 2017. You want to find how much you would have made if you invested $1 million at the beginning of the given period. Find the answer by revising the given code and by answering the five questions.
## [1] "AAPL" "MSFT" "FB" "TSLA"
## NULL
## TSLA.Adjusted AAPL.Adjusted MSFT.Adjusted FB.Adjusted
## 2016-01-04 223.41 101.01418 51.92759 102.22
## 2016-01-05 223.43 98.48284 52.16449 102.73
## 2016-01-06 219.04 96.55557 51.21690 102.97
## 2016-01-07 215.65 92.48048 49.43544 97.92
## 2016-01-08 211.00 92.96949 49.58706 97.33
## 2016-01-11 207.85 94.47488 49.55863 97.51
## TSLA.Adjusted AAPL.Adjusted MSFT.Adjusted FB.Adjusted
## 2016-01-04 223.41 101.01418 51.92759 102.22
## 2016-01-05 223.43 98.48284 52.16449 102.73
## 2016-01-06 219.04 96.55557 51.21690 102.97
## 2016-01-07 215.65 92.48048 49.43544 97.92
## 2016-01-08 211.00 92.96949 49.58706 97.33
## 2016-01-11 207.85 94.47488 49.55863 97.51
## TSLA.Adjusted AAPL.Adjusted MSFT.Adjusted FB.Adjusted
## 2017-12-21 331.66 174.2994 85.10024 177.45
## 2017-12-22 325.20 174.2994 85.11020 177.20
## 2017-12-26 317.29 169.8774 85.00071 175.99
## 2017-12-27 311.64 169.9073 85.30926 177.62
## 2017-12-28 315.36 170.3853 85.31921 177.92
## 2017-12-29 311.35 168.5428 85.14006 176.46
## TSLA.Adjusted AAPL.Adjusted MSFT.Adjusted FB.Adjusted
## 2016-01-04 NA NA NA NA
## 2016-01-05 8.947227e-05 -0.025059273 0.0045620639 0.004989258
## 2016-01-06 -1.964821e-02 -0.019569582 -0.0181654225 0.002336202
## 2016-01-07 -1.547662e-02 -0.042204679 -0.0347825815 -0.049043439
## 2016-01-08 -2.156269e-02 0.005287754 0.0030670100 -0.006025286
## 2016-01-11 -1.492888e-02 0.016192258 -0.0005733552 0.001849378
## TSLA.Adjusted AAPL.Adjusted MSFT.Adjusted FB.Adjusted
## 2017-12-21 0.00814637 0.003785477 -0.0002338459 -0.002473450
## 2017-12-22 -0.01947775 0.000000000 0.0001169914 -0.001408848
## 2017-12-26 -0.02432350 -0.025369949 -0.0012864381 -0.006828397
## 2017-12-27 -0.01780703 0.000175868 0.0036300285 0.009261833
## 2017-12-28 0.01193675 0.002813552 0.0001166227 0.001689016
## 2017-12-29 -0.01271556 -0.010813631 -0.0020998084 -0.008205885
## portfolio.returns
## 2016-01-05 -0.0038546196
## 2016-01-06 -0.0137102452
## 2016-01-07 -0.0354267785
## 2016-01-08 -0.0049659849
## 2016-01-11 0.0005346121
## 2016-01-12 0.0132536347
## portfolio.returns
## 2017-12-21 0.0021024580
## 2017-12-22 -0.0047335246
## 2017-12-26 -0.0142099659
## 2017-12-27 -0.0004807838
## 2017-12-28 0.0037956019
## 2017-12-29 -0.0083187855
## portfolio.returns
## 2016-01-05 -0.0038546196
## 2016-01-06 -0.0137102452
## 2016-01-07 -0.0354267785
## 2016-01-08 -0.0049659849
## 2016-01-11 0.0005346121
## 2016-01-12 0.0132536347
## portfolio.returns
## 2017-12-21 0.002389625
## 2017-12-22 -0.005404079
## 2017-12-26 -0.014577550
## 2017-12-27 -0.001300070
## 2017-12-28 0.004139086
## 2017-12-29 -0.008449070
# -The rebalanced monthly portfolio
# -Facebook Preformed the best during the study period.
# -Tesla has preformed the best in the last month.
## TSLA.Adjusted AAPL.Adjusted MSFT.Adjusted FB.Adjusted
## 2016-01-05 0.2509898 0.2446783 0.2521123 0.2522195
## 2016-01-06 0.2494788 0.2432247 0.2509735 0.2563230
## 2016-01-07 0.2546387 0.2415156 0.2511411 0.2527046
## 2016-01-08 0.2503914 0.2440044 0.2531686 0.2524355
## 2016-01-11 0.2465216 0.2478229 0.2528882 0.2527672
## 2016-01-12 0.2457786 0.2481310 0.2518710 0.2542194
## TSLA.Adjusted AAPL.Adjusted MSFT.Adjusted FB.Adjusted
## 2017-12-21 0.2254482 0.2620413 0.2488794 0.2636310
## 2017-12-22 0.2221084 0.2632876 0.2500923 0.2645117
## 2017-12-26 0.2198297 0.2603070 0.2533710 0.2664923
## 2017-12-27 0.2160190 0.2604780 0.2544131 0.2690899
## 2017-12-28 0.2177710 0.2602232 0.2534806 0.2685252
## 2017-12-29 0.2168055 0.2595685 0.2550702 0.2685558
## [1] 1 1 1 1 1 1
## [1] 1 1 1 1 1 1
## TSLA.Adjusted AAPL.Adjusted MSFT.Adjusted FB.Adjusted
## 2016-01-05 0.2509898 0.2446783 0.2521123 0.2522195
## 2016-01-06 0.2494788 0.2432247 0.2509735 0.2563230
## 2016-01-07 0.2546387 0.2415156 0.2511411 0.2527046
## 2016-01-08 0.2503914 0.2440044 0.2531686 0.2524355
## 2016-01-11 0.2465216 0.2478229 0.2528882 0.2527672
## 2016-01-12 0.2457786 0.2481310 0.2518710 0.2542194
## TSLA.Adjusted AAPL.Adjusted MSFT.Adjusted FB.Adjusted
## 2017-12-21 0.2613060 0.2478090 0.2471796 0.2437054
## 2017-12-22 0.2576084 0.2491555 0.2485517 0.2446843
## 2017-12-26 0.2550607 0.2464267 0.2519041 0.2466085
## 2017-12-27 0.2508449 0.2467909 0.2531476 0.2492165
## 2017-12-28 0.2527928 0.2464651 0.2521336 0.2486085
## 2017-12-29 0.2517051 0.2458774 0.2537481 0.2486694
## [1] 1 1 1 1 1 1
## [1] 1 1 1 1 1 1