get_data_from_tickers {AssetAllocation} | R Documentation |
Downloads prices in xts format from a list of tickers from Yahoo Finance (<https://finance.yahoo.com/>).
Description
get_data_from_tickers
retrieves adjusted closing prices from Yahoo Finance
for a set of tickers and returns the prices and returns.
Usage
get_data_from_tickers(tickers, starting_date = "2007-01-01")
Arguments
tickers |
A vector containing a tickers. |
starting_date |
A date on which the allocation rule is applied. |
Details
The function retrieves data from Yahoo Finance (<https://finance.yahoo.com/>)
using the getSymbols function from the quantmod
package. It calculates
returns from adjusted prices. The ticker names must correspond to those found
in Yahoo Finance.
Value
An object of class "List"
containing two objects of class
"xts"
with respectively the prices and returns of the assets,
with column names corresponding to the tickers.
Examples
## download data for the following exchange-traded-funds: MTUM, VLUE, USMV, and QUAL.
factor_ETFs <- get_data_from_tickers(c("MTUM", "VLUE", "USMV", "QUAL"),
starting_date = "2020-01-01")
[Package AssetAllocation version 1.1.1 Index]