lseg.data.content type conversions

When using lseg.data.content how can I control the type conversions occuring for response fields ?
For example :
import lseg.data as ld universe = ["/SOGN.PA"]
fields = ["BID", "ASK", "CURRENCY", "RDN_EXCHID", "QUOTE_DATE", "QUOTIM", "QUOTIM_MS", "QUOTIM_NS"] stream = ld.content.pricing.Definition(universe = universe, fields = fields).get_stream()
stream.open(with_updates=False)
stream.close()
df = stream.get_snapshot()
For Enum fields (RDN_EXCHID, CURRENCY) the response is the id, I would like to be able to get the text value instead.
For other fields is there a way to get the raw response (ie without the type inference attempt) ?
Thanks.
Answers
-
I woudl advise looking into the Data Item Browser (DIB):
WIth it, I was able to find the field `CF_CURR`; is that what you are after?
import lseg.data as ld
ld.open_session()
universe = ["/SOGN.PA"]
fields = ["BID", "ASK", "CF_CURR", "RDN_EXCHID", "QUOTE_DATE", "QUOTIM", "QUOTIM_MS", "QUOTIM_NS"]
stream = ld.content.pricing.Definition(universe = universe, fields = fields).get_stream()
stream.open(with_updates=False)
stream.close()
df = stream.get_snapshot()0 -
I would prefer not to have to change each field.
Moreover I notice that in your screenshot the RDN_EXCHID field has been translated to PAR, compared to 74 in mine, which could imply that even the CURRENCY field would have been displayed as EUR on your end. Could it be a configuration missing on my end?
Thanks.
0 -
I am using the Workspace 1.26.155 and I got this data.
Are you using Eikon or Workspace?
To access the raw data (JSON string), you may need to use the steaming endpoint in the Delivery layer. The examples are on GitHub.
0 -
Hi,
Regarding the enum behavior, I am still on Eikon.
I have also tried to use the dictionary :
dictionary = lseg.data.delivery._dictionary.Dictionary(…) dictionary.load() dictionary.versions
but this does work as it returns {} and the log shows :
[2025-02-18T14:48:04.112501+01:00] - [sessions.desktop.workspace.0] - [DEBUG] - [13708 - ThreadOMMSTREAMING_DICTIONARY_0.0] - [stream_connection] - [_on_message] - [OMMSTREAMING_DICTIONARY_0.0] on_ws_message [{"ID": 7, "State": {"Code": "ConnectionError", "Data": "Suspect", "Stream": "Closed", "Text": "Dictionary domain is unavailable for Eikon4_Desktop"}, "Type": "Status"}]
Regarding the streaming end point I already looked at it but the fact that each RIC has to be handled individually implies a lot of change on our side.
Thanks.
0 -
You can enable the debug log to check the retrieved data.
[2025-02-21T11:25:05.533438+07:00] - [sessions.desktop.workspace.0] - [DEBUG] - [77416 - OpenUniverseStreams-Thread_0] - [stream_connection] - [send_message] - [OMMSTREAMING_PRICING_0.0] send {"ID": 5, "Domain": "MarketPrice", "Streaming": false, "Key": {"Name": "/SOGN.PA"}, "View": ["BID", "ASK", "CURRENCY", "RDN_EXCHID", "QUOTE_DATE", "QUOTIM", "QUOTIM_MS", "QUOTIM_NS"]}
[2025-02-21T11:25:05.533438+07:00] - [sessions.desktop.workspace.0] - [DEBUG] - [77416 - OpenUniverseStreams-Thread_0] - [_stream] - [_do_open] - _UniverseStream owner.id=0 id=5 name='/SOGN.PA' wait open event
[2025-02-21T11:25:05.586455+07:00] - [sessions.desktop.workspace.0] - [DEBUG] - [59756 - ThreadOMMSTREAMING_PRICING_0.0] - [stream_connection] - [_on_message] - [OMMSTREAMING_PRICING_0.0] on_ws_message [{"Fields": {"ASK": null, "BID": 37.35, "CURRENCY": "EUR", "QUOTE_DATE": "2025-02-21", "QUOTIM": "02:01:05", "QUOTIM_MS": "02:01:05.179", "QUOTIM_NS": "02:01:05.179", "RDN_EXCHID": "PAR"}, "State": {"Data": "Ok", "Stream": "NonStreaming", "Code": "None", "Text": "All is well"}, "Qos": {"Rate": "TimeConflated", "Timeliness": "DelayedUnknown"}, "Type": "Refresh", "SeqNumber": 22126, "ID": 5, "Key": {"Name": "/SOGN.PA", "NameType": "Ric", "Service": "Q"}}]The library sent an item request to the desktop session then the session sent the data back. The response from the Workspace session contains the expanded enum values.
0 -
In a previous session I already looked at the debug : on my end enum values are not expanded :
[2025-02-20T15:14:04.696983+01:00] - [sessions.desktop.workspace.0] - [DEBUG] - [13008 - ThreadOMMSTREAMING_PRICING_0.0] - [stream_connection] - [_on_message] - [OMMSTREAMING_PRICING_0.0] on_ws_message [{"ID": 5, "Type": "Refresh", "Key": {"Service": "IDN_FD3", "Name": "/SOGN.PA"}, "State": {"Stream": "NonStreaming", "Data": "Ok", "Text": "All is well"}, "Qos": {"Timeliness": "Realtime", "Rate": "JitConflated"}, "PermData": "AwECEZd8", "SeqNumber": 12382, "Fields": {"RDN_EXCHID": 74, "CURRENCY": 978, "BID": 38.07, "ASK": 38.08, "MATUR_DATE": null, "QUOTIM": "13:59:02", "QUOTE_DATE": "2025-02-20", "QUOTIM_MS": 50342691, "QUOTIM_NS": "13:59:02.691481935"}}]
[2025-02-20T15:14:04.697982+01:00] - [sessions.desktop.workspace.0] - [DEBUG] - [14964 - Msg-Proc-ThreadOMMSTREAMING_PRICING_0.0] - [omm_stream_connection] - [_process_message] - [OMMSTREAMING_PRICING_0.0] process message {"ID": 5, "Type": "Refresh", "Key": {"Service": "IDN_FD3", "Name": "/SOGN.PA"}, "State": {"Stream": "NonStreaming", "Data": "Ok", "Text": "All is well"}, "Qos": {"Timeliness": "Realtime", "Rate": "JitConflated"}, "PermData": "AwECEZd8", "SeqNumber": 12382, "Fields": {"RDN_EXCHID": 74, "CURRENCY": 978, "BID": 38.07, "ASK": 38.08, "MATUR_DATE": null, "QUOTIM": "13:59:02", "QUOTE_DATE": "2025-02-20", "QUOTIM_MS": 50342691, "QUOTIM_NS": "13:59:02.691481935"}}
I understand from the previous messages that this behaviour is caused by our use of Eikon instead of Workspace, is this correct ?
Thanks.
0 -
Yes, it is possible. Sorry, I have uninstalled Eikon so I can't test it.
I have a simple code to get expanded values at https://github.com/jirapongse-refinitiv/Python_Dictionary/tree/main. It required the RDMFieldDictionary and enumtype.def files. You can get those files from https://github.com/Refinitiv/Real-Time-SDK/tree/master/Cpp-C/etc.
0 -
OK I will have a look.
Thanks for your help.
0
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
- 685 Datastream
- 1.4K DSS
- 615 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
- 252 ETA
- 556 WebSocket API
- 38 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
- 652 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
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 228 TRKD
- 917 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛