Hello,
I am working on a project where I need to complete an Excel table containing information on M&A deals. I am using the Refinitiv API to retrieve the missing financial metrics for the acquirers, specifically:
- EBITDA Margin for the year of the deal (N) and two years after (N+2)
- Pre-tax ROE for the year of the deal (N) and two years after (N+2)
- Pre-tax ROA for the year of the deal (N) and two years after (N+2)
Here are some details about my setup and what I have tried so far:
Environment Setup:
- I am using Python with the
pandas
and refinitiv.data
libraries. - I have configured the environment variable
RD_LIB_CONFIG_PATH
to point to my configuration file.
Reading Information from the Excel Table:
- I have successfully read the basic information from the table, including the acquirer name and the deal year.
Issues Encountered:
import os
import pandas as pd
import refinitiv.data as rd
# Configure the environment variable
os.environ["RD_LIB_CONFIG_PATH"] = "../Configuration"
# Load the Excel file
file_path = r'C:\Users\jean-\Desktop\Memoire\Test.xlsx'
df = pd.read_excel(file_path)
# Extract the first observation for the test
first_observation = df.iloc[0]
acquiror_name = first_observation['Acquiror Full Name']
deal_date = first_observation['Date Announced']
deal_year = deal_date.year
print(f"Acquiror: {acquiror_name}, Deal Year: {deal_year}")
# Open the session
rd.open_session(name='platform.rdp')
print("Session opened successfully.")
try:
# Example attempt to retrieve financial metrics
ebitda_margin_n_response = rd.metrics.get(
universe=[acquiror_name],
fields=['TR.F.EBITDAMARGPCT'],
parameters={'SDate': f'{deal_year}-12-31', 'EDate': f'{deal_year}-12-31'}
)
ebitda_margin_n = ebitda_margin_n_response.data.df['TR.F.EBITDAMARGPCT'].iloc[0] if ebitda_margin_n_response.is_success else None
print(f"EBITDA margin N: {ebitda_margin_n}")
except Exception as e:
print(f"Failed to retrieve data for {acquiror_name}: ", str(e))
# Close the session
rd.close_session()
print("Session closed successfully.")
Request for Help
I am looking for help to:
- Identify the correct methods and attributes to retrieve the necessary financial metrics (EBITDA Margin, Pre-tax ROE, Pre-tax ROA).
- Provide a functional code example to retrieve these data for a given company and a specific year.
Thank you in advance for your assistance!