getHoldings.SPDR: Get names and weights of the holdings of SPDR ETFs

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

View source: R/getHoldings.SPDR.R

Description

On Non-Unix-alike platforms, this will call getHoldings.selectSPDR which is platform independent (but only works for the 9 Select Sector SPDRs).

Usage

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

Arguments

Symbols

character vector of SPDR ETF symbols. Presently, if no Symbols are provided, all SPDR symbols will be used. However, in the future it may be changed 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

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

As of July 8, 2012, the CSVs provided by spdrs.com no longer include a Ticker column which means that the returned holdings object will no longer have the ticker symbols of the holdings as rownames.

Beware that the CSV that spdrs.com provides for some ETFs (e.g. DIA) has the same number of shares for all holdings (which is incorrect).

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. 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

this uses download.file with method="curl" which is not supported on Windows.

Author(s)

Garrett See

References

https://www.spdrs.com/

See Also

getHoldings, getHoldings.iShares, getHoldings.selectSPDR, getHoldings.vaneck, getHoldings.powershares, getHoldings.GlobalX, getHoldings.FirstTrust

Examples

1
2
3
4
5
## Not run: 
getHoldings.SPDR("SPY")
SPY.h

## End(Not run)

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