View source: R/download_data.R
download_data | R Documentation |
This function downloads financial data from https://finance.yahoo.com/
and returns it as a 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")
)
symbol |
A It must match the identifier on https://finance.yahoo.com/. |
from |
A Must not be earlier than |
to |
A Default is the current date |
fill_dates |
Set to By default, |
columns |
A 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.
Open
: Opening price.
High
: Highest price.
Low
: Lowest price.
Close
: Close price adjusted for splits.
Adj.Close
: Close price adjusted for dividends and splits.
Volume
: Trade volume.
A data.frame
.
### 21st century DAX closing prices
data <- download_data(
symbol = "^GDAXI", from = "2000-01-01", columns = c("Date", "Close"),
fill_dates = TRUE
)
head(data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.