1. Home
  2. API Catalog
  3. Refinitiv Data Library for Python

Refinitiv Data Library for Python

Welcome to the new Refinitiv Data Library for Python (BETA)


We are happy to share this pre-release with you! Please feel free to use this library and we welcome any thoughts and suggestions you may have. As a beta product, the interface is still subject to minor change. It is planned to be released it in Q2 2022.

All questions and feedback can be sent to us through our Q&A Forums

The latest version of the Refinitiv Data Library for Python is available from PyPi. Editions for TypeScript and for .NET are also available. Related learning materials will be published on the Refinitiv Developer Community very soon. 

 

The Refinitiv Data Library for Python 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 Refinitiv Data Platform. The platform refers to the layer of data services providing streaming and non-streaming content, bulk content and even more, serving different client types from the simple desktop interface to the enterprise application. With the Refinitiv Data Library, the same Python code can be used to retrieve data regardless of which access point you choose to connect to the platform. The series of examples presented in this project demonstrates how to use the Refinitiv Data Library for these different use cases. 

The library provides multiple layers of abstraction allowing for different styles and programming technics suitable for all developers, from financial coders to seasoned developers:

  • The Access layer is the easiest way to get Refinitiv data. It provides simple interfaces allowing you to quickly prototype solutions in interactive environments such as Jupyter Notebooks. It was designed for quick experimentation with our data and for the specific needs of financial coders.
  • The Content layer is the foundation of the Access layer. It provides developers with interfaces suitable for more advanced use cases (synchronous function calls, async/await, event driven). The Content layer refers to logical market data objects such as market data prices and quotes, fundamental & reference data, historical data, company research data and so on.
  • The Delivery layer is a lower abstraction layer that allows your applications to retrieve data using the service agnostic delivery mechanisms defined by the Refinitiv Data Platform. The Delivery layer is a foundational component of the Content layer.
  • The Session layer defines interfaces allowing your application to connect to the Refinitiv Data Platform via its various access points (either via a direct connection, via Eikon, via the Refinitiv Workspace, via CodeBook or even via a local Real-Time Distribution System).

The library is available on PyPI here

Quick example using the Access layer

Import the Refinitiv Data Library

    	
            import refinitiv.data as rd
        
        
    

Open a data session

    	
            rd.open_session()
        
        
    

Get pricing snapshots and fundamental data

    	
            df = rd.get_data(
    universe=['IBM.N', 'VOD.L'],
    fields=['BID', 'ASK', 'TR.Revenue']
)
print(df)
  Instrument BID ASK
0 IBM.N 0.00 0.0
1 VOD.L 120.02 120.1

Get Fundamental and pricing history

    	
                df = rd.get_history(
    universe="GOOG.O",
    fields=["BID", "ASK", "TR.Revenue"],
    interval="1Y",
    start="2015-01-01",
    end="2019-10-01",
)
print(df)
GOOG.O BID ASK Revenue
2015-12-31 759.06 758.99 74989000000
2016-12-31 772.94 772.12 90272000000
2017-12-31 1046.46 1046.4 110855000000
2018-12-31 1037.36 1036.98 <NA>
2019-12-31 1336.94 1335.9 <NA>

Close the session

    	
            rd.close_session()