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.

Excel-related COM API upgrades:

PLSychronization Manager

 

Prerequisites

Note, quickly before continuing, that synchronisation manager was an old method whereby the COM API managed connections to Refinitiv Datasets. It is no longer required in python.

 

COM Prerequisites

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.

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'}>

 

 

PLSynchronization Manager

What does 'PLSynchronization Manager' do?

The PLSynchronization Manager is used to determine the Refinitiv Eikon - Microsoft Office connection state and listen to Eikon - Microsoft Office events.

 

VBA

PLSynchronization Manager does not replicate any of the Eikon - Microsoft Office worksheet functions, but it does provide information about the current state of Eikon - Microsoft Office, including the connection state. It also provides a LogIn method, which will log in to Eikon - Microsoft Office automatically if auto log in has been set, or display the Log In dialog box if auto log in hasn't been selected.

NOTE - It is not necessary for Eikon - Microsoft Office to be logged in - the sample code indicates the current connection state which can include being logged out.

 

Prerequisites

  1. Open a new single sheet Excel workbook.
    Save As with an appropriate name (e.g. SynchroManager.xls or SynchroManager.xlsm in Office 2007 or higher).
  2. Go to the VBE (Visual Basic Editor), ensure the Project Explorer is visible and select the project for the workbook above.
    <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.
  3. 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.
  4. In the PLVbaAPis module, comment out the sections which aren't required.
    NOTE - The Synchronization Manager object creation is NOT included in PlVbaApis.bas. It is necessary to add the following CreateReutersObject code

    Public Function CreateSynchronizationMgr() As PLSynchronizationMgrLib.SynchronizationMgr
        Set CreateSynchronizationMgr = CreateReutersObject("PLSynchronizationMgr.SynchroMgr")
    End Function
  5. In the VBE, go to Tools, References and ensure that PLSynchronizationMgr 1.0 Type Library is checked.
    If it is not in the list the library is called PLSynchronizationMgr.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).

PLSynchronizationMgr

    6. Create an instance of a PLSynchronizationMgr object using the PLVbaApis function CreateSynchronizationMgr() (NOTE point 4 above where it is necessary to manually enter the code).

Set myPLSM = CreateSynchronizationMgr()

    7. ConnectionMode, ConnectionState and UpdateStatus provide information about the type of connection (Internet, Managed or None), the current state of the connection (whether offline, online etc) and the the current status of updating (paused, streaming or none), respectively. Note in the code sample below where a check is done for the .ConnectionState - if it is 2 ("PL_Connection_State_Waiting _For_Login") then the .Login method is applied.

Dim WithEvents myPLSM As PLSynchronizationMgrLib.SynchronizationMgr

Private Sub checkSynchronization()
Dim strConnMode As String, strConnState As String, strUpdateStatus As String

If Not myPLSM Is Nothing Then Set myPLSM = Nothing
Set myPLSM = CreateSynchronizationMgr()

With myPLSM
Select Case .ConnectionMode
'PLConnectionModeType'
'PL_CONNECTION_MODE_NONE 0'
'PL_CONNECTION_MODE_MPLS 1'
'PL_CONNECTION_MODE_INTERNET 2'
Case 0
strConnMode = "0 - PL_CONNECTION_MODE_NONE"
Case 1
strConnMode = "1 - PL_CONNECTION_MODE_MPLS"
Case 2
strConnMode = "2 - PL_CONNECTION_MODE_INTERNET"
End Select

Select Case .ConnectionState
'PLConnectionStateType'
'PL_CONNECTION_STATE_NONE 0'
'PL_CONNECTION_STATE_MINIMAL 1'
'PL_CONNECTION_STATE_WAITING_FOR_LOGIN 2'
'PL_CONNECTION_STATE_ONLINE 3'
'PL_CONNECTION_STATE_OFFLINE 4'
'PL_CONNECTION_STATE_LOCAL_MODE 5'
Case 0
strConnState = "0 - PL_CONNECTION_STATE_NONE"
Case 1
strConnState = "1 - PL_CONNECTION_STATE_MINIMAL"
Case 2
strConnState = "2 - PL_CONNECTION_STATE_WAITING_FOR_LOGIN"
Case 3
strConnState = "3 - PL_CONNECTION_STATE_ONLINE"
Case 4
strConnState = "4 - PL_CONNECTION_STATE_OFFLINE"
Case 5
strConnState = "5 - PL_CONNECTION_STATE_LOCAL_MODE"
End Select

Select Case .UpdatesStatus
'PLUpdateStatusType'
'PL_UPDATES_STATUS_NONE 0'
'PL_UPDATES_STATUS_STREAMING 1'
'PL_UPDATES_STATUS_PAUSED 2'
Case 0
strUpdateStatus = "0 - PL_UPDATES_STATUS_NONE"
Case 1
strUpdateStatus = "1 - PL_UPDATES_STATUS_STREAMING"
Case 2
strUpdateStatus = "2 - PL_UPDATES_STATUS_PAUSED"
End Select

MsgBox "Connection Mode: " & strConnMode & Chr(13) & _
"Connection State: " & strConnState & Chr(13) & _
"Updates Status: " & strUpdateStatus

If .ConnectionState = 2 Then
' If the user log in details are already set for automatic log in, this will log in Eikon - Microsoft Office,'
' Or provide the log in dialogue box otherwise.'
.Login
End If
End With
End Sub

 

    8. There are various event handlers for status changes of the object, including OnConnection, OnDisconnection, OnPause and OnResume. The downloadable file contains sample code for the various events, two examples being shown below.

Private Sub myPLSM_OnConnection()
Dim arrConnStates() As Variant

arrConnStates = Array("0 - PL_CONNECTION_STATE_NONE", "1 - PL_CONNECTION_STATE_MINIMAL", "2 - PL_CONNECTION_STATE_WAITING_FOR_LOGIN", _
"3 - PL_CONNECTION_STATE_ONLINE", "4 - PL_CONNECTION_STATE_OFFLINE", "5 - PL_CONNECTION_STATE_LOCAL_MODE")

MsgBox "Connected: " & arrConnStates(myPLSM.ConnectionState)
End Sub

Private Sub myPLSM_OnDisconnection(ByVal a_disconnectionReason As PLSynchronizationMgrLib.PLDisconnectionReason)
Dim strDisconnectReason As String

Select Case a_disconnectionReason
'PLDisconnectionReason'
'PL_DISCONNECTION_ESO 0'
'PL_DISCONNECTION_NETWORK 1'
'PL_DISCONNECTION_USER 2'
'PL_DISCONNECTION_PRODUCT 3'
'PL_DISCONNECTION_LOCAL_MODE 4'
Case 0
strDisconnectReason = "0 - PL_DISCONNECTION_ESO"
Case 1
strDisconnectReason = "1 - PL_DISCONNECTION_NETWORK"
Case 2
strDisconnectReason = "2 - PL_DISCONNECTION_USER"
Case 3
strDisconnectReason = "3 - PL_DISCONNECTION_PRODUCT"
Case 3
strDisconnectReason = "4 - PL_DISCONNECTION_LOCAL_MODE"
End Select

MsgBox "Disconnected: " & myPLSM.ConnectionState & " Disconnection reason: " & strDisconnectReason
End Sub

    9. When the object is finished with, such as on the workbook close event, it can be set to Nothing.

If Not myPLSM Is Nothing Then Set myPLSM = Nothing

    10. Although it is not part of the PLSynchronizationMgr library, there is an Eikon - Microsoft Office macro available to toggle between Pause and Resume Updates - this replicates clicking the Pause Updates/Resume Updates button on the Thomson Reuters Excel ribbon. Using this macro and the update status value, one can control the state of Eikon - Microsoft Office. 

Application.Run "PLPauseResumeEventHandler"

 

New Method (Python)

This synchronisation manager was an old method whereby the COM API managed connections to Refinitiv Datasets. It is no longer required in python.