Import stock prices

stocks <- tq_get(c("COST", "META", "TSLA"),
                 get = "stock.prices",
                 from = "2016-01-01")
stocks
## # A tibble: 8,055 × 8
##    symbol date        open  high   low close  volume adjusted
##    <chr>  <date>     <dbl> <dbl> <dbl> <dbl>   <dbl>    <dbl>
##  1 COST   2016-01-04  160.  160.  158.  160. 2640800     134.
##  2 COST   2016-01-05  160.  161.  159.  160. 2127700     134.
##  3 COST   2016-01-06  158.  160.  158.  158. 2033400     133.
##  4 COST   2016-01-07  155.  157.  154.  155. 3826000     130.
##  5 COST   2016-01-08  155.  155.  152.  152. 3156200     127.
##  6 COST   2016-01-11  152.  156.  152.  155. 2164500     130.
##  7 COST   2016-01-12  156.  156.  155.  156. 2215600     131.
##  8 COST   2016-01-13  156.  156.  152.  152. 2157500     127.
##  9 COST   2016-01-14  152.  154.  151.  153. 2281500     128.
## 10 COST   2016-01-15  149.  152.  148.  150. 2975400     126.
## # ℹ 8,045 more rows

Plot stock prices

stocks %>%
    
    ggplot(aes(x = date, y = adjusted, color = symbol)) +
    geom_line()