The Query
I am using the lseg-data Python library ( https://pypi.org/project/lseg-data/ ). A few questions: 1. How do I retrieve quarterly financial data for a company? 2. In particular I am interested in segmented revenue data. Is TR.BGS.BusTotalRevenue the correct field to query or is it TR.F.PRDEXTREVASR? A lot of forum posts refer to TR.BGS.BusTotalRevenue but I cannot find this field in the Workspace Data Item Browser. 3. I've tried using lseg_data.get_history but I get a strange error (see attached screenshot)
@Siddhanth.V
Thank you for reaching out to us.
This forum is dedicated to software developers using LSEG APIs. The moderators on this forum do not have deep expertise in every bit of content available through LSEG products, which is required to answer content questions such as this one.
The best resource for content questions is the Helpdesk support team, which can be reached by submitting queries through LSEG Support. The support team will either have the required content expertise ready available or can reach out to relevant content experts to get the answer for you.
You need to ask for the Excel formula, such as =RDP.Data and =RDP.HistoricalPricing, that can be used to retrieve the required data. Then, we can help you converting that formula to Python code.
Hello @Jirapongse Good day! For the requested data you can use these data items- "TR.F.PeriodEndDate;TR.F.StatementDate;TR.F.statementheaders.StdCurr;TR.F.statementheaders.IndGroupGl;TR.F.PresentationFormat"
Please find the below sample Workspace excel formula which we are getting for all of the historical periods as well:
=@RDP
.Data("AAPL.O","TR.F.PeriodEndDate;TR.F.StatementDate;TR.F.statementheaders.StdCurr;TR.F.statementheaders.IndGroupGl;TR.F.PresentationFormat","Period=FQ0 Frq=FQ SDate=0 EDate=-4 CH=Fd RH=IN")
@UDAY_1
The Python code looks like this:
df = ld.get_data( universe = ['AAPL.O'], fields = ['TR.F.PeriodEndDate;TR.F.StatementDate;TR.F.statementheaders.StdCurr;TR.F.statementheaders.IndGroupGl;TR.F.PresentationFormat'], parameters = {'Period':'FQ0','Frq':'FQ','SDate':0,'EDate':-4}) df
The output is:
HI @Jirapongse Mr. Sean confirmed
Yes, I am aware of that. These parameters
parameters = { "FRQ": "FY", "SDate": "0", "EDate": "-10" }
were the ones I was first using before I opened this ticket. These parameters get me the correct results, which also include the FY2023 data.
But why do the parameters with the actual start and end dates
parameters={'Period': 'FY0', 'Frq':'FY', 'SDate':'2000-01-01', 'EDate':'2026-01-16'},
in the sample code snippet you gave me last week not returning FY2023 data?
I understand that the snippet you gave me was for pulling quarterly data. I just changed FRQ from FQ to FY to get fiscal year data instead. But can you point me to where I made a mistake in the fundamental_and_reference call for full fiscal year data that resulted in the missing data? Thanks
It is better to check the data in the Workspace Excel with the same instruments, fields, and parameters. For example:
=RDP.Data("4295903763","TR.F.RevGoodsSrvc","SDate=2000-01-01 EDate=2026-01-16 CH=Fd RH=IN,fperiod",B2)
The output in Excel doesn't have FY2023.
Please contact the Workspace Excel support team to verify it.