I am interested in getting constituents of an index along with individual stock returns on a 1m,1y, 5y basis through bloomberg terminal as well as through api. Do we have a single command which can serve this purpose ?
There's no single field to return constituents AND data on those constituents. So yes, you need first to query the index constituents and then do queries for the data you want on those securities.
Once you've got the list of constituents, for the returns you can use a number of different fields.
Assuming you're looking at equities and want the total return (including dividends etc...) two particularly useful ones are:
The first one will give you a single number for the net return between two dates (use the CUST_TRR_START_DT and CUST_TRR_END_DT overrides to define them) while the second one will give you a series of periodic net returns between two dates.
in excel you'd do something like:
=bdp("AAPL US Equity", "CUST_TRR_RETURN_HOLDING_PER","CUST_TRR_START_DT", <insert a function or pointer to the start date in YYYYMMDD format>, "CUST_TRR_END_DT", TEXT(TODAY(),"YYYYMMDD"))
to get the single 1m, 1y, 5y etc... returns you want to see.
That's a flexible solution, alternatively you'll see that securities often have a number of fixed fields for particularly popular holding periods. e.g:
In general in Bloomberg, if you have access to a terminal, go to a security's page and type
FLDS <search term> <GO> to find field codes to use for the API/Excel add-in. That and the helpdesk tends to be where I start.
$\begingroup$ I added this afer @dfelex had answered the first part, so see that answer to get the constituents using the INDEX_MEMBERS field. $\endgroup$– RobAbMoDec 22, 2017 at 12:13
You can use the field
INDX_MEMBERS to get the constituents. In excel you can use:
=BDS("Index Ticker", INDX_MEMBERS)
Or in python something like
import pybbg def Main(): bbg = pybbg.Pybbg() IndexConst = bbg.bds('IndexName', 'INDX_MEMBERS')
$\begingroup$ Thanks. this will give me the constituents. I want something along with returns as well. do i need to iterate over each member to get its return or is there a field for it as well? $\endgroup$ Dec 11, 2017 at 8:34