Import stock prices

stocks <- tq_get(c("BALY", "GE", "NVDA", "SNAP", "CRON", "XOM"),
                 get = "stock.prices",
                 from = "2018-01-01",
                 to = "2024-06-01")
stocks
## # A tibble: 9,335 × 8
##    symbol date        open  high   low close volume adjusted
##    <chr>  <date>     <dbl> <dbl> <dbl> <dbl>  <dbl>    <dbl>
##  1 BALY   2019-03-29  29    30.0  29    30.0  61200     29.6
##  2 BALY   2019-04-01  31    31.1  30.5  31.0 222600     30.6
##  3 BALY   2019-04-02  31    31.5  30.6  31    40900     30.6
##  4 BALY   2019-04-03  31    31    29.9  31    28400     30.6
##  5 BALY   2019-04-04  31.1  31.2  31.0  31   369400     30.6
##  6 BALY   2019-04-05  31.2  31.5  30.9  31.5 179900     31.1
##  7 BALY   2019-04-08  31.1  31.8  31.1  31.7 535500     31.3
##  8 BALY   2019-04-09  32    32    31.0  31.7 310100     31.3
##  9 BALY   2019-04-10  32.0  33.4  31.5  32.2 324300     31.8
## 10 BALY   2019-04-11  32.7  33.2  32.7  33   474200     32.6
## # ℹ 9,325 more rows

Plot stock prices

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