Import stock prices
stocks <- tq_get(c("RIVN", "LCID", "F"),
get = "stock.prices",
from = "2024-01-01")
stocks
## # A tibble: 1,254 × 8
## symbol date open high low close volume adjusted
## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 RIVN 2024-01-02 21.9 21.9 20.8 21.1 49626300 21.1
## 2 RIVN 2024-01-03 20.5 20.7 19.7 20.3 35634500 20.3
## 3 RIVN 2024-01-04 19.9 20.3 19.5 19.5 28453000 19.5
## 4 RIVN 2024-01-05 19.4 19.9 19 19.1 27468400 19.1
## 5 RIVN 2024-01-08 19.1 19.6 18.9 19.6 18745500 19.6
## 6 RIVN 2024-01-09 19.6 19.8 19.2 19.2 18403000 19.2
## 7 RIVN 2024-01-10 19.3 19.4 18.9 19.1 14916700 19.1
## 8 RIVN 2024-01-11 18.9 19.1 18.3 18.8 22677600 18.8
## 9 RIVN 2024-01-12 18.4 18.9 17.8 18.1 29742200 18.1
## 10 RIVN 2024-01-16 17.7 18.0 17.1 17.8 21092800 17.8
## # ℹ 1,244 more rows
Plot stock prices
stocks %>%
ggplot(aes(x = date, y = adjusted, color = symbol)) +
geom_line()
