Quickstart guide for Refinitiv Data Platform
Last update Jan 2021
Operating System Any
Interpreter Python 3.x

Getting started

Refinitiv Data Platform (RDP) provides streaming and non-streaming data through Elektron Websocket interface and REST API respectively. In both the cases, an application begins by invoking a REST API call to get an authorization token. For request-response API, all subsequent calls will use this token to get the data. The token protocol uses OAuth 2.0 specification and can be implemented in any programming language. In this quick-start, we will run a Python application, which will request an access token and then use it to get time-series data. The acquired token can be used to access other data services as well.

Note that the LSEG authentication service has limits set for usage in order to protect clients from service loss due to a denial of service (DOS) attack. Performance testing of client applications may trigger this security control if authentication rates are significant (more than 50 login requests or session token refreshes per minute). As such, LSEG strongly recommends that you ensure that authentication requests to LSEG remain at relatively low request rates in order to avoid triggering security controls. 

1. Setup Python environment
If Python is not already installed on your machine, download and install Python 3.x from Python Website. Python 3.x is preferred over older versions. This sample uses Requests library for doing raw HTTP interactions to avoid installing any additional packages. Since Python libraries can have version dependencies, it is advisable to separate those using containers. See the Python environment setup tutorial.

2. Download the sample source code
Download the Quickstart and Tutorial source code archive file. It is a simple Python program to:

  1. Request an Access token and a Refresh token
  2. Request data

3. Run it
To try out the sample, you will need the following information. Please see your  Refinitiv Data Platform welcome email, or contact your account manager to get the appropriate username/password for RDP. Since this sample makes a time-series data call, it is important that the user has the authorization to get historical pricing data.

Variable Definition
USERNAME  

The ID of the user.  You typically receive 2 IDs within your welcome email, your email and a Machine ID.

  • The email ID is used for testing purposes such as used within the API Playground, Postman, etc
  • The Machine ID is used as your production ID
PASSWORD

The password that corresponds to the USERNAME being used:

  • USERNAME = Email, use email ID password
  • USERNAME = Machine ID, use a self-selected password that corresponds to the Machine ID
CLIENT_ID

The client_id is an OAuth term but is used to represent an AppKey.  This is a unique ID defined for an application making the request. Users can generate/manage their  AppKey's here

Make sure:  

  • To select a unique application name
  • To select the EDP API checkbox

Otherwise, the Register New App button will remain disabled.

Edit the credentials.ini file and specify your username, password and your client ID.
NOTE: Whilst the rdpToken.py file also has a user credentials section at the start of the file, if a credentials.ini  exists in the same folder, it will override any credentials in rpdToken.py.

The REST API endpoint is hardcoded in the file and does not have to change. To run the sample, open a command prompt where the sample is downloaded, and type in the following command:

NOTE: Since this sample makes a time-series data call, it is important that the user has the authorization to get historical pricing data. You can contact your account manager to get the appropriate username/password for your account that has an access to the protected RDP resource of your interest.

    	
            
python timeSeries.py

The output should look something like this:

4. Understanding the output
Sample begins by reading the token from a local file. If the token is expired or if the file does not exist, a new one is requested. Next this token is used to invoke the time-series API call. In this simple example, a Python for-loop extracts and displays the JSON response object. Users familiar with Pandas library can use that to easily slice and format the data.

The run output from your test should match the sample shown in the screen-shot. If there are errors in the output, or if it does not match the expected output, recheck the configured variables in the Python source code.

The key reasons for failure will be:

  • Unable to request an authorization token due to following error messages:
    • {"error":"access_denied"  ,"error_description":"Invalid username or password."} - Invalid username or password. Recheck that username and password have been correctly typed in.

    • {"error":"access_denied"  ,"error_description":"Found temporary password. It must be changed. Input newPassword field to change password."} - The user is logging in for first time and needs to change their password. Please run the password change sample included in the download package. You can read about password change fields in the tutorial.

    • {"error":"access_denied"  ,"error_description":"Fail to change password. Reason: ERROR_NEWPASSWORD_MINCHARACTERS" } - A user is trying to change password, but it does not meet minimum character requirements. Please provide a password that is atleast 8 chars and contains letters and numbers.

  • A valid token is received, but does not have sufficient privileges to invoke data API calls.

You can ask API related questions in the developers forum.

Please visit the step by step tutorials to understand these functions and how this sample is built.

Downloads

The sample code in python: QuickStart and Tutorial source code.