Import stock prices
stocks <- tq_get(c("PYPL", "GM", "ABNB", "AXP", "NVDA", "GOOGL"),
get = "stock.prices",
from = "2009-01-01")
stocks
## # A tibble: 18,536 × 8
## symbol date open high low close volume adjusted
## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 PYPL 2015-07-06 38 39.8 36 36.7 5866600 36.7
## 2 PYPL 2015-07-07 37.7 37.8 36 36.6 7359000 36.6
## 3 PYPL 2015-07-08 36.3 36.4 34.5 34.7 5387700 34.7
## 4 PYPL 2015-07-09 35.1 35.5 34.0 34.5 3760100 34.5
## 5 PYPL 2015-07-10 34.7 35.2 34.0 34.7 4472800 34.7
## 6 PYPL 2015-07-13 35.6 37.5 35.5 36.8 7626000 36.8
## 7 PYPL 2015-07-14 37.0 37.7 36.6 36.9 4653300 36.9
## 8 PYPL 2015-07-15 38.0 38.2 37.0 37.5 13072800 37.5
## 9 PYPL 2015-07-16 38.8 40.0 38.1 38.6 21348500 38.6
## 10 PYPL 2015-07-17 39.4 40.2 38.2 38.4 45720200 38.4
## # ℹ 18,526 more rows
Plot stock prices
stocks %>%
ggplot(aes(x = date, y = adjusted, color = symbol)) +
geom_line()
