Description Usage Arguments Details Value See Also Examples
View source: R/get_prices_from_tickers.R
Returns daily Open or Close prices between start
and end
date for given tickers.
1 2 3 4 5 6 7 |
... |
character vectors indicating tickers (should be valid in Yahoo Finance). |
start |
an object of |
end |
an object of |
quote |
a character indicating the type of the price: |
retclass |
a character specifying the return class: |
This function uses the function getSymbols
form the quantmod
package. The provider is set automatically to Yahoo Finance. The function
returns the data in different class-containers: list of zoo
's,
zoo
, or data.frame
.
Prices of securities as "list"
, "zoo"
, or
"data.frame"
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ## Download historical prices of seven companies' stocks:
## Not run:
library("magrittr")
tickers <- c("AMZN", "ZM", "UBER", "NFLX", "SHOP", "FB", "UPWK")
prices <- tickers %>%
get_prices_from_tickers(start = as.Date("2019-04-01"),
end = as.Date("2020-04-01"),
quote = "Close",
retclass = "zoo")
## End(Not run)
## The result of the above code is stored in:
data(prices)
## Download historical prices of S&P 500 index:
## Not run:
prices_indx <- get_prices_from_tickers("^GSPC",
start = as.Date("2019-04-01"),
end = as.Date("2020-04-01"),
quote = "Close",
retclass = "zoo")
## End(Not run)
## The result of the above code is stored in:
data(prices_indx)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.