Chain call times out

Hello,
I'm having a weird issue related to the refinitiv data API, especially the rd.discovery.Chain class.
I'm using this class to retrieve components of governmental yield curves, by create a Chain class with the chain RIC that i need, then using the .constituents method to retreive the information.
This works well 90% of the time. However sometimes the rd.discovery.Chain call just hangs undefinitly. The RIC passed is the correct chain RIC, in fact if i restart my API connection, the call works well, so it is not an issue of input.
There is no common factors in the RICs that cause this, i would say this issues appears in 1 in 20 calls.
I'm using a plateform session initialized with
rd.open_session(config_name='credentials.json')
Has anyone experience that issue before ?
Thanks for your help.
Answers
-
Thank you for reaching out to us.
Please try the new LSEG Data Library for Python which is a rebranded version of the Refinitiv Data Library.
The examples are available on GitHub.
If the problem still occurs, please enable the debug logging in the library by running the following code before opening a session.
config = ld.get_config()
config.set_param("logs.transports.file.enabled", True)
config.set_param("logs.transports.file.name", "lseg-data-lib.log")
config.set_param("logs.level", "debug")
ld.open_session(…)With this code, the debug log file will be created.
Please remove any private information from the log file and then share it.
We can verify the behavior of the library from the log file.
0 -
I will check the new version of the package and let you know. Thank you
0 -
Hello @Jirapongse ,
I've now migrated my to lseg-data, and added logging to my code.
I've identify an example of the issue above, attached is the relevant log information for that call.
I think the API call hangs after this step :
[release] - StreamCxnCache release (item=CacheItem(cxn=Thread
OMMSTREAMING_CHAINS_0.0, number_in_use=0), content_type=ContentType.STREAMING_CHAINS, session=ldp)
Let me know what other information I need to provide to debug this further.
Thank you very much for your support.
Best,
0 -
I couldn't see any problems in the log file.
[2025-05-27T11:50:20.857085+00:00] - [sessions.platform.ldp.0] - [DEBUG] - [125741429719040 - MainThread] - [_stream] - [_do_close] - StreamingChain id=0 name='0#IEBMK=' [PrvOMMStream id=5 name='0#IEBMK='] send close_message {"ID": 5, "Type": "Close"}
[2025-05-27T11:50:20.862842+00:00] - [sessions.platform.ldp.0] - [DEBUG] - [125741429719040 - MainThread] - [stream_connection] - [send_message] - [OMMSTREAMING_CHAINS_0.0] send {"ID": 5, "Type": "Close"}[2025-05-27T11:50:20.867991+00:00] - [sessions.platform.ldp.0] - [DEBUG] - [125741429719040 - MainThread] - [_stream] - [_do_close] - StreamingChain id=0 name='0#IEBMK=' [PrvOMMStream id=5 name='0#IEBMK='] release cxn=ThreadOMMSTREAMING_CHAINS_0.0
[2025-05-27T11:50:20.872833+00:00] - [sessions.platform.ldp.0] - [DEBUG] - [125741429719040 - MainThread] - [_stream_cxn_cache] - [release] - StreamCxnCache release (item=CacheItem(cxn=ThreadOMMSTREAMING_CHAINS_0.0, number_in_use=0), content_type=ContentType.STREAMING_CHAINS, session=ldp)
I think the item stream (0#IEBMK=) was closed so it released the cache of that item.
The connect is still alive and I could see ping and pong messages.
[2025-05-27T11:52:00.532792+00:00] - [sessions.platform.ldp.0] - [DEBUG] - [125738455922240 - ThreadOMMSTREAMING_CHAINS_0.0] - [stream_connection] - [_on_message] - [OMMSTREAMING_CHAINS_0.0] queued with priority 1: {"Type": "Ping"}
[2025-05-27T11:52:00.539487+00:00] - [sessions.platform.ldp.0] - [DEBUG] - [125738547820096 - Msg-Proc-ThreadOMMSTREAMING_CHAINS_0.0] - [omm_stream_connection] - [_process_message] - [OMMSTREAMING_CHAINS_0.0] process message {"Type": "Ping"}
[2025-05-27T11:52:00.545950+00:00] - [sessions.platform.ldp.0] - [DEBUG] - [125738547820096 - Msg-Proc-ThreadOMMSTREAMING_CHAINS_0.0] - [stream_connection] - [send_message] - [OMMSTREAMING_CHAINS_0.0] send {"Type": "Pong"}
[2025-05-27T11:52:00.555531+00:00] - [sessions.platform.ldp.0] - [DEBUG] - [125738547820096 - Msg-Proc-ThreadOMMSTREAMING_CHAINS_0.0] - [stream_connection] - [_get_messages] - [OMMSTREAMING_CHAINS_0.0] received messages: 6 | processed messages: 6Is it possible to share the runnable code? I need it to replicate the issue on my machine.
0 -
Unfortunately i cannot share this code. However i will try to make a dummy code that has the same issue.
0 -
Hi @Jirapongse
Can you test the attached notebook ?
Its a code that will iterate over many country codes and try to find a YC chain ric, if it doesnt exist, it will just return none. When i run it , it get None for the first country, as is expected, but the code hangs at the second country's Chain.constituents call.
0 -
I noticed i included a "_maturity_from_ric" function in my exemple, you can discard it it is not needed in this .
0 -
Thank you for the code.
I found that most chain RICs are invalid. When a chain RIC is invalid, it causes an exception in an internal thread and the library stops working. The workaround could be use the Search API to verify if a chain RIC is valid. For example:
def _curve_nodes(country_iso: str) -> dict[str, float]:
"""
Return {ric: maturity_in_years} for all benchmark nodes available for
the given sovereign, using the chain RIC (e.g. 0#FRBMK=).
"""
try:
chn_ric = f"0#{country_iso.upper()}BMK="
df = ld.discovery.search(
view = ld.discovery.Views.SEARCH_ALL,
query = chn_ric,
top=1
)
if len(df) != 0:
nodes = Chain(chn_ric).constituents
print(nodes)
else:
print(chn_ric+ ":" + "Not Found")
return None
except LDError as e:
print("### Exception ####")
#print(e)
return None
print(chn_ric)
return nodes0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 684 Datastream
- 1.4K DSS
- 614 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 248 ETA
- 552 WebSocket API
- 37 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 641 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 191 TREP Infrastructure
- 228 TRKD
- 915 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 89 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛