powered by
This function downloads financial data from https://finance.yahoo.com/ and returns it as a data.frame.
data.frame
download_data( symbol, from = "1902-01-01", to = Sys.Date(), fill_dates = FALSE, columns = c("Date", "Open", "High", "Low", "Close", "Adj.Close", "Volume") )
A data.frame.
A character, the stock's symbol.
character
It must match the identifier on https://finance.yahoo.com/.
A character in the format "YYYY-MM-DD", setting the lower data bound.
"YYYY-MM-DD"
Must not be earlier than "1902-01-01" (default).
"1902-01-01"
A character in the format "YYYY-MM-DD", setting the upper data bound.
Default is the current date Sys.date().
Sys.date()
Set to TRUE to fill missing dates (e.g., days at which the stock market is closed) with NA's.
TRUE
NA
By default, fill_dates = FALSE.
fill_dates = FALSE
A character of requested data columns, see the details.
By default, all columns are returned.
Yahoo Finance provides historical daily data for stocks or indices. The following data columns are available:
Date: The date.
Date
Open: Opening price.
Open
High: Highest price.
High
Low: Lowest price.
Low
Close: Close price adjusted for splits.
Close
Adj.Close: Close price adjusted for dividends and splits.
Adj.Close
Volume: Trade volume.
Volume
### 21st century DAX closing prices data <- download_data( symbol = "^GDAXI", from = "2000-01-01", columns = c("Date", "Close"), fill_dates = TRUE ) head(data)
Run the code above in your browser using DataLab