Import stock prices

stocks <- tq_get(c("NOC", "WMT","UPS","UNH"),
                 get = "stock.prices",
                 from = "2016-01-01")
stocks
## # A tibble: 8,724 × 8
##    symbol date        open  high   low close  volume adjusted
##    <chr>  <date>     <dbl> <dbl> <dbl> <dbl>   <dbl>    <dbl>
##  1 NOC    2016-01-04  186.  188.  185.  188. 1476100     163.
##  2 NOC    2016-01-05  188.  193.  188.  192. 2302200     167.
##  3 NOC    2016-01-06  190.  193.  190   190. 1879700     166.
##  4 NOC    2016-01-07  188.  190.  186.  188. 2136100     164.
##  5 NOC    2016-01-08  189.  190.  186.  186. 1503300     162.
##  6 NOC    2016-01-11  187.  189.  186.  188. 1773800     164.
##  7 NOC    2016-01-12  189.  189.  188.  189. 1010400     164.
##  8 NOC    2016-01-13  189   189.  185.  185. 1099200     161.
##  9 NOC    2016-01-14  185.  187.  183.  186. 1062100     161.
## 10 NOC    2016-01-15  181   185.  180.  184. 1532800     160.
## # ℹ 8,714 more rows

Plot stock prices

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