# NOT RUN {
## Download historical prices of seven companies' stocks and estimate rates
## of returns form prices:
# }
# NOT RUN {
library("magrittr")
tickers <- c("AMZN", "ZM", "UBER", "NFLX", "SHOP", "FB", "UPWK")
rates <- tickers %>%
get_prices_from_tickers(start = as.Date("2019-04-01"),
end = as.Date("2020-04-01"),
quote = "Close",
retclass = "zoo") %>%
get_rates_from_prices(quote = "Close",
multi_day = TRUE,
compounding = "continuous")
# }
# NOT RUN {
## The result of the above code is stored in:
data(rates)
## Download historical prices of S&P 500 index and estimate rates of
## returns from prices:
# }
# NOT RUN {
library("magrittr")
rates_indx <- get_prices_from_tickers("^GSPC",
start = as.Date("2019-04-01"),
end = as.Date("2020-04-01"),
quote = "Close",
retclass = "zoo") %>%
get_rates_from_prices(quote = "Close",
multi_day = TRUE,
compounding = "continuous")
# }
# NOT RUN {
## The result of the above code is stored in:
data(rates_indx)
# }
Run the code above in your browser using DataLab