RDError in RDP API

HannaCP
HannaCP LSEG
edited January 15 in Refinitiv Data Platform

Hi team, I am from the Customer Support - Specialist and I am assisting a client in getting historical curve 0#NOKZ=R for a specific date. Initially I provided this code:

import refinitiv.data as rd

session = rd.session.desktop.Definition(app_key=('DEFAULT_CODE_BOOK_APP_KEY')).get_session()
session.open()
rd.session.set_default(session)

nokz_chain = rd.content.pricing.chain.Definition(name='0#NOKZ=R').get_stream()
nokz_chain.open(False)
print('0#NOKZ=R constituents :', nokz_chain.constituents)

nokz = rd.get_history(universe=nokz_chain.constituents, fields=['ZERO_YLD1'], end = '2024-11-30', count=1)
print(nokz)

but client came back and said that they dont use an app key so I tried another code (below) and now they see the RDError on their end

import refinitiv.data as rd
from refinitiv.data.discovery import Chain

nokz_chain = rd.content.pricing.chain.Definition('0#NOKZ=R').get_stream()
nokz_chain.open(with_updates = False)
print('0#NOKZ=R constituents :', nokz_chain.constituents)

nokz = rd.get_history(universe=nokz_chain.constituents, fields=['ZERO_YLD1'], end = '2024-11-30', count=1)
print(nokz)

the error:

RDError.png

Any help is appreciated, thanks!

Best Answer

  • HannaCP
    HannaCP LSEG
    Answer ✓

    Thank you Jirapongse!

    So can we add the parameter in the existing code ?

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @HannaCP

    Thank you for reaching out to us.

    The Chain returns delayed RICs that are prefixed with the '/' character. The delayed RICs don't work with the get_history method. Therefore, the application needs to remove the '/' character and uses the historical_pricing interface in the content layer instead with the qos:delayed parameter.

    from refinitiv.data.content import historical_pricing
    from refinitiv.data.content.historical_pricing import Intervals
    
    rics = ['/NOKONZ=R', '/NOKTNZ=R', '/NOKSNZ=R','/NOK1WZ=R']
    rics = [e[1:] if e[0] == '/' else e for e in rics]
    response = historical_pricing.summaries.Definition(
        rics, 
        interval=Intervals.DAILY,   
        fields=['ZERO_YLD1'], 
        end = '2024-11-30', 
        count=1,
        extended_params={"qos":"delayed"}
    ).get_data()
    response.data.df
    
  • Jirapongse
    Jirapongse ✭✭✭✭✭

    I can't find a way to add the qos parameter in the get_history method.

  • Ah found it to replace the actual rics to my existing one, thank you Jirapongse!


    from refinitiv.data.content import historical_pricing
    from refinitiv.data.content.historical_pricing import Intervals
    from refinitiv.data.discovery import Chain

    nokz_chain = rd.content.pricing.chain.Definition('0#/NOKZ=R').get_stream()
    nokz_chain.open(with_updates = False)
    print('0#/NOKZ=R constituents :', nokz_chain.constituents)

    rics = (nokz_chain.constituents)
    rics = [e[1:] if e[0] == '/' else e for e in rics]
    response = historical_pricing.summaries.Definition(
    rics,
    interval=Intervals.DAILY,fields=['ZERO_YLD1'],
    end = '2024-11-30',
    count=1,
    extended_params={"qos":"delayed"}
    ).get_data()
    response.data.df