This lesson requires a premium membership to access.
Premium membership includes unlimited access to all courses, quizzes, downloadable resources, and future content updates.
Ask questions about this lesson and get instant answers.
To calculate the returns of AAPL & GOOG over the time period, you can use the Return.calculate function.
1stockReturns <- Return.calculate(adjustedPrices)
2head(stockReturns)
3## AAPL.Adjusted GOOG.Adjusted
4## 2017-01-03 NA NA
5## 2017-01-04 -0.001119178 0.0009667604
6## 2017-01-05 0.005085153 0.0090481583
7## 2017-01-06 0.011148442 0.0152766979
8## 2017-01-09 0.009159465 0.0006202319
9## 2017-01-10 0.001008411 -0.0023058897
10