Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 2

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,

refinitiv-dataplatform-eikon#technology#contentcommoditiesenergy
1709225448923.png (77.4 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

<AHS>

code used

df = rd.discovery.search(
    view = rd.discovery.Views.SEARCH_ALL,
    top = 1000,
    filter = "PrimaryChainRIC eq '0#NG:' and ExpiryDate gt 2023-12-29",
    order_by = "ExpiryDate asc",
    select = "RIC, ExpiryDate"
)
rics_list = df['RIC'].tolist()

df = rd.get_data(rics_list, ["TR.SETTLEMENTPRICE","TR.SETTLEMENTPRICE.date","TR.SETTLEMENTPRICE.currency"], parameters = {'SDate': '2023-12-29', 'EDate': '2023-12-29'})
df
Upvotes
Accepted
14.2k 30 5 10

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


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
24.7k 54 17 14

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.




1709264447241.png (33.9 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

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

1709780038155.png (88.3 KiB)

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.