Import stock prices
stocks <- tq_get(c("DELL", "NVDA"),
get = "stock.prices",
from = "2024-09-04")
stocks
## # A tibble: 500 × 8
## symbol date open high low close volume adjusted
## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 DELL 2024-09-04 109 111. 107. 109. 8113600 107.
## 2 DELL 2024-09-05 107 108. 105. 107. 9362400 105.
## 3 DELL 2024-09-06 107. 108. 101. 102 11962600 100.
## 4 DELL 2024-09-09 107. 108. 105. 106. 18742700 104.
## 5 DELL 2024-09-10 106. 108. 105. 107. 9367400 105.
## 6 DELL 2024-09-11 107. 109. 106. 109. 9715100 107.
## 7 DELL 2024-09-12 109. 113. 109. 112. 9893500 110.
## 8 DELL 2024-09-13 112. 115. 111. 114. 7353300 112.
## 9 DELL 2024-09-16 112. 116. 112. 115. 8618900 113.
## 10 DELL 2024-09-17 118. 118. 115. 117. 9412700 115.
## # ℹ 490 more rows
Plot stock prices
stocks %>%
ggplot(aes(x = date, y = adjusted, color = symbol)) +
geom_line()
