Upgrading to Workspace
We will be discontinuing the Eikon Desktop soon in favour of our next generation data and analytics workflow solution, LSEG Workspace. This page is designed to help you assess any changes you may need to make to programmatic (API) workflows. We also provide resources here to help you make those changes as well.
Upgrading to Workspace
Other related resources
Excel-related COM API upgrades:
News
Prerequisites
COM Prerequisites
VBA Prerequisites
Open a new single sheet Excel workbook.
Save As with an appropriate name (e.g. AdxRtSourceList.xls or AdxRtSourceList.xlsm in Office 2007 or higher).
Go to the VBE (Visual Basic Editor), ensure the Project Explorer is visible and select the project for the workbook.
<ALT><F11> or Tools, Macro, Visual Basic Editor in Excel 2003 or Developer, Visual Basic in Excel 2007 and above, View, Project Explorer If the Developer header is not visible in Excel 2007 and above, go to the Excel Office Button, select Excel Options (lower right), Popular, and check the 'Show Developer tab in the Ribbon' box.
In the VBE, click on File, Import File and import PLVbaApis.bas.
The .bas location is C:\Program Files (x86)\Thomson Reuters\Eikon\Z\Bin (Z may be X or Y, depending on the last Eikon update). The .bas is loaded as a new VB project module, PLVbaApis.
In the PLVbaAPis module, comment out the sections which aren't required.
E.G.: when dealing with AdxRtSourceList, part of the real time library AdfinXRtLib, the AdfinX Real Time section can remain uncommented.
In the VBE, go Tools, References and ensure that AdfinX Real Time Library is checked.
If it is not in the list the library is called rtx.dll and its location for Eikon 4 is ">C:\Program Files (x86)\Thomson Reuters\Eikon\Z\Bin (Z may be X or Y, depending on the last Eikon update).
Documentation on using the COM API in the Microsoft Office suite is available here: COM APIs for Microsoft Office. Users were also able to use the COM APIs outside of Microsoft Office suite for example in a standalone app: COM APIs for use in custom applications. A list of the prerequisites in question can be found in the index of this article.
Python Prerequisites
If you are new to Python, don't hesitate to install it on your machine and try it out yourself as outlined in this 3rd party tutorial. Otherwise, you can simply use Codebook as outlined in this Tutorial Video.
Python works with libraries that one can import to use functionalities that are not natively supported by the base coding package. Some popular distributuions of python include many of the popular packages that one could use for various tasks - Anaconda is the most popular such distribution.
The RD Library allows for code portability across the desktop and enterprise platforms - with only small changes in authentication credentials. These credentials are stored in a config file - but if you are just using the desktop you need not concern yourself with this as a desktop session is the default credential setup.
import refinitiv.data as rd # pip install httpx==0.21.3 # !pip install refinitiv.data --upgrade
from refinitiv.data.discovery import Chain
from refinitiv.data.content import search
import pandas as pd
pd.set_option('display.max_columns', None)
import numpy as np
import os
import time
import datetime # `datetime` allows us to manipulate time as we would data-points.
from IPython.display import display, clear_output # `IPython` here will allow us to plot grahs and the likes.
rd.open_session("desktop.workspace")
<refinitiv.data.session.Definition object at 0x7fa34230ac18 {name='workspace'}>
News
Streaming News
The Office COM API allowed for streaming real time news. This was rather inconvenient because one would have to (i) record news flowing through on their own environment, (ii) be recording with an open streaming session when the news they're looking for is published, (iii) deal with the memory management involved with such streaming data. The Python code below recreated this, but takes a snapshot at the time the code is run:
(N.B: The Accessing News data with the RD or EDAPI Python libraries will only allow you access to news data up to three months ago. For news data predating that, look into this article.)
#Define Callback for stream
def display_data(data, instrument, stream):
clear_output(wait=True)
current_time = datetime.datetime.now().time()
print(current_time, "- Data received for", instrument)
display(data)
# This will trigger the stream:
stream = rd.open_pricing_stream(
universe=['NFCP_UBMS'],
on_data=display_data)
11:21:11.353212 - Data received for NFCP_UBMS
NEWSCODE18 | PNAC | SEQ_NO | TAKE_SEQNO | NEWSCODE20 | SYS_DUPID | AREA_ID | ATTRIBTN | PRODCODE_N | PROD_PERM | NEWSCODE13 | PROC_DATE | NEWSCODE11 | SRCOFDATA | NEWS_PRIO | STORY_TYPE | CROSS_REF | STORY_DATE | NEWSCODE15 | RECORDTYPE | DSPLY_NAME | SF_NAME | HEADLINE1 | NEWSCODE01 | NEWSCODE02 | NEWSCODE03 | NEWSCODE04 | NEWSCODE05 | NEWSCODE06 | NEWSCODE07 | NEWSCODE08 | NEWSCODE09 | NEWSCODE10 | NEWSCODE12 | NEWSCODE14 | NEWSCODE16 | NEWSCODE17 | NEWSCODE19 | TOT_SEGS | HEAD_DIR | HEAD_LANG | NEWSMGTSTG | DSO_ID | TAKETM_MS | STORYTM_MS | CF_NAME | |
NFCP_UBMS | None | nBER3DRDqJ | 543729 | 1 | None | news_bma | 3 | BER | BER | 457 | None | ######## | None | 3 | 3 | S | None | ######## | None | 232 | 30 | bma | CRUDE PALM OIL FUTURES CLOSING: MARCH 6 | A:4 G:1 G:2EK G:8S G:CI G:K G:S M:1QD M:2CM M:... | None | None | None | None | None | None | None | None | None | None | None | None | None | None | 1 | L | en | 2 | 52 | 40871439 | 40871327 | 30 |
stream.close()
<OpenState.Closed: 'Closed'>
stream = rd.open_pricing_stream(
universe=['NFCP_UBMS'],
fields=['PNAC','HEADLINE1'],
on_data=display_data)
11:21:21.862759 - Data received for NFCP_UBMS
PNAC | HEADLINE1 | |
NFCP_UBMS | nNSEsrY7f | APOLLOTYRE-Loss of Share Certificates |
stream.close()
<OpenState.Closed: 'Closed'>
newsResponse = rd.news.get_headlines(query='LSEG',start="20.03.2022",end="25.03.2022",count=3)
newsResponse
headline | storyId | sourceCode | |
versionCreated | |||
27:20.0 | BRIEF-London Stock Exchange Secondary ABO Book... | urn:newsml:newswire.refinitiv.com:20220324:nFW... | NS:RTRS |
09:06.0 | BRIEF-London Stock Exchange Secondary ABO Book... | urn:newsml:newswire.refinitiv.com:20220324:nFW... | NS:RTRS |
56:21.7 | BLOCKTRADE: LONDON STOCK EXCHANGE SECONDARY A... | urn:newsml:newswire.refinitiv.com:20220324:nFW... | NS:RTRS |
Get News Story
Thankfully, the ek library News API is much more powerful and simple to use. Again, most of it is better shown and explained on GitHub, but the below is a great starting point of how to collect News data (that is 15 months old or older):
story_id = newsResponse.iat[1,1]
story_id
'urn:newsml:newswire.refinitiv.com:20220324:nFWN2VR17K:1'
from IPython.display import HTML
story = rd.news.get_story(story_id)
HTML(story)
March 24 (Reuters) - London Stock Exchange Group Secondary ABO Bookrunner:
BLOCKTRADE: LONDON STOCK EXCHANGE SECONDARY ABO: DEAL EXPECTED TO PRICE AT £77.00 PER SHARE; BOOKS MULTIPLE TIMES COVERED AT THAT LEVEL - BOOKRUNNER
BLOCKTRADE: LONDON STOCK EXCHANGE SECONDARY ABO: BOOKS WILL CLOSE AT 18:15 UK / 19:15 CET - BOOKRUNNER
Further company coverage: LSEG.L
(( Reuters.Briefs@thomsonreuters.com ;))
(c) Copyright Thomson Reuters 2022. Click For Restrictions - https://agency.reuters.com/en/copyright.html
Conclusion
In conclusion, we can see that the Office COM API had many great uses, but limitations too. This was without mentioning its reliability on DLLs that can be heavy to run on a personal machine. But the Refinitiv Python Libraries (RD, RDP and EDAPI) can not only replicate these COM functionalities but enhance them in many instances, the simplest example being the Historical News functionality shown above.
Several COM API functionalities relying on a technology called Adfin was not replicated in Python in this article, but we will investigate them in another article - so stay tuned!
Further Resources
COM APIs: Overview | Quickstart Guide | Documentation | Downloads | Tutorials | Q&A Forum
RD Library: Overview | Quickstart Guide | Documentation | Tutorials | Q&A Forum