Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
21 0 0 1

Please provide the correct syntax

i used the following code to retrieve the data:

rd.open_session()


data_points = [

'TR.TRESGScore.Date',

'TR.SustainabilityComm',

'TR.IntegratedStrategyMD&A',

'TR.GlobalCompact',

'TR.StakeholderEngagement',

'TR.CSRReporting',

'TR.CSRReportingGRI',

'TR.CSRReportingGlobalActivities',

'TR.CSRReportingExternalAudit',

'TR.CSRReportingExternalAuditName',

'TR.CSRReportingScope',

'TR.ESGPeriodLastUpdateDate',

'TR.UNPRISignatory',

'TR.SDG1NoPoverty',

'TR.SDG2ZeroHunger',

'TR.SDG3GoodHealthWellbeing',

'TR.SDG4QualityEducation',

'TR.SDG5GenderEquality',

'TR.SDG6CleanWaterSanitation',

'TR.SDG7AffordableCleanEnergy',

'TR.SDG8DecentWorkEconomicGrowth',

'TR.SDG9IndustryInnovationInfrastructure',

'TR.SDG10ReducedInequality',

'TR.SDG11SustainableCitiesCommunities',

'TR.SDG12ResponsibleConsumptionProduction',

'TR.SDG13ClimateAction',

'TR.SDG14LifeBelowWater',

'TR.SDG15LifeonLand',

'TR.SDG16PeaceJusticeStrongInstitutions',

'TR.SDG17PartnershipsAchieveGoal'

]

universe = ['AAPL.OQ','AMZN.OQ','MSFT.OQ','GOOGL.OQ','INTC.OQ','META.OQ','NFLX.OQ','NVDA.OQ','TSLA.OQ']

params = {'SDate': '0', 'EDate': '0', 'Period': 'FY0', 'Frq': 'FY'}

data = rd.get_data(universe, data_points, params)

strategy = data = download_data(universe, data_points, params)

workspace#technologypython apirefinitiv-data-libraries
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@jason.ramchandani01
need your help here please.

Thank you.

Upvotes
21 0 0 1

Can you please convert the below formula in Python API please?


=@TR(A4:A10,"TR.CSRReportingScope;TR.ESGPeriodLastUpdateDate;TR.UNPRISignatory;TR.SDG1NoPoverty;TR.SDG2ZeroHunger;TR.SDG3GoodHealthWellbeing;TR.SDG4QualityEducation;TR.SDG5GenderEquality;TR.SDG6CleanWaterSanitation;TR.SDG7AffordableCleanEnergy;TR.SDG8"&"DecentWorkEconomicGrowth;TR.SDG9IndustryInnovationInfrastructure;TR.SDG10ReducedInequality;TR.SDG11SustainableCitiesCommunities;TR.SDG12ResponsibleConsumptionProduction;TR.SDG13ClimateAction;TR.SDG14LifeBelowWater;TR.SDG15LifeonLand;TR.SDG16PeaceJust"&"iceStrongInstitutions;TR.SDG17PartnershipsAchieveGoal","CH=Fd RH=IN",I16)

=@TR(A4:A10,"TR.CSRReportingScope;TR.ESGPeriodLastUpdateDate;TR.UNPRISignatory;TR.SDG1NoPoverty;TR.SDG2ZeroHunger;TR.SDG3GoodHealthWellbeing;TR.SDG4QualityEducation;TR.SDG5GenderEquality;TR.SDG6CleanWaterSanitation;TR.SDG7AffordableCleanEnergy;TR.SDG8"&"DecentWorkEconomicGrowth;TR.SDG9IndustryInnovationInfrastructure;TR.SDG10ReducedInequality;TR.SDG11SustainableCitiesCommunities;TR.SDG12ResponsibleConsumptionProduction;TR.SDG13ClimateAction;TR.SDG14LifeBelowWater;TR.SDG15LifeonLand;TR.SDG16PeaceJust"&"iceStrongInstitutions;TR.SDG17PartnershipsAchieveGoal","CH=Fd RH=IN",I16)


Where: A4:A10 are:
'APL.OQ'

AMZN.OQ

MSFT.OQ

GOOGL.OQ

INTC.OQ

META.OQ

NFLX.OQ

NVDA.OQ

TSLA.OQ


Thank you.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
10.6k 20 6 9

@irene.upo Please try:

import refinitiv.data as rd
import pandas as pd
rd.open_session()
data_points = ['TR.TRESGScore.Date','TR.SustainabilityComm','TR.IntegratedStrategyMD&A',
               'TR.GlobalCompact','TR.StakeholderEngagement','TR.CSRReporting',
               'TR.CSRReportingGRI','TR.CSRReportingGlobalActivities',
               'TR.CSRReportingExternalAudit','TR.CSRReportingExternalAuditName',
               'TR.CSRReportingScope','TR.ESGPeriodLastUpdateDate','TR.UNPRISignatory',
               'TR.SDG1NoPoverty','TR.SDG2ZeroHunger','TR.SDG3GoodHealthWellbeing',
               'TR.SDG4QualityEducation','TR.SDG5GenderEquality','TR.SDG6CleanWaterSanitation',
               'TR.SDG7AffordableCleanEnergy','TR.SDG8DecentWorkEconomicGrowth',
               'TR.SDG9IndustryInnovationInfrastructure','TR.SDG10ReducedInequality',
               'TR.SDG11SustainableCitiesCommunities','TR.SDG12ResponsibleConsumptionProduction',
               'TR.SDG13ClimateAction','TR.SDG14LifeBelowWater','TR.SDG15LifeonLand',
               'TR.SDG16PeaceJusticeStrongInstitutions','TR.SDG17PartnershipsAchieveGoal'
]
 
universe = ['AAPL.OQ','AMZN.OQ','MSFT.OQ','GOOGL.OQ','INTC.OQ','META.OQ','NFLX.OQ','NVDA.OQ',
            'TSLA.OQ']
params = {'SDate': '0', 'EDate': '0', 'Period': 'FY0', 'Frq': 'FY'}
data = rd.get_data(universe, data_points, params)
data

1719258508126.png

I Hope this can help.



1719258508126.png (238.6 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi Jason,


Thanks for providing the syntax. However, I cannot replicate the data output. The get_data always stops at the datapoint "TR.IntegratedStrategyMD&A", when I rename it to "TR.IntegratedStrategyMDnA", as seen in other databases, the point is skipped and I get the output for all the other variables, i.e. when I reorder the datapoints, it always stops at "TR.IntegratedStrategyMD&A". Do you have any idea how to retrieve the datapoint and fix this problem?

May I know what environment and Python you are using?


Tia!

Hi @jason.ramchandani01 Thanks for the answer. I have figured out the problem, but I do not have a solution yet. The problem is the datapoint "TR.IntegratedStrategyMD&A". The download stops when reaching this datapoint because of the "&", when removing the "&" character the download continues, but of course I do not get the data for this datapoint. Unfortunately, using "TR.IntegratedStrategyMDnA" (which I also found as the code for this datapoint) does not give me the data either. I'm looking forward to hearing from you, thanks in advance!

screenshotpy.jpg

screenshotpy.jpg (295.0 KiB)
Upvotes
21 0 0 1

thank you so much @jason.ramchandani01

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
21 0 0 1

below is an attached screenshot of the syntax used (the history.py) and the data output:



You can reach me between 11am and 1pm UTC at: +49 221 470 2406

When I use import random and random.shuffle(data_points), I get a different number of data points with each shuffle. My colleagues can reproduce this behavior, it seems like this should not happen.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi @irene.upo ,

The screenshot doesn't seem to be posted properly, could you please post it again for further investigation?

Hi @raksina.samasiri Thanks for the answer. I hope the screenshot is not readable. I have figured out the problem, but I do not have a solution yet. The problem is the datapoint "TR.IntegratedStrategyMD&A". The download stops when reaching this datapoint because of the "&", when removing the "&" character the download continues, but of course I do not get the data for this datapoint. Unfortunately, using "TR.IntegratedStrategyMDnA" (which I also found as the code for this datapoint) does not give me the data either. I'm looking forward to hearing from you, thanks in advance!screenshotpy.jpg

screenshotpy.jpg (295.0 KiB)
Upvotes
82.6k 279 53 77

@irene.upo @Prof. Dr. Dieter Hess

What tool are you using? The code works fine on Jupyter Notebook.

That tool may not be able to handle the column name that contains the "&" character.

You can try this code to change thtat column name.

data_points = [
    'TR.TRESGScore.Date',
    'TR.SustainabilityComm',
    'SetLabel(TR.IntegratedStrategyMD&A,MD_A)',
    'TR.GlobalCompact',
    'TR.StakeholderEngagement',
    'TR.CSRReporting',
    'TR.CSRReportingGRI',
    'TR.CSRReportingGlobalActivities',
    'TR.CSRReportingExternalAudit',
    'TR.CSRReportingExternalAuditName',
    'TR.CSRReportingScope',
    'TR.ESGPeriodLastUpdateDate',
    'TR.UNPRISignatory',
    'TR.SDG1NoPoverty',
    'TR.SDG2ZeroHunger',
    'TR.SDG3GoodHealthWellbeing',
    'TR.SDG4QualityEducation',
    'TR.SDG5GenderEquality',
    'TR.SDG6CleanWaterSanitation',
    'TR.SDG7AffordableCleanEnergy',
    'TR.SDG8DecentWorkEconomicGrowth',
    'TR.SDG9IndustryInnovationInfrastructure',
    'TR.SDG10ReducedInequality',
    'TR.SDG11SustainableCitiesCommunities',
    'TR.SDG12ResponsibleConsumptionProduction',
    'TR.SDG13ClimateAction',
    'TR.SDG14LifeBelowWater',
    'TR.SDG15LifeonLand',
    'TR.SDG16PeaceJusticeStrongInstitutions',
    'TR.SDG17PartnershipsAchieveGoal'
]


universe = ['AAPL.OQ','AMZN.OQ','MSFT.OQ','GOOGL.OQ','INTC.OQ','META.OQ','NFLX.OQ','NVDA.OQ','TSLA.OQ']


params = {'SDate': '0', 'EDate': '0', 'Period': 'FY0', 'Frq': 'FY'}


data = rd.get_data(universe, data_points, params)
data

The column name of that field will be changed to MD_A.

1721205238633.png



1721205238633.png (24.3 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.