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
Accepted
21 0 0 2

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
Accepted
10.8k 21 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 2

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
21 0 0 2

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 2

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
84.6k 287 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.

@Jirapongse Hi and thanks for the answer! I used to use Spyder through Anaconda, now I tried to use Jupyter Notebook through Conda. However, the get_data still stops when iterating through the list of data points as soon as the "TR.IntegratedStrategyMD&A" appears. Unfortunately, the "SetLabel" only resulted in an error when retrying the data. Here is the code and the output:

lseg-1.png

lseg-1.png (158.7 KiB)
Upvotes
84.6k 287 53 77

@Prof. Dr. Dieter Hess

You may check the version of RD library used by the application. The latest version is refinitiv-data 1.6.1.

You can also enable the debug log in the RD library by using the following configurations.

{ 
  "logs": {
    "level": "debug",
    "transports": {
      "console": {
        "enabled": false
      },
      "file": {
        "enabled": true,
        "name": "refinitiv-data-lib.log"
      }
    }
  }, 
...

Or, use the following code.

config = rd.get_config()
config.set_param("logs.transports.file.enabled", True)
config.set_param("logs.transports.file.name", "refinitiv-data-lib.log")
config.set_param("logs.level", "debug")
rd.open_session()
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.

@Jirapongse

Hi, thanks for the additional info. I have already used the debug log in the RD config. Is there any log I can provide for further assistance? My RD is up to date and we still cannot get the data point (the request stops when the "&" is used, the problem remains).

Also, could you let us know what environment you are using and what versions of Jupiter you are using? Thanks in advance!


Upvotes
84.6k 287 53 77

@Prof. Dr. Dieter Hess

I assume that you are using the platform.rdp session.

Please try the following code.

data_points = [
    'TR.TRESGScore.Date',
    'TR.SustainabilityComm',
    'TR.IntegratedStrategyMD%26A',
    '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
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.

@Jirapongse Hi, thanks for the quick reply. Your fix finally worked and we are able to retrieve the data. Can you shed some light on the solution you provided, how and why this worked with the platform.rdp and what platform you've used to retrieve the data without the fix you provided? Thanks again for your help and the solution!

Upvotes
84.6k 287 53 77

@Prof. Dr. Dieter Hess

The RD library can retrive data through the desktop application (Eikon or Workspace) but the desktop application must be running concurrently on the same machine. We call this the desktop session. It requires only the application key to connect to the desktop session. At first, I tested the request with the desktop session.

The RD library can also retrieve data directly from the platform session which is available on Refinitiv Data Platform (RDP). With the platform session, the desktop application isn't required to run on the same machine. It requries the username, password, and application key to connect to the platform session.

For this question, the TR.IntegratedStrategyMD&A field works with the desktop session, but it doesn't work with the platform session. According to your finding, it could relate to the & character. Therefore, I try to change the & character to another format by using the HTML encoding (%26). Then, it works.




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.

@Jirapongse Thank you very much for the explanation and once again, thank you for your continued support! Have a nice day!

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.