Import stock prices
stocks <- tq_get(c("DLR", "GOOG", "NVDA"),
get = "stock.prices",
from = "2020-01-01")
stocks
## # A tibble: 5,034 × 8
## symbol date open high low close volume adjusted
## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 DLR 2020-01-02 120. 120. 117. 118 1071900 94.8
## 2 DLR 2020-01-03 117. 120. 117. 120. 869400 96.3
## 3 DLR 2020-01-06 119. 120. 118. 119. 1151000 95.5
## 4 DLR 2020-01-07 118. 119. 117. 118. 1006400 94.5
## 5 DLR 2020-01-08 118. 119. 117. 119. 2553900 95.4
## 6 DLR 2020-01-09 118. 120. 118. 119. 980000 95.4
## 7 DLR 2020-01-10 119. 121. 118. 120. 2048800 96.7
## 8 DLR 2020-01-13 121. 122. 120. 122. 2072100 98.0
## 9 DLR 2020-01-14 122. 123. 120. 121. 2408200 97.0
## 10 DLR 2020-01-15 121. 122. 121. 121. 1443700 97.2
## # ℹ 5,024 more rows
Plot stock prices
stocks %>%
ggplot(aes(x = date, y = adjusted, color = symbol)) +
geom_line()
