Sdate & Edate python api

Hi, Below is my code :

etf_esg, err = ek.get-data('0#.'XUTUM', ['TR.TRESGScore','TR.TRESGCScore','TR.EnvironmentPillarScore'])

I know as some companies in XUTUM having already published their score 2022, others haven't yet, some securities have the data begin in 2022 / others in 2021.

I need a python code for me to get both 2021 and 2022 scores in "excel output" so that they will be show in two seperate columns.

Regards,

Best Answer

  • Hi gaye.sakarya,


    You may try following codes:

    etf_esg, err = ek.get_data('0#.XUTUM', ['TR.TRESGScore.date','TR.TRESGScore','TR.TRESGCScore','TR.EnvironmentPillarScore'],

    {'SDate':'0', 'EDate':'-2','Period':'FY0','Frq':'FY'})

    etf_esg['Date']=etf_esg['Date'].astype('str')

    etf_esg['Date']=etf_esg['Date'].apply(lambda x: x[:10])

    etf_esg = etf_esg[etf_esg['Date']>='2021']

    etf_esg


    api.png

Answers

  • Hi Frank, thanks for


    I want to see both 2021 and 2022 scores of companies. When I ran your code, only the notes for the end of December 2021 came up. How can I see both 2021 and 2022 scores?


  • There is one company (DOCO.IS) that released ESG content on 2022-03-31.

    api.png

    If you know there is other companies who released 2022 ESG score, would you please check if they're already available in Eikon desktop?


  • thanks. I did it thanks to your code. So how do you think I can run this code automatically? I tried to do it with Task Scheduler, but when my computer opens python exe, this code does not run. Because I am using anaconda. I can run with anaconda prompt. On the other hand, I have tried .bat file format.