getHoldings.powershares: Get the names and weights of the holdings of PowerShares ETFs

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/getHoldings.powershares.R

Description

Download the holdings of PowerShares ETFs and return a data.frame containing the weights and names of the holdings (among other things).

Usage

1
2
  getHoldings.powershares(Symbols, env = .GlobalEnv,
    auto.assign = TRUE)

Arguments

Symbols

character vector of PowerShares ETF symbols. Presently, if Symbols is not provided, then the symbols of all PowerShares that have holdings data will be used. However, in the future it may change to require that the user provide a value.

env

where to store holdings

auto.assign

should the results be assigned in env?

Details

This function is usually called by getHoldings, but it can also be called directly.

First, this will download a list of PowerShares ETFs. If Symbols is missing, the holdings of all PowerShares ETFs will be retrieved. Otherwise, only the Symbols that are in the list of PowerShares ETFs will be used. Powershares does NOT provide holdings details about ‘Commodity & Currency’ ETFs, and they provide different columns depending on the type of ETF (i.e. equity, preferred stock, fixed income, etc.). Although different columns may be returned depending on which ETF you request, the first two columns will always be the same: Weight (1-100), and Name.

This will return a data.frame with a row for each holding of the ETF. If the holdings are stocks, the rownames will be the stocks' ticker symbols. Otherwise, if there is a column called “SecurityNum” (which all of them presently have), the rownames will become make.names(SecurityNum, unique=TRUE). Finally, if there is no “SecurityNum” column the rows will not be named.

Value

if auto.assign is TRUE, holdings will be assigned as the ETF symbols appended with “.h”, and the names of those objects will be returned. Otherwise, if Symbols is only one symbol, its holdings will be returned. If Symbols is of length greater than one, a list will be returned where each element is the holdings of a different ETF.

Author(s)

Garrett See with help from a user that requested to remain anonymous on http://stackoverflow.com

References

http://www.invescopowershares.com

See Also

getHoldings, qmao:::getHoldings.iShares.AsOf getHoldings.SPDR getHoldings.vaneck

Examples

1
2
3
4
5
## Not run: 
getHoldings.powershares(c("QQQ", "PGX"))
head(QQQ.h); head(PGX.h)

## End(Not run)

qmao documentation built on May 2, 2019, 4:54 p.m.