Import stock prices
stocks <- tq_get(c("GOOGL", "MSFT", "NVDA", "META"),
get = "stock.prices",
from = "2025-01-01")
stocks
## # A tibble: 664 × 8
## symbol date open high low close volume adjusted
## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 GOOGL 2025-01-02 191. 192 188. 189. 20370800 189.
## 2 GOOGL 2025-01-03 191. 193. 190. 192. 18596200 191.
## 3 GOOGL 2025-01-06 194. 198. 194. 197. 29563600 196.
## 4 GOOGL 2025-01-07 197. 201 195. 195. 26487200 195.
## 5 GOOGL 2025-01-08 193. 196. 192. 194. 24864800 193.
## 6 GOOGL 2025-01-10 194. 197. 190. 192. 26665200 192.
## 7 GOOGL 2025-01-13 190. 191. 187. 191. 21823700 191.
## 8 GOOGL 2025-01-14 191. 192. 188. 190. 17174900 189.
## 9 GOOGL 2025-01-15 193. 196. 192. 196. 21776000 195.
## 10 GOOGL 2025-01-16 194. 195. 193. 193. 17815400 192.
## # ℹ 654 more rows
Plot stock prices
stocks %>%
ggplot(aes(x = date, y = adjusted, color = symbol)) +
geom_line()
