Package: refinitiv-data
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 theAccess layeris the easiest way to get Refinitiv data. TheAccess layerprovides 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.TheContent layeris the basement of the Access layer. It provides developers with interfaces suitable for more advanced use cases (synchronous function calls, async/await, event driven). TheContent layerrefers to logical market data objects like market data prices and quotes, fundamental & reference data, historical data, company research data and so on.TheDelivery layeris a low abstraction layer that defines interfaces used to interact with service agnostic delivery mechanisms of the Refinitiv Data Platform. TheDelivery layeris a foundational component of theContent layer.TheSession layerdefines 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 theAccess layerImport the Refinitiv Data Libraryimportrefinitiv.dataasrdOpen a data sessionrd.open_session()Get pricing snapshots and fundamental datadf=rd.get_data(universe=['IBM.N','VOD.L'],fields=['BID','ASK','TR.Revenue'])print(df)InstrumentBIDASK0IBM.N0.000.01VOD.L120.02120.1Get Fundamental and pricing historydf=rd.get_history(universe="GOOG.O",fields=["BID","ASK","TR.Revenue"],interval="1Y",start="2015-01-01",end="2019-10-01",)print(df)GOOG.OBIDASKRevenue2015-12-31759.06758.99749890000002016-12-31772.94772.12902720000002017-12-311046.461046.41108550000002018-12-311037.361036.982019-12-311336.941335.9Close the sessionrd.close_session()... with theContent layerdedicated to advanced use casesImport the Refinitiv Data Libraryimportrefinitiv.dataasrdOpen a data sessionrd.open_session()Fundamental And Reference data retrievalfromrefinitiv.data.contentimportfundamental_and_referenceresponse=fundamental_and_reference.Definition(["TRI.N","IBM.N"],["TR.Revenue","TR.GrossProfit"]).get_data()print(response.data.df)instrumentdateTR.RevenueTR.GrossProfit0TRI.N2020-12-31T00:00:00598400000056560000001IBM.N2020-12-31T00:00:007362000000035574000000Historical data retrievalfromrefinitiv.data.contentimporthistorical_pricingresponse=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_UNS2019-12-12144.32144.34144.42145.66143.46144.1812631.08498347218.711542019-12-11143.58143.6142.72144.8142.62143.5810395.08815450412.653532019-12-10142.74142.78143.84143.84141.48142.7410311.08070285210.45742...........................2019-11-18152.1152.12154.74155.66152.0152.1214606.019322988639.342019-11-15154.6154.62160.68160.68154.06154.632617035.031993013818.37456Real-time streaming data retrievalfromrefinitiv.data.contentimportpricingpricing_stream=rd.content.pricing.Definition(universe=['EUR=','GBP=','JPY=','CAD='],fields=['DSPLY_NAME','BID','ASK']).get_stream()pricing_stream.on_refresh(lambdapricing_stream,instrument_name,fields:print(f"Refresh received for{instrument_name}:{fields}"))pricing_stream.on_update(lambdapricing_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}Searchfromrefinitiv.data.contentimportsearchresponse=search.Definition("IBM").get_data()print(response.data.df)RICBusinessEntityPermIDDocumentTitlePI0ORGANISATIONInternational Business Machines Corp, Public C...370361IBMQUOTExEQUITY55839165994International Business Machines Corp, Ordinary...10973262ORGANISATIONTiers Corporate Bond Backed Certificates Trust...180626703ORGANISATIONSG Stuttgart Vaihingen BM-Campus 1 UG haftungs...2796838940#IBMF:QUOTExEQUITY21481052421Eurex International Business Machines Equity F...4892473250#IBMDF:QUOTExEQUITY21612423771Euronext Amsterdam IBM Dividend Future Chain C...2591187636IBMFc1QUOTExEQUITY21481052892Eurex International Business Machines Equity F...494506817IBMFc2QUOTExEQUITY21481053949Eurex International Business Machines Equity F...500923478IBMDFc1QUOTExEQUITY21613372305Euronext Amsterdam IBM Single Stock Dividend F...2602130219IBMFc3QUOTExEQUITY21481053950Eurex International Business Machines Equity F...50092348Close the sessionrd.close_session()Learn moreTo learn more about the Refinitiv Data Library for Python simply log into the Refinitiv Developer Community. Byregisteringandlogging into the Refinitiv
Developer Community portal you will have free access to a number of
learning materials such asQuick Start guides,Tutorials,Documentationand much more.Help and SupportIf you have any questions regarding the API usage, please post them on
theRefinitiv Data Q&A Forum.
The Refinitiv Developer Community will be very pleased to help you.