Import stock prices

stocks <- tq_get(c("WMT", "HD", "MSFT"),
                 get = "stock.prices",
                 from = "2016-01-01")
stocks
## # A tibble: 5,808 × 8
##    symbol date        open  high   low close   volume adjusted
##    <chr>  <date>     <dbl> <dbl> <dbl> <dbl>    <dbl>    <dbl>
##  1 WMT    2016-01-04  60.5  61.5  60.4  61.5 11989200     52.5
##  2 WMT    2016-01-05  62.0  63.0  61.8  62.9 13326000     53.8
##  3 WMT    2016-01-06  62.5  64.0  62.5  63.5 16564600     54.3
##  4 WMT    2016-01-07  63.0  65.2  62.9  65.0 26430000     55.6
##  5 WMT    2016-01-08  65.1  65.4  63.4  63.5 17767900     54.3
##  6 WMT    2016-01-11  63.8  64.5  63.6  64.2 12653800     54.9
##  7 WMT    2016-01-12  64.4  64.7  63.4  63.6 12195900     54.4
##  8 WMT    2016-01-13  63.7  63.7  61.8  61.9 13725700     52.9
##  9 WMT    2016-01-14  62    63.6  61.8  63.1 12934900     53.9
## 10 WMT    2016-01-15  61.5  62.5  61.3  61.9 15174400     52.9
## # ℹ 5,798 more rows

Plot stock prices

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