Import stock prices

stocks <- tq_get(c("AAPL", "MSFT", "DELL", "GOOG"),
                 get = "stock.prices",
                 from = "2020-01-01",)
                 
stocks
## # A tibble: 4,416 × 8
##    symbol date        open  high   low close    volume adjusted
##    <chr>  <date>     <dbl> <dbl> <dbl> <dbl>     <dbl>    <dbl>
##  1 AAPL   2020-01-02  74.1  75.2  73.8  75.1 135480400     73.0
##  2 AAPL   2020-01-03  74.3  75.1  74.1  74.4 146322800     72.3
##  3 AAPL   2020-01-06  73.4  75.0  73.2  74.9 118387200     72.8
##  4 AAPL   2020-01-07  75.0  75.2  74.4  74.6 108872000     72.5
##  5 AAPL   2020-01-08  74.3  76.1  74.3  75.8 132079200     73.7
##  6 AAPL   2020-01-09  76.8  77.6  76.6  77.4 170108400     75.2
##  7 AAPL   2020-01-10  77.7  78.2  77.1  77.6 140644800     75.4
##  8 AAPL   2020-01-13  77.9  79.3  77.8  79.2 121532000     77.0
##  9 AAPL   2020-01-14  79.2  79.4  78.0  78.2 161954400     76.0
## 10 AAPL   2020-01-15  78.0  78.9  77.4  77.8 121923600     75.6
## # ℹ 4,406 more rows

Plot stock prices

stocks %>%
    
    ggplot(aes(x = date, y = adjusted, color = symbol)) +
    geom_line()