Import stock prices

stocks <- tq_get(c("FNV", "WPM", "NEM", "CCJ", "CEG", "BWXT", "NVDA", "TSM", "ASML", "CAT", "ITW", "HON", "PLD", "EQIX", "PSA", "TPL", "XOM", "CVX"),
                 get = "stock.prices",
                 from = "2024-01-01",
                 to = "2026-09-08")
stocks
## # A tibble: 12,096 × 8
##    symbol date        open  high   low close  volume adjusted
##    <chr>  <date>     <dbl> <dbl> <dbl> <dbl>   <dbl>    <dbl>
##  1 FNV    2024-01-02  111.  113.  111.  111.  809400     109.
##  2 FNV    2024-01-03  110.  114.  109.  112. 1339600     110.
##  3 FNV    2024-01-04  112.  112.  111.  111.  528800     109.
##  4 FNV    2024-01-05  111.  112.  109.  110.  658700     108.
##  5 FNV    2024-01-08  109   110.  108.  109.  515600     107.
##  6 FNV    2024-01-09  109.  109.  107.  107.  857100     105.
##  7 FNV    2024-01-10  107.  108   106.  106.  857300     104.
##  8 FNV    2024-01-11  106.  107.  105.  106.  702200     104.
##  9 FNV    2024-01-12  108.  110.  108.  110.  676200     107.
## 10 FNV    2024-01-16  109.  110.  107.  109.  848000     107.
## # ℹ 12,086 more rows

Plot stock prices

p <- stocks %>%
    
    ggplot(aes(x = date, y = adjusted, color = symbol,
            text = paste0(symbol, "<br>", date, "<br>$", round(adjusted, 2)))) +
    geom_line(aes(group = symbol))

ggplotly(p, tooltip = "text")