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