README.md

YahooFinance (R package)

"logo"

YahooFinance offers the possibility to access the Yahoo Finance market data in R and supports the tidyverse. This package was ported from Julia's YahooFinance.jl and is available in Python as pyahoofinance.

Installation

install.packages("YahooFinance")

or use github

devtools::install_github("markushhh/YahooFinance")

Usage

Load the package and retrieve a time series.

library("YahooFinance")

x <- get_symbols("GOOG", "2018-12-13", "2019-06-28")
print(x)
#> # A tsibble: 135 x 8 [1D]
#> # Key:       Symbol [1]
#>    Symbol Date        Open  High   Low Close  Volume Adj_Close
#>    <chr>  <date>     <dbl> <dbl> <dbl> <dbl>   <int>     <dbl>
#>  1 GOOG   2018-12-13 1068. 1080. 1054. 1062. 1329800     1062.
#>  2 GOOG   2018-12-14 1050. 1063. 1041. 1042. 1686600     1042.
#>  3 GOOG   2018-12-17 1038. 1053. 1008. 1017. 2385400     1017.
#>  4 GOOG   2018-12-18 1026. 1049. 1021. 1029. 2192500     1029.
#>  5 GOOG   2018-12-19 1034. 1062  1008. 1023. 2479300     1023.
#>  6 GOOG   2018-12-20 1018. 1034.  996. 1009. 2673500     1009.
#>  7 GOOG   2018-12-21 1015. 1024.  974.  980. 4596000      980.
#>  8 GOOG   2018-12-24  974. 1004.  970.  976. 1590300      976.
#>  9 GOOG   2018-12-26  989. 1040   983  1039. 2373300     1039.
#> 10 GOOG   2018-12-27 1017. 1044.  997  1044. 2109800     1044.
#> # ... with 125 more rows
library("YahooFinance")
library("ggplot2") # for plots
library("magrittr") # pipe %>%

x <- get_symbols(c("JNJ", "AAPL", "ACN", "DHR", "DTE"), "2018-12-13", "2019-06-28")

p <- x %>%
  ggplot(aes(Date, Close)) +
  geom_line(aes(col = Symbol), size = 1) +
  theme_bw() + 
  xlab("") +
  ylab("")

"plot"

This project is not associated with nor sponsored by Yahoo! Inc. Yahoo! Inc. is the exclusive owner of all trademark and other intellectual property rights in and to the YAHOO! and Y! trademarks (the "Trademarks"), including the stylized YAHOO! and Y! logos. Yahoo! Inc. owns trademark registrations for the Trademarks.


markushhh/YahooFinance documentation built on Jan. 24, 2020, 3:19 a.m.