Description Usage Arguments Details Value Author(s) References See Also Examples
Get the names and weights of ETF holdings.
1 2 | getHoldings(Symbols, env = .GlobalEnv,
auto.assign = TRUE)
|
Symbols |
chr Symbols of ETFs. Presently, if not
supplied the Symbols of the nine Sector SPDRs will be
used. However, in the future it may be changed to
require that |
env |
environment to store the holdings data in |
auto.assign |
assign data? |
This function acts like a generic function. There are
other functions, such as
getHoldings.iShares and
getHoldings.selectSPDR that act like
“methods”.
getHoldings looks up the Symbols in the CSV
at
http://www.masterdata.com/helpfiles/ETF_List_Downloads/AllTypes.csv
from
http://www.masterdata.com/HelpFiles/ETF_List.htm.
It uses the Name field to determine which
getHoldings.* function to call.
Different getHoldings.* “methods” will
return different columns, but all of them should have the
Ticker Symbol or some other identifier as the
rownames, the first column should be
Weights (0-100), and the second column should be
Name (a description of the security). Also, the
returned holdings data will be a data.frame with
class holdings, or a list of
holdings classed objects.
Some iShares ETFs have more than one holding listed with
the same Symbol. In the case that Symbols are duplicated,
a “duplicates” attribute will be added to the
returned object. Also, since rownames cannot be
duplicated, they will be made unique with
make.unique
An object classed as “holdings” will be created
that is a data.frame with columns for holdings' weights
and names. If called with auto.assign=TRUE, it
will be assigned in env with names that are
Symbols appended with “.h”. Otherwise, the
“holdings” will be returned and not stored.
Returned objects may have more columns depending on which
getHoldings.* “method” is used.
Garrett See
http://www.masterdata.com/HelpFiles/ETF_List.htm
getHoldings.SPDR,
getHoldings.selectSPDR,
getHoldings.iShares,
qmao:::getHoldings.iShares.AsOf,
getHoldings.vaneck,
getHoldings.powershares,
getHoldings.GlobalX,
getHoldings.FirstTrust,
getHoldings.WisdomTree
1 2 3 4 5 6 7 8 | ## Not run:
getHoldings('XLB', auto.assign=FALSE) #getHoldings.SPDR or .selectSPDR depending on OS
getHoldings('IVE') #getHoldings.iShares
IVE.h
getHoldings(c("QQQ", "GDX")) #.powershares and .vaneck (Market Vectors)
getHoldings(c("XLY", "IVE", "QQQ", "GDX", "OIH", "XLU", "EPI"))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.