For a deeper look into our Eikon Data API, look into:
Overview | Quickstart | Documentation | Downloads | Tutorials | Articles
Just as you would expand a stock index.
>>> df, err = ek.get_data('0#CDXHY5Y31C=MP',['CF_NAME']) >>> df.count() Instrument 90 CF_NAME 90 dtype: int64 >>> df.head(20) Instrument CF_NAME 0 CDXHY5Y=MP CDXHY.35.5Y 1 MSPRDHEADER= HEADER RIC 2 ADTX5YUSAX=MP ADT SECURITY 3 AESC5YUSAX=MP AES CORP 4 AKST5YUSAX=MP AK STEEL CORP 5 GMAC5YUSAX=MP ALLY FINANCIAL 6 AMD5YUSAX=MP AMD 7 AMR5YUSAX=MP AMERICAN AIRLINE 8 AXLA5YUSAX=MP AMERICAN AXLE 9 AMKR5YUSAX=MP AMKOR TECHNOLOGY 10 ARAM5YUSAX=MP ARAMARK SERVICES 11 ASH5YUSAX=MP ASHLAND 12 POL5YUSAX=MP AVIENT 13 CARF5YUSAX=MP AVIS BUDGET GRP 14 AVP5YUSAX=MP AVON PRDCTS 15 BLL5YUSAX=MP BALL 16 BVF5YUSAX=MP BAUSCH HEALTH 17 BZH5YUSAX=MP BEAZER HOMES USA 18 BBD5YUSAX=MP BOMBARDIER 19 BYD5YUSSX=MP BOYD GAMING
Thanks Gurpreet, I tried with many fields and never thought with just the name will work, great, thank you, now that I have the constituents how can I link the result to ask for historical data from each constituent?
You will have to use a loop of some sort to get timeseries data. For e.g.
df, err = ek.get_data('0#CDXHY5Y31C=MP',['CF_NAME']) for instr in df['Instrument']: # another eikon API call to get timeseries data
If you are interested in just getting a single field at certain date, something like this would work too:
>>> df2, err = ek.get_data(df['Instrument'].tolist(), ['CF_NAME', 'TR.OPENPRICE(SDate=2021-03-01)']) >>> df2 Instrument CF_NAME Open Price 0 CDXHY5Y=MP CDXHY.35.5Y <NA> 1 MSPRDHEADER= HEADER RIC <NA> 2 ADTX5YUSAX=MP ADT SECURITY 245.803 3 AESC5YUSAX=MP AES CORP 89.329 4 AKST5YUSAX=MP AK STEEL CORP 83.087 .. ... ... ... 85 CSAL5YUSAX=MP UNITI GROUP 392.035 86 UHSI5YUSAX=MP UNIVERSAL HEALTH 111.236 87 UVN5YUSAX=MP UNIVISION COMM 445.73 88 VSTG5YUSAX=MP VISTRA CORP 67.098 89 YUM5YUSAX=MP YUM! BRANDS 126.499 [90 rows x 3 columns]