is it possible to get GBP inflation data (GBRPIZILS=) data via rest api on python ?

is it possible to get GBP inflation data (GBRPIZILS=) data via rest api on python ?

Best Answer

  • raksina.samasiri
    Answer ✓

    Hi @Atul.Sanwal ,

    Could you please confirm which product would you like to use?

    • As this question was raised in the Eikon Data API forum, which is available as an Eikon Python library, which can be used to retrieve this data, the sample code provided below
      • step 1) import necessary libraries and set the app key
        import pandas as pd
        import refinitiv.dataplatform.eikon as ek

        ek.set_app_key('DEFAULT_CODE_BOOK_APP_KEY')
      • step 2) retrieve all instruments in this chain RIC (GBRPIZILS=)
        def getUnderlying(baseRic):
        LONGNEXTLR = baseRic
        #For LONGLING1 to LONGLINK15 and LONGNEXTLR fields
        fields = ['LONGLINK{}'.format(x) for x in range(1, 15)]
        fields.append('LONGNEXTLR')
        all_underlying_rics = []
        #if LONGNEXTLR is not empty, try to retrieve the data fields
        while LONGNEXTLR!='':
        df,e = ek.get_data(LONGNEXTLR,fields)
        LONGNEXTLR = df.iloc[0]['LONGNEXTLR'] if pd.notnull(df.iloc[0]['LONGNEXTLR']) else ''
        #If LONGLINK<x> field is not null, append its value to all_underlying_rics list
        for x in range(1, 15):
        currentField = 'LONGLINK{}'.format(x)
        all_underlying_rics.append(df.iloc[0][currentField]) if pd.notnull(df.iloc[0][currentField]) else None
        return all_underlying_rics
      • step 3) Use the list of instruments from the function in the step above to retrieve their historical pricing
        rics_list = getUnderlying('GBRPIZILS=')
        ek.get_timeseries(rics_list)
        • here's the output of the code
          1656652151767.png
          • However, as I'm not a content export so I'm not sure why RIC: 'MONEY' is appeared in the list, to confirm this, you can raise a ticket to content expert via MyRefinitiv and attach the screenshot of Quote app of this Chain below as a reference
            1656652354343.png
    • However, the Rest API available is RDP API, could you please check the API Playground if you have an access to execute the endpoints below
      • /data/pricing/chains/v1/
        • to retrieve all instruments in this chain RIC (GBRPIZILS=)
      • /data/pricing/snapshots/v1/
        • to retrieve a pricing snapshot of each instrument (as this is not supported for chain RIC like GBRPIZILS=)

    Please let me know in case you have any questions.