getHoldings.selectSPDR: Get names and weights of the holdings of Select Sector SPDR...

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

View source: R/getHoldings.SPDR.R

Description

This function only works with the 9 Select Sector SPDRs: ‘XLY’, ‘XLP’, ‘XLE’, ‘XLF’, ‘XLV’, ‘XLI’, ‘XLB’, ‘XLK’, ‘XLU’.

Usage

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

Arguments

Symbols

character vector of Select Sector SPDR ETF symbols. If not provided, all 9 will be used. However, in the future it may change to require that Symbols is not missing.

env

where to store holdings (only used if auto.assign is TRUE

auto.assign

should the results be assigned in env?

Details

It is usually called by getHoldings, or getHoldings.SPDR but it can also be called directly.

Value

For each of the Symbols, an object classed as “holdings”. 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. If there are no holdings found for a Symbol (most likely because it is not a SPDR ETF), and auto.assign is TRUE, nothing will be assigned for that Symbol, but if auto.assign is FALSE, the returned list will have NULL for the element corresponding to that Symbol.

Note

On non-Unix-like platforms, this function is called by getHoldings since this works cross-platform but getHoldings.SPDR does not.

Author(s)

Garrett See

References

Sector SPDR website

See Also

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

Examples

1
2
3
4
5
6
## Not run: 
getHoldings.selectSPDR("XLE")
XLE.h
getHoldings.selectSPDR(auto.assign=FALSE) #list of all of them

## End(Not run)

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