Import stock prices

stocks <- tq_get(c("META", "AVGO"),
                 get = "stock.prices",
                 from = "2020-01-01",
                 to = "2022-01-01")
stocks
## # A tibble: 1,010 × 8
##    symbol date        open  high   low close   volume adjusted
##    <chr>  <date>     <dbl> <dbl> <dbl> <dbl>    <dbl>    <dbl>
##  1 META   2020-01-02  207.  210.  206.  210. 12077100     208.
##  2 META   2020-01-03  207.  210.  207.  209. 11188400     207.
##  3 META   2020-01-06  207.  213.  207.  213. 17058900     211.
##  4 META   2020-01-07  213.  215.  212.  213. 14912400     211.
##  5 META   2020-01-08  213   216.  213.  215. 13475000     213.
##  6 META   2020-01-09  218.  218.  216.  218. 12642800     216.
##  7 META   2020-01-10  219.  220.  217.  218. 12119400     216.
##  8 META   2020-01-13  220.  222.  219.  222. 14463400     220.
##  9 META   2020-01-14  222.  222.  219.  219. 13288900     217.
## 10 META   2020-01-15  221.  222.  220.  221. 10036500     219.
## # ℹ 1,000 more rows

Plot stock prices

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