Import stock prices
stocks <- tq_get(c("GOOG", "GME", "NVDA", "V"),
get = "stock.prices",
from = "2017-01-01")
stocks
## # A tibble: 7,716 × 8
## symbol date open high low close volume adjusted
## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 GOOG 2017-01-03 38.9 39.5 38.8 39.3 33146000 39.3
## 2 GOOG 2017-01-04 39.4 39.6 39.2 39.3 21460000 39.3
## 3 GOOG 2017-01-05 39.3 39.7 39.3 39.7 26704000 39.7
## 4 GOOG 2017-01-06 39.8 40.4 39.6 40.3 32804000 40.3
## 5 GOOG 2017-01-09 40.3 40.5 40.1 40.3 25492000 40.3
## 6 GOOG 2017-01-10 40.4 40.5 40.2 40.2 23536000 40.2
## 7 GOOG 2017-01-11 40.2 40.4 40.1 40.4 21318000 40.3
## 8 GOOG 2017-01-12 40.4 40.4 40.0 40.3 27062000 40.3
## 9 GOOG 2017-01-13 40.4 40.6 40.3 40.4 21984000 40.3
## 10 GOOG 2017-01-17 40.4 40.4 40.0 40.2 27242000 40.2
## # ℹ 7,706 more rows
Plot stock prices
stocks %>%
ggplot(aes(x = date, y = adjusted, color = symbol)) +
geom_line()
