Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

refinitiv-data

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

refinitiv-data

Client for Refinitiv Data Platform API's

  • 1.6.2
  • PyPI
  • Socket score

Maintainers
3

The Refinitiv Data Library for Python provides a set of ease-of-use interfaces offering your applications a uniform access to the breadth and depth of financial data and services available on the Refinitiv Data Platform.

With this library, the same Python code can be used to retrieve data whatever the access point you choose to connect your application to the Refinitiv Data Platform. It can be either via a direct connection, via Eikon, via Refinitiv Workspace, via CodeBook or even via a local Real-Time Distribution System.

The library provides several abstraction layers enabling different programming styles and technics suitable for all developers from Financial Coders to Seasoned Developers:

  • Using the Access layer is the easiest way to get Refinitiv data. The Access layer provides simple interfaces allowing you to rapidly prototype solutions within interactive environments such as Jupyter Notebooks. It has been designed for quick experimentation with our data and for Financial Coders specific needs.
  • The Content layer is the basement 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 like market data prices and quotes, fundamental & reference data, historical data, company research data and so on.
  • The Delivery layer is a low abstraction layer that defines interfaces used to interact with service agnostic delivery mechanisms of 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 different access points (either via a direct connection, via Eikon, via the Refinitiv Workspace, via CodeBook or even via a local Real-Time Distribution System).

Some examples...

... with 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)
InstrumentBIDASK
0IBM.N0.000.0
1VOD.L120.02120.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.OBIDASKRevenue
2015-12-31759.06758.9974989000000
2016-12-31772.94772.1290272000000
2017-12-311046.461046.4110855000000
2018-12-311037.361036.98
2019-12-311336.941335.9

Close the session

rd.close_session()

... with the Content layer dedicated to advanced use cases

Import the Refinitiv Data Library

import refinitiv.data as rd

Open a data session

rd.open_session()

Fundamental And Reference data retrieval

from refinitiv.data.content import fundamental_and_reference

response = fundamental_and_reference.Definition(
    ["TRI.N", "IBM.N"],
    ["TR.Revenue", "TR.GrossProfit"]
).get_data()

print(response.data.df)
instrumentdateTR.RevenueTR.GrossProfit
0TRI.N2020-12-31T00:00:0059840000005656000000
1IBM.N2020-12-31T00:00:007362000000035574000000

Historical data retrieval

from refinitiv.data.content import historical_pricing

response = historical_pricing.summaries.Definition(
    universe='VOD.L', 
    interval=historical_pricing.Intervals.DAILY,
    fields=['BID','ASK','OPEN_PRC','HIGH_1','LOW_1','TRDPRC_1','NUM_MOVES','TRNOVR_UNS']
).get_data()

print(response.data.df)
BIDASKOPEN_PRCHIGH_1LOW_1TRDPRC_1NUM_MOVESTRNOVR_UNS
2019-12-12144.32144.34144.42145.66143.46144.1812631.08498347218.71154
2019-12-11143.58143.6142.72144.8142.62143.5810395.08815450412.65353
2019-12-10142.74142.78143.84143.84141.48142.7410311.08070285210.45742
...........................
2019-11-18152.1152.12154.74155.66152.0152.1214606.019322988639.34
2019-11-15154.6154.62160.68160.68154.06154.632617035.031993013818.37456

Real-time streaming data retrieval

from refinitiv.data.content import pricing

pricing_stream = rd.content.pricing.Definition(
    universe=['EUR=', 'GBP=', 'JPY=', 'CAD='], 
    fields=['DSPLY_NAME', 'BID', 'ASK']
).get_stream()

pricing_stream.on_refresh(lambda pricing_stream, instrument_name, fields : 
        print(f"Refresh received for {instrument_name}: {fields}"))
	
pricing_stream.on_update(lambda pricing_stream, instrument_name, fields : 
        print(f"Update received for {instrument_name}: {fields}"))

pricing_stream.open()

Output:

Refresh received for EUR= : {'DSPLY_NAME': 'BARCLAYS     LON', 'BID': 1.1635, 'ASK': 1.1639}
Refresh received for GBP= : {'DSPLY_NAME': 'NEDBANK LTD  JHB', 'BID': 1.3803, 'ASK': 1.3807}
Refresh received for CAD= : {'DSPLY_NAME': 'DANSKE BANK  COP', 'BID': 1.2351, 'ASK': 1.2352}
Refresh received for JPY= : {'DSPLY_NAME': 'ASANPACIFIBK MOW', 'BID': 113.81, 'ASK': 113.83}
Update received for JPY= : {'DSPLY_NAME': 'NEDBANK LTD  JHB', 'BID': 113.81, 'ASK': 113.83}
Update received for CAD= : {'DSPLY_NAME': 'DANSKE BANK  COP', 'BID': 1.2351, 'ASK': 1.2352}
Update received for JPY= : {'DSPLY_NAME': 'ASANPACIFIBK MOW', 'BID': 113.81, 'ASK': 113.83}
Update received for EUR= : {'DSPLY_NAME': 'BARCLAYS     LON', 'BID': 1.1635, 'ASK': 1.1639}
Update received for CAD= : {'DSPLY_NAME': 'DANSKE BANK  COP', 'BID': 1.2351, 'ASK': 1.2352}
from refinitiv.data.content import search

response = search.Definition("IBM").get_data()

print(response.data.df)
RICBusinessEntityPermIDDocumentTitlePI
0ORGANISATIONInternational Business Machines Corp, Public C...37036
1IBMQUOTExEQUITY55839165994International Business Machines Corp, Ordinary...1097326
2ORGANISATIONTiers Corporate Bond Backed Certificates Trust...18062670
3ORGANISATIONSG Stuttgart Vaihingen BM-Campus 1 UG haftungs...27968389
40#IBMF:QUOTExEQUITY21481052421Eurex International Business Machines Equity F...48924732
50#IBMDF:QUOTExEQUITY21612423771Euronext Amsterdam IBM Dividend Future Chain C...259118763
6IBMFc1QUOTExEQUITY21481052892Eurex International Business Machines Equity F...49450681
7IBMFc2QUOTExEQUITY21481053949Eurex International Business Machines Equity F...50092347
8IBMDFc1QUOTExEQUITY21613372305Euronext Amsterdam IBM Single Stock Dividend F...260213021
9IBMFc3QUOTExEQUITY21481053950Eurex International Business Machines Equity F...50092348

Close the session

rd.close_session()

Learn more

To learn more about the Refinitiv Data Library for Python simply log into the Refinitiv Developer Community. By registering and logging in to the Refinitiv Developer Community portal you will have free access to a number of learning materials such as Quick Start guides, Tutorials, Documentation and much more.

Help and Support

If you have any questions regarding the API usage, please post them on the Refinitiv Data Q&A Forum. The Refinitiv Developer Community will be very pleased to help you.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc