SPX history uses incorrect tickers

abillias
abillias Newcomer
edited October 2 in Refinitiv Data Platform

Hi,

When trying to get historical data for SPX, get_history and get_data returns data using tickers of the current constituents and not of the constituents at the requested time. For instance, ld.get_history(universe=[f"0#.SPX"], fields=["TR.PriceClose"], parameters={"SDATE":"2011-02-01"}) returns the price closes of the current 503 SPX constituents on 2011-02-01, with the values for price closes of instruments not in the SPX at that time as missing. Please let me know how can I get historical data for index constituents (https://developers.lseg.com/en/article-catalog/article/building-historical-index-constituents) if get_history does not use the historical constituents. Thanks!

Answers

  • Hello @abillias

    For the SP500 chain, you can specify the historical date to get the chain constituents data. For e.g:

     ld.get_data('0#.SPX(2011-02-01)', fields=['TR.PriceClose'])
    
    image.png

    I have experienced that this method does not work for all the chains. You will need to reach out to a data content specialist at LSEG Support to find out why.

  • abillias
    abillias Newcomer

    @Gurpreet thanks for the response, but your screencap shows the same error as I was describing and the prices shown are from the most recent close. It appears that the API is ignoring the historical date.

  • How about this formula which requests the historical data -

    ld.get_history('0#.SPX(2011-02-01)', fields=['TR.PriceClose'], start='2011-02-01', count=1 )
    

    The first part as shown here is getting the chain constituents at a particular point in time. Second date is the time for when we need the historical data at.

  • abillias
    abillias Newcomer

    Hi @Gurpreet,

    Unfortunately, the constituent list still corresponds to the most recent constituent list for SPX and not at the desired point in time.

  • In that case, you might be able to take the two step approach -

    1. Get the list of constituents from the first get_data API call
    2. Get the history for constituents in the second get_history API call
  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @abillias

    I checked and found we can use the following Excel formula to get historical constituents of .SPX.

    =@RDP.Data(".SPX","TR.IndexConstituentRIC;TR.IndexConstituentName","SDate=2015-12-15 CH=date")
    

    The Python for this formula is:

    df = ld.get_data(
        universe = ['.SPX'],
        fields = ['TR.IndexConstituentRIC','TR.IndexConstituentName'],
        parameters = {'SDate':'2015-12-15'})
    df
    

    However, if I change the SDate to 2011-02-01, that Excel formula returns NULL.

    image.png

    Therefore, this may relate to content. Please contact the helpdesk support via LSEG Support to verify this issue and ask for the Excel formula used to retrieve historical constituents of .SPX on 2011-02-01.

    After that, we can convert the Excel formula to Python code.