How can I get index constituents every month? I am looking for the .HSLI index constituents every month end since 2015/1/30. I have used
df=ek.get_data('.HSLI', ['TR.IndexConstituentRIC'], {'SDate':'-50M'})[0]
With a loop from -50 to 0 so I get every month...
However, the data is there only for the last couple of years. On asking the support desk, they suggested Datastream would be a better source. I quote:
For historical constituents of <.HSLI> I would recommend to use Datastream excel add in formula to extract the historical constituents since it has more historical data.
The historical constituents of this index are available from March 2010 - April 2019 with the following codes below:
LHKHCOLC - Current constituent list of Hang Seng Large Cap index.
LHKHCOLC0419 - Latest constituent list of Hang Seng Large Cap index as of April 2019.
LHKHCOLC0310 - Earliest constituent list of Hang Seng Large Cap index as of March 2010.
Please note that the numerical figures in the code represents the month and year, so if you would like to get the constituent list as of January 2017, just add 0117 after the code LHKHCOLC so the code will be LHKHCOLC0117.
January 2015 =DSGRID("LHKHCOLC0115","NAME","Latest Value","","","RowHeader=true;ColHeader=true;DispSeriesDescription=true;DispDatatypeDescription=true","")
February 2015 =DSGRID("LHKHCOLC0215","NAME","Latest Value","","","RowHeader=true;ColHeader=true;DispSeriesDescription=true;DispDatatypeDescription=true","")
ENDQUOTE
Is it possible to query data stream using the python API? Appreciate your help.