Import stock prices
stocks <- tq_get(c("LULU", "NKE"),
get = "stock.prices",
from = "2024-01-01",
to = "2025-01-01")
stocks
## # A tibble: 504 × 8
## symbol date open high low close volume adjusted
## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 LULU 2024-01-02 509. 509. 502. 505. 1187800 505.
## 2 LULU 2024-01-03 502. 504. 497. 498. 1029200 498.
## 3 LULU 2024-01-04 497. 502 495. 496 1174400 496
## 4 LULU 2024-01-05 496. 499. 491. 491. 1121500 491.
## 5 LULU 2024-01-08 488. 493. 478. 491. 1827300 491.
## 6 LULU 2024-01-09 489. 490. 483. 486. 1242700 486.
## 7 LULU 2024-01-10 488 489. 483. 484. 1276000 484.
## 8 LULU 2024-01-11 483. 486. 478. 485. 823500 485.
## 9 LULU 2024-01-12 488. 491. 479. 480. 1050100 480.
## 10 LULU 2024-01-16 478. 478. 468. 471. 1370200 471.
## # ℹ 494 more rows
Plot stock prices
stocks %>%
ggplot(aes(x = date, y = adjusted, color = symbol)) +
geom_line()
