Error code -1 | The read operation timed out while using get_data

Hi,
I am trying to get some commodities data using get_data, but I am encountering the error above with some RIC chains. Is it possible to fix this by increasing the timeout limit somehow?

Error - 1709225448923.png

For my second question - I am using "TR.SETTLEMENTPRICE.currency" to get the currency in the parameters. Is there a parameter to retrieve the unit of measure, e.g., $/mmbtu, $/mwh?

Thanks,

Best Answer

  • raksina.samasiri
    Answer ✓

    For the reference, here's the answer provided by the helpdesk in the ticket

    You may use the data item LOTSZUNITS. Kindly use the below formula to get the unit (MMBtu):

    However, the desktop session and codebook return the enumerated value (29), not the expanded string (LBS). This could be a limitation of the desktop session and codebook. The workaround could be loading the data dictionary files (RDMFieldDictionary and enumtype.def) to expand the enumerated fields and you can use the code (RDMFieldDictionary.py) on GitHub.

    Please refer to https://community.developers.refinitiv.com/questions/104537/unable-to-get-lotsize-from-refinitiv-data-librarie.html and https://github.com/LSEG-API-Samples/Article.EikonAPI.Python.Widget/blob/main/RDMFieldDictionary.py for instructions on how to use the code listed below.

    This is the code to use:

    import refinitiv.data as rd
    rd.open_session()
     
    RIC=['NGJ24']
     
    %run ./RDMFieldDictionary.py
    dict = RDMFieldDictionary("RDMFieldDictionary.txt", "enumtype.txt")
     
    stream = rd.open_pricing_stream(
       universe = RIC,
       fields=['LOTSZUNITS']
    )
     
    df1 = rd.get_data(
       universe = RIC,
       fields = [
           'TR.SETTLEMENTPRICE.date',
           'TR.SETTLEMENTPRICE',
           'TR.SETTLEMENTPRICE.currency'
       ],
       parameters = {
           'SDate': '2023-12-29',
           'EDate': '2023-12-29',
           'Frq': 'D'
       }
    )
     
    df = stream.get_snapshot()
    display(dict.GetExpanedEnumString("LOTSZUNITS",df["LOTSZUNITS"][0]))
     
    display(df1)

    Please see attached screenshots for reference

    image


Answers

  • Hello @anurag.rathore

    How many numbers of RIC in the "contract_chain" list variable? Does the problem occur if you reduce and number of RICs in that variable?

    About the timeout, you can set the HTTP timeout via the RD library configuration file (refinitiv-data.config.json) or programmatic. You can find more detail on my colleague answers in this old ReadTimeout on simple requests post.

    However, the screenshot shows that you are on the CodeBook app which is the controlled environment and I am not sure if the CodeBook allows you to change this setting. If you continue encounter the issue, it may be related to the backend service, you may submit a support ticket to the Workspace support team via https://my.refinitiv.com/content/mytr/en/helpandsupport.html website.


    1709264447241.png

    About the second question, please check my colleague answer on this old How to change price unit when download data post.

    I hope this information helps.



  • Hi @wasin.w ,
    Thanks for your help.

    The 'contract_chain' includes multiple RICs representing an entire forward curve. I dont experience it for one RIC. I am using it on vscode.

    On the second question - What can I add in the get_data highlighted region to get the units of measure in the data frame? Please refer to the screenshot below.
    1709780038155.png