Downloads and processes the constituent data for a specified financial index. The data is fetched from a remote CSV file, filtered, and cleaned to provide relevant information about constituents.
Arguments
- index
A character string specifying the name of the financial index for which to download constituent data. The index must be one of the supported indexes listed by
list_supported_indexes(). Optional whenpathis given.- path
Optional. Path to a local iShares or BlackRock holdings CSV, as saved from the fund's web page, to read instead of downloading. Use it as a fallback when the download fails.
indexis optional in this case; when given, entries whose name contains the index name are dropped.
Value
A tibble with five columns:
- symbol
The ticker symbol of the equity constituent.
- name
The name of the equity constituent.
- location
The location where the company is based.
- exchange
The exchange where the equity is traded.
- currency
The currency in which the equity is traded, derived from the exchange.
The tibble is filtered to exclude non-equity entries, blacklisted symbols,
empty names, entries containing "CASH", and, when index is given, entries
containing the index name.
Details
The function retrieves the URL of the CSV file for the specified index from ETF sites, then sends an HTTP GET request to download the CSV file, and processes the CSV file to extract equity constituents.
The approach is inspired by tidyquant::tq_index(), which uses a different
wrapper around other ETFs.
See also
Other download functions:
download_data(),
download_data_factors_ff(),
download_data_factors_q(),
download_data_fred(),
download_data_fred_md(),
download_data_huggingface(),
download_data_jkp(),
download_data_macro_predictors(),
download_data_osap(),
download_data_pastor_stambaugh(),
download_data_risk_free(),
download_data_stambaugh_yuan(),
download_data_stock_prices(),
download_factor_library_grid(),
download_factor_library_ids()
Examples
# \donttest{
download_data_constituents("DAX")
#> # A tibble: 40 × 5
#> symbol name location exchange currency
#> <chr> <chr> <chr> <chr> <chr>
#> 1 SIE.DE SIEMENS N AG Deutschland Xetra EUR
#> 2 SAP.DE SAP Deutschland Xetra EUR
#> 3 ALV.DE ALLIANZ Deutschland Xetra EUR
#> 4 ENR.DE SIEMENS ENERGY N AG Deutschland Xetra EUR
#> 5 AIR.BE AIRBUS Frankreich Boerse Berlin EUR
#> 6 DTE.DE DEUTSCHE TELEKOM N AG Deutschland Xetra EUR
#> 7 IFX.DE INFINEON TECHNOLOGIES AG Deutschland Xetra EUR
#> 8 MUV2.DE MUENCHENER RUECKVERSICHERUNGS-GESE Deutschland Xetra EUR
#> 9 DBK.DE DEUTSCHE BANK AG Deutschland Xetra EUR
#> 10 DHL.DE DHL AG Deutschland Xetra EUR
#> # ℹ 30 more rows
# }
if (FALSE) { # \dontrun{
download_data_constituents(path = "DAXEX_holdings.csv")
} # }