Import stock prices

stocks <- tq_get(c("ROKU", "AAPL", "CL=F"),
                 get = "stock.prices",
                 from = "2019-01-01",
                 to = "2020-01-01")
stocks
## # A tibble: 756 × 8
##    symbol date        open  high   low close   volume adjusted
##    <chr>  <date>     <dbl> <dbl> <dbl> <dbl>    <dbl>    <dbl>
##  1 ROKU   2019-01-02  29.8  32.7  29.3  32.5 11890300     32.5
##  2 ROKU   2019-01-03  31.9  32.2  29.5  30.1 14989400     30.1
##  3 ROKU   2019-01-04  30.7  34.1  30.5  33.7 15505500     33.7
##  4 ROKU   2019-01-07  36.8  43.0  36.5  42.2 42253700     42.2
##  5 ROKU   2019-01-08  44.0  44.5  37.9  40.9 44167700     40.9
##  6 ROKU   2019-01-09  40.4  43.6  39.7  42.1 19848200     42.1
##  7 ROKU   2019-01-10  41.1  42.7  40.0  40.2 17148800     40.2
##  8 ROKU   2019-01-11  40.2  40.4  38.8  39.6 12528200     39.6
##  9 ROKU   2019-01-14  38.9  41.3  38.6  39.5 11192700     39.5
## 10 ROKU   2019-01-15  40.0  41.3  39.3  40.5 10322200     40.5
## # ℹ 746 more rows

Plot stock prices

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