1 Import stock prices of your choice

## # A tibble: 3,765 × 8
##    symbol date        open  high   low close  volume adjusted
##    <chr>  <date>     <dbl> <dbl> <dbl> <dbl>   <dbl>    <dbl>
##  1 CAT    2021-01-04  183   186.  180.  182. 4078300     165.
##  2 CAT    2021-01-05  181.  186.  181.  184. 2933700     166.
##  3 CAT    2021-01-06  187.  197.  186.  194. 8034700     175.
##  4 CAT    2021-01-07  197.  197.  192.  194. 5297500     176.
##  5 CAT    2021-01-08  194.  195.  191.  194. 3186600     176.
##  6 CAT    2021-01-11  192.  195.  190.  194. 2540800     175.
##  7 CAT    2021-01-12  195.  198   193.  198. 2466100     179.
##  8 CAT    2021-01-13  199.  200.  196.  196. 3154700     177.
##  9 CAT    2021-01-14  196.  198.  195.  197. 2486600     178.
## 10 CAT    2021-01-15  196.  196.  191.  195. 3317100     176.
## # ℹ 3,755 more rows

2 Convert prices to returns by quarterly

## # A tibble: 60 × 3
##    asset date       returns
##    <chr> <date>       <dbl>
##  1 CAT   2021-03-31  0.247 
##  2 CAT   2021-06-30 -0.0589
##  3 CAT   2021-09-30 -0.120 
##  4 CAT   2021-12-31  0.0796
##  5 CAT   2022-03-31  0.0797
##  6 CAT   2022-06-30 -0.216 
##  7 CAT   2022-09-30 -0.0787
##  8 CAT   2022-12-30  0.385 
##  9 CAT   2023-03-31 -0.0410
## 10 CAT   2023-06-30  0.0779
## # ℹ 50 more rows

3 Make plot

4 Interpret the plot

The stock with the highest typical gain appears to be CAT with a gain from about 10-25% for most of their quarters in the given time period

The stock with the lowest gain in a quarter is Amazon by a significant margin. One of their losses in a quarter exceeded 50%

The stock with the highest gain for a quarter also happens to be CAT with about a 38% gain in one quarter

5 Change the global chunck options

Hide the code, messages, and warnings