access {PortRisk} | R Documentation |
Access Daily Stock Returns by Dates
Description
Access data from a zoo
type daily returns table and returns as a zoo
object. Basically, it returns a table of daily returns of a given list of company ticker names for a time period given as the input.
Usage
access(tickers, start, end, data)
Arguments
tickers |
A character vector of ticker names of companies in the portfolio. |
start |
Start date in the format "yyyy-mm-dd". |
end |
End date in the format "yyyy-mm-dd". |
data |
A |
Value
Returns a zoo
series as a table of daily returns corresponding to the company ticker names in tickers
for the given time period. Basically, it picks up a block from a large table of daily returns of the stocks corresponding to the dates.
See Also
Examples
data(SnP500Returns)
# list all the ticker names in a character vector
tckk <- colnames(SnP500Returns)
# access the data corresponding to the first 3 ticker names
# for the time period January 1, 2013 - January 10, 2013
access(tickers = tckk[1:3],
start = "2013-01-01",
end = "2013-01-10",
data = SnP500Returns)