Comparison of Data Library for Python VS Python/requests direct call for the Delivery Platform (RDP)
- version: 1.0
- Last update: February 2025
- Environment: Windows
- Compiler: Python
- Prerequisite: Access to RDP credentials
This project is forked from my old Comparison of RDP Libraries for Python VS Python/requests direct call for the Delivery Platform (RDP) project because the library is outdated. This project aims to use the strategic LSEG Data Library for Python.
The Delivery Platform (RDP) APIs (formerly known as Refinitiv Data Platform) provide various LSEG data and content for developers via easy to use Web base API. The developers which are data scientist, financial coder or trader can use any programming languages that support HTTP request-response and JSON message to retrieve content from RDP in a straightforward way. An example use case are data scientists or trader use Python language with the requests library to get data from RDP and visualize that data in Jupyter Notebook application.
The strategic LSEG Data Library for Python (aka Data Library version 2) are ease-of-use APIs defining a set of uniform interfaces providing the developer access to the RDP, Real-Time, and Workspace platforms. The libraries let developers can get data easier than using RDP APIs with Python and requests library directly.
This article demonstrates how easy developers can get LSEG content via Data Library by comparing the application source code using the library PlatformSession
versus the code using Python/requests to get the same data. The comparison also can be applied to developers who use other Python HTTP libraries such as http.client or urllib.request.
Note: This article is focusing on the comparison of how to get data only. The reason is once the application receives data from either direct RDP APIs call or Data library, the data processing or visualize logic are the same.
The Data Library provides a set of ease-of-use interfaces offering coders uniform access to the breadth and depth of financial data and services available on the LSEG Data Platform. The Library is designed to provide consistent access through multiple access channels and target both Professional Developers and Financial Coders.
The library is available the following programming languages
Once connected, applications can rely on easy-to-use objects and functions to access the breadth and depth of data services available on the platform. Or alternatively, applications can use service-agnostic lower layer, that enable an access to the fine-grained details of each platform service. This makes the library ideal for different types of developers.
Note:
- This project demonstrates with the LSEG Data Library for Python which is the version 2.0.1 of the library (As of February 2025)
- For High performance scenarios, the Real-Time SDK (C++, Java, C#) and Real-Time WebSocket API are recommended
This demo project requires the following dependencies.
- RDP Access credentials.
- Python compiler and runtime.
- LSEG Data Library for Python.
- Internet connection
Please contact your LSEG's representative to help you to access RDP credentials.
See the Article.md for more detail.
This example project contains the following files and folders
- src/requests_session_v1.py: Demo application that shows how to use Python requests to manage RDP session with Authentication Version 1.
- src/requests_session_v2.py: Demo application that shows how to use Python requests to manage RDP session with Authentication Version 2.
- src/requests_historical.py: Demo application that shows how to use Python requests to request Historical pricing data.
- src/requests_news.py: Demo application that shows how to use Python requests to request News data.
- src/requests_esg.py: Demo application that shows how to use Python requests to request ESG data.
- src/ld_session.py: Demo application that shows how to use Data Library to manage RDP session (with both Version 2 and 1).
- src/ld_access_historical.py: Demo application that shows how to use Data Library Access Layer to request Historical pricing data.
- src/ld_access_news.py: Demo application that shows how to use Data Library Access Layer to request news data.
- src/ld_content_esg.py: Demo application that shows how to use Data Library Content Layer to request ESG data.
- src/ld_content_historical.py: Demo application that shows how to use Data Library Content Layer to request Historical pricing data.
- src/ld_delivery_example.py: Demo application that shows how to use Data Library Delivery Layer Endpoint feature to request RDP data.
- src/lseg-data.config.json: Data Library version 2 configurations file.
- src/.env.example: Example .env file for the Python requests examples.
- requirements.txt: Project Python dependencies file.
- README.md: Project README file.
The first step is unzip or download the example project folder into a directory of your choice, then choose how to run application based on your environment below.
-
Open the
src/lseg_data.config.json
file and add your RTO or RTDS information based on your preference"sessions": { "default": "platform.ldp", "platform": { "ldp": { "app-key": "YOUR APP KEY GOES HERE!", "username": "YOUR LDP LOGIN OR MACHINE GOES HERE!", "password": "YOUR LDP PASSWORD GOES HERE!", "signon_control":true }, "ldpv2":{ "client_id": "Service-ID (Client ID V2)", "client_secret": "Client Secret", "signon_control":true, "app-key": "" }, } }
-
Please note that the
platform
configuration is based on your connection information:- if you are using the RDP with the Version 1 Authentication, the
default
value must beplatform.ldp
. - if you are using the RDP with the Version 2 Authentication, the
default
value must beplatform.ldpv2
.
- if you are using the RDP with the Version 1 Authentication, the
-
Create a file name
.env
at the root folder of the project and then add the following content to a file## Authentication Version 2 CLIENT_ID='YOUR_CLIENT_ID' CLIENT_SECRET='YOUR_CLIENT_SECRET' ## Authentication Version 1 MACHINE_ID='YOUR_MACHINE_ID' PASSWORD='YOUR_PASSWORD' APP_KEY='YOUR_APP_KEY'
-
Open the Command Prompt and go to the project's folder.
-
Run the following command in the Command Prompt application to create a virtual environment named venv for the project.
$>python -m venv venv
-
Once the environment is created, activate a virtual venv environment with this command.
#Windows $>venv\Scripts\activate
-
Run the following command to the dependencies in the venv environment
(venv) $>pip install -r requirements.txt
-
Run each demo application based on your preference.
The LSEG Data Library for Python lets developers rapid create the application to access LSEG Platform content with a few line of code that easy to understand and maintenance. Developers can focus on implement the business logic or analysis data without worry about the connection, authentication detail with the LSEG Platforms.
The Library also provides various of API interfaces from high-level Access Layer to low-level Delivery Layer. This helps the library suitable for a wide range of developers such as casual coder, data scientists, professional trader, and seasoned developers. Any developers with any level of knowledge can pick the layer that suitable for them and start implement the application easily.
The library is available for the following technologies:
- Python edition.
- .NET edition
- TypeScript edition.
On the other hand, the Delivery Platform APIs (RDP) let developers manual control the connection, authentication and session logic to retrieve LSEG content via a simple HTTP Web Based API. Developers with kHTTP and JSON programming knowledge can uses any programming languages and technologies to connect and consume LSEG content from the platform.
- Use a few line of code to manage and retrieve data.
- Support all LSEG platforms: Desktop, Cloud-based and Deployed infrastructure.
- Providers a set of helper types and enumerate variables to create query message quickly.
- The Library manages the connection, credentials, session and logging operations for developers. No need to manual control them in the application level.
- The Library keeps expanding functionalities to support new Services by LSEG.
- Support Python, .Net and TypeScript/JavaScript technologies only.
- You are using Python, .Net and TypeScript/JavaScript technologies
- You do not need to manage a connection, item subscription, session, and the transport layer logging operations by yourself
- You are new to programming and just want LSEG content data for analysis.
- You are data scientists or professional trader who want to get data programmatically.
- You are using other technologies such as Java, Ruby, Go, PHP, etc to implement your application/system.
- You have a requirement to manage and handle credential and session by yourself.
For further details, please check out the following resources:
- LSEG Data Library for Python on the LSEG Developer Community website.
- Data Library for Python - Reference Guide
- RDP APIs page.
- RDP APIs document page.
- The Data Library for Python - Quick Reference Guide (Access layer) article.
- Essential Guide to the Data Libraries - Generations of Python library (EDAPI, RDP, RD, LD) article.
- Data Library for Python Examples on GitHub repository.
For any question related to the products on this page, please use the Developers Community Q&A Forum.