Goal

Visualize and examine changes in the underlying trend in the performance of your portfolio in terms of Sharpe Ratio.

Choose your stocks.

from 2012-12-31 to present

1 Import stock prices

2 Convert prices to returns

3 Assign a weight to each asset

## [1] "AMZN" "TM"   "TSLA"
## [1] 0.50 0.25 0.25
## # A tibble: 3 × 2
##   symbols weights
##   <chr>     <dbl>
## 1 AMZN       0.5 
## 2 TM         0.25
## 3 TSLA       0.25

4 Build a portfolio

## # A tibble: 60 × 2
##    date        returns
##    <date>        <dbl>
##  1 2013-01-31  0.0595 
##  2 2013-02-28 -0.00259
##  3 2013-03-28  0.0284 
##  4 2013-04-30  0.0954 
##  5 2013-05-31  0.181  
##  6 2013-06-28  0.0455 
##  7 2013-07-31  0.0992 
##  8 2013-08-30  0.0204 
##  9 2013-09-30  0.104  
## 10 2013-10-31  0.0313 
## # ℹ 50 more rows

5 Calculate Sharpe Ratio

## # A tibble: 1 × 1
##   `StdDevSharpe(Rf=0%,p=95%)`
##                         <dbl>
## 1                       0.420

6 Plot

Returns Histogram with Risk-Free Rate

Scatter Returns around Risk Free Rate

Rolling Sharpe

## # A tibble: 37 × 3
##    date         returns sharpeRatio
##    <date>         <dbl>       <dbl>
##  1 2014-12-31 -0.0626         0.428
##  2 2015-01-30  0.0511         0.424
##  3 2015-02-27  0.0469         0.458
##  4 2015-03-31 -0.0176         0.423
##  5 2015-04-30  0.106          0.426
##  6 2015-05-29  0.0327         0.383
##  7 2015-06-30  0.0148         0.361
##  8 2015-07-31  0.103          0.363
##  9 2015-08-31 -0.0687         0.282
## 10 2015-09-30 -0.000515       0.219
## # ℹ 27 more rows

How has your portfolio performed over time? Provide dates of the structural breaks, if any. The Code Along Assignment 9 had one structural break in November 2016. What do you think the reason is?

My portfolio has performed well over time. You can see above in the rolling sharpe chart that the risk-adjusted return has been above average despite the 2016 structural break. It is the only break in the chart and is due to the oil scare and uncertainty related to china during the time.