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 -
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
-
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
0
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.
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.
0 -
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.0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛