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 zoo object whose rownames are dates and colnames are ticker names of the companies. Values of the table corresponds to the daily returns of the stocks of corresponding ticker names.

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

zoo

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)

[Package PortRisk version 1.1.0 Index]