Python refinitiv fundamental returning wrong data -- very weird an incoherent behavior
I'm using the Refinitiv package in python, following code, and receive wrong data back, also depending on the parameters.
The code:
import refinitiv.data as rd
from refinitiv.data.content import fundamental_and_reference
rd.open_session()
fields = [
'TR.F.TotRevenue.fperiod',
'TR.F.TotRevenue',
'TR.F.COGSTot.fperiod',
'TR.F.COGSTot',
'TR.F.IncTaxDef.fperiod',
'TR.F.IncTaxDef'
]
parameters = {
"SDate": '-30Y',
"EDate": '-1d',
"FRQ": "FY", # frequency, full year
"Scale": 3, # in thousands
"Curn": 'EUR',
}
response = fundamental_and_reference.Definition(
universe=['5056437385'],
fields=fields,
use_field_names_in_headers=True,
parameters=parameters
).get_data()
df = response.data.df
print(df)
This returns a dataframe with data from 2001 to 2018, formatted as EUR. See below:
There are 2 problems with dataframe:
1. The years FY2007 is double. Why is this?
2. The value for "TR.F.IncTaxDef" is different for each row. First row is 560 and second row is -455.
The data can be verified in the Refinitiv Workspace app, searching for instrument 5056437385, then opening the financials and opening the income statement. Revenue for all years are correct. The IncTaxDef should be -605. See:
What we can do is zoom into the years, using parameters:
parameters = {
"SDate": '-18Y',
"EDate": '-14Y',
"FRQ": "FY", # frequency, full year
"Scale": 3, # in thousands
"Curn": 'EUR',
}
The same code results in:
As you can see: the IncTaxDef is correct, -605. However there is no COGS. Also 2007 is double.
This is very weird and incoherent behavior. In the working of the API I would expect:
1. If the parameter FRQ is "FY", then I would expect that each row is a unique year. How come 2007 is double?
2. If we adjust Sdate/Edate, then this should not change the data. How come if I search for past 30Y I get a different value for the income tax then if I search for -18Y.
3. The API should result in the same values as found in the financial report of the app. How come the tax income is different for 2007?
What is going on and can you help to get coherent code working?
Thanks
Best Answer
-
Hi @r.fernandez ,
I checked your code above with RD version 1.6.1 and it seems the issue you are facing is now resolved. Can you please check and confirm?
See below by request/response:
parameters = {
"SDate": '-18Y',
"EDate": '-14Y',
"FRQ": "FY", # frequency, full year
"Scale": 3, # in thousands
"Curn": 'EUR',
}
df = rd.get_history(universe=['5056437385'],
fields=[
'TR.F.TotRevenue',
'TR.F.COGSTot',
'TR.F.IncTaxDef'],
interval="1Y",
use_field_names_in_headers=True,
parameters = parameters)Best regards,
Haykaz
0
Answers
-
As you can see, the Refinitiv workspace return 605 as value for income tax deferred in 2007 (screenshot 1 in text)
If you use the parameters -18Y/-14Y, you retrieve the 'correct' income tax deferred (screenshot 2 in text):
However, what is weird, you receive 2 rows, with 2007 each
0 -
@r.fernandez so I would use the get_history function as that has row fidelity in the returns. If I do that I can see that there was a change in book closing period in 2007. So essentially there are 2 entries in this return - but I agree it is not correct. However look at rd.get_history function return for the full period:
rd.get_history(universe=["5056437385"],
fields=['TR.F.TotRevenue.fperiod','TR.F.TotRevenue','TR.F.COGSTot.fperiod','TR.F.COGSTot','TR.F.IncTaxDef.fperiod','TR.F.IncTaxDef'],
interval="1Y",
parameters = {"SDate": '-30Y',"EDate": '-1D',"FRQ": "FY","Scale": 3, "Curn": 'EUR'},
use_field_names_in_headers=True)If I then change the call to reflect your second request:
rd.get_history(universe=["5056437385"],
fields=['TR.F.TotRevenue.fperiod','TR.F.TotRevenue','TR.F.COGSTot.fperiod','TR.F.COGSTot','TR.F.IncTaxDef.fperiod','TR.F.IncTaxDef'],
interval="1Y",
parameters = {"SDate": '-18Y',"EDate": '-14Y',"FRQ": "FY","Scale": 3, "Curn": 'EUR'},
use_field_names_in_headers=True)It is the same as get_history - I will check with the team involved about the get_history return - but I believe we have at least isolated it to the change in book closing. The code for the get_history function is also a lot cleaner than using the content layer definition.I hope this can help.
0 -
Can you explain or show me the documentation that explains what row fidelity is and the concepts behind row fidelity?
0 -
Can you explain the following strange behavior. Perhaps this has to do with row fidelity, but I'm not sure what this means. However, applying your code with an extended field TR.F.MktCap generates extra rows. Let me show you. The code:
parameters = {
"SDate": '-18Y',
"EDate": '-14Y',
"FRQ": "FY", # frequency, full year
"Scale": 3, # in thousands
"Curn": 'EUR',
}
df = rd.get_history(universe=['5056437385'],
fields=[
'TR.F.TotRevenue',
'TR.F.COGSTot',
'TR.F.IncTaxDef'],
interval="1Y",
use_field_names_in_headers=True,
parameters = parameters)
rd.close_session()
print(df)This generates the following, completely logical data:
When I add the column TR.F.MktCap in fields we get the following:
Logical behavior: The row 2008 is now filled with market cap, no data is the for revenue and tax because of update in closing booker.
Illogical behavior: row 2007 is doubled. Data revenue/tax is applied twice. Marketcap is only visible in first row.
Can you explain this behavior?
0 -
And also 2nd illogical behavior. 2008 is doubled as well, 30 may and 31 December. For this the second has no data.0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛