Question 3 – In our code we aim to capture all future dividends using the future dividend cashflows and dividends that have gone XD in the current month up to the current date. Intermediate Capital Group (SEDOL = BYT1DJ1) has no future dividend expectations however is going XD-Div on the 12-June based on the bottom rows. Therefore, our code does not capture this dividend as it has not yet gone XD-Div but has no forward dividends. Therefore, I am looking for an alternative way for us to capture this dividend.
client is using this api code
import lseg.data as ld
ld.open_session()
SEDOLs = '7021963'
def transform_ric(ric):
parts = ric.split('.', 1) # Split into two parts at the first "."
return parts[0] + 'DIVCF.' + parts[1] if len(parts) > 1 else ric + 'DIVCF'
def transform_row80_4(value):
value=value.strip()
if len(value) >= 4 and value[-4] == ' ':
return value[-3:]
else:
return 'No_FX'
# Grab ric code and dividend currency for each stock based on SEDOL
equity_parameters = ld.get_data(universe = SEDOLs, fields = ['TR.RIC'])
#Transform RICs and amend to code type used for fwd dividends
if equity_parameters is not None:
df_equity_codes = equity_parameters.dropna(subset=['RIC'])
else:
df_equity_codes = equity_parameters
df_equity_codes['Div RIC'] = df_equity_codes['RIC'].apply(transform_ric)
equity_static = ld.get_data(universe = SEDOLs, fields = ['TR.RegCountryCode'])
# Fields for retreiving forward dividend details
fields = [
'ROW80_1',
'ROW80_4',
'ROW80_7',
'ROW80_8',
'ROW80_9',
'ROW80_10',
'ROW80_11',
'ROW80_12',
'ROW80_13',
'ROW80_14',
'ROW80_15',
'ROW80_16',
'ROW80_17',
'ROW80_18',
'ROW80_19',
'ROW80_20',
'ROW80_21',
'ROW80_22',
]
RICs = df_equity_codes['Div RIC'].tolist()
# Retreive forward dividends estimates from LSEG
equity_fwd_dvd = ld.get_data(universe = RICs, fields = fields)