question

Upvotes
1 0 0 0

Historical Performance Data via LSEG Data Library for Python

I'm attempting to access historical data for a set of companies using the LSEG Data Library for Python, but I am struggling to find the right methods. Particularly, I'm looking to find cash flows for previous years given a company's name. Is this achievable via this API and if so, what is the correct methodology? Thank you!

#technology#productpython apilseg-data-library
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

As a follow up, I'm aware of the .get_history() function. However, when I attempt to obtain historical fundamental data, it seems that only the most recent report for any of the cash flow-related data items is available- everything else is simply <NA>
Upvotes
15.6k 33 5 10

Hi @zachary.robers ,

Have you had a chance to check article about lots of different fundamental content here. In short the code is as follows:

import refinitiv.data as rd
rd.open_session()

rics_list = ['IBM.N']
df1 = rd.get_data(rics_list,['TR.F.CashflowStatement.fieldname','TR.F.CashflowStatement.fielddescription','TR.F.CashflowStatement'],parameters = {'Period': 'FQ0','reportingState':'Rsdt', 'curn':'Native', 'Scale':'6','SORTA':'LISeq'})
 
df1

1699371427281.png

To retrieve RICs by company's name, Screener can be used, you can check this article Find Your Right Companies with SCREENER | the Data Library (Python). For example,

1730707773665.png

import refinitiv.data as rd
from refinitiv.data.discovery import Screener

rd.open_session()

rics = Screener('U(IN(Equity(active,public,primary))/*UNV:Public*/), IN(TR.CommonName,"Vodafone Group PLC","Microsoft Corp"), CURN=USD')
print(list(rics))

Here's the result as Python list

['VOD.L', 'MSFT.OQ']

1730707773665.png (84.1 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
15.6k 33 5 10

In case you want to find the company that contains the company name you have instead of exact company name, search function can be used, please check article Find content and functionality using the Data Library with Workspace Advanced Search

For example,

1730708106064.png

Here's the exported code

import refinitiv.data as rd
rd.open_session()

df = rd.discovery.search(
view = rd.discovery.Views.ORGANISATIONS,
top = 1000,
filter = "( SearchAllCategoryv2 eq 'Companies/Issuers' and (DTSubjectName in ('microsoft' 'vodafone')))",
select = "CommonName,PrimaryRIC"
)

The result of search function is

1730708252364.png

From this, the list of RICs can be extracted with the code below, and this list can be used as an input of get_data function in the previous comment

rics_list = df['PrimaryRIC'].dropna().tolist()

result is

['MSFT.O',
 'VOD.L',
 'VODA.NS',
 'VFQS.QA',
 '483330.KS',
 'MSFX.K',
 'MSHE.TO',
 'MSFH.TO',
 'MSFY.K',
 'MSFT1.AS',
 'VODE.CA',
 'COBRA.MI^H14',
 'TELN.IN^J03',
 'MMNG.DE^I99',
 'NAVI.CO^H02',
 'LTEL.AS^D03',
 'PANa.AT^J09',
 'UBID1DP.NS',
 'MSFY.NLB',
 'FISTPIP1GP.NS',
 'MI1MPD.NS',
 'FICRF1DPD.NS',
 'FIIOF1DPD.NS',
 'IF1DPD.NS']

1730708106064.png (208.4 KiB)
1730708252364.png (20.3 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.