How to set the Period year = [2025,2026] to be dynamic in CODEBK?

how do i make a function like this to work?

import refinitiv.data as rd

rd.open_session()

year = [2025,2026]

df = rd.get_data(

universe = ['CEAB3.SA'],

fields = ['TR.NetProfitMean(Period=year1})',

'TR.NetProfitMean(Period=year2})'],

parameters = {

'year1':year[0],

'year2':year[1]

}

)

display(df)

the year list is dynamic. So i want the Period=year[i] to also be dynamic

 I want to set the Period=FY2025 as Period=X, with X being dynamic.

Answers

  • Hello @grace.arquion

    Its not clear what you intend to achieve. If the interest is in getting data for a field for multiple years, you can try the following -

    df = rd.get_data(
      universe = ['CEAB3.SA'], 
      fields = ['TR.NetProfitMean', 'TR.NetProfitMean.periodenddate'],
      parameters = {'SDate':0 , 'EDate': 2, 'Period': 'FY1', 'Frq': 'FY'}
    )
    

    Note that series data is only provided for the fields which support time series. Check the availability of "Series" checkbox in the Data Item Browser for that particular field.

    image.png