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

Automate 8 digit CUSIP to pull Scope 1 and 2 emissions

portfolio_holdings CUSIP.pdf Attached are the portfolio holdings I have retrieved from the 13F holdings from Refinitiv. The column name "CUSIP" provides the company 8-digit CUSIP. My next step is to obtain the Scope 1 and Scope 2 emissions from each company listed here. This is only a small part of my dataset; therefore, I wish to automate this to ensure efficiency through a Python environment.

Created below on CODEBK

import refinitiv.data as rd

rd.open_session()

df = rd.get_data(

universe = [

'594918104','02079K305','037833100'

],

fields = [

'TR.RIC',

'TR.CO2DirectScope1',

'TR.CO2IndirectScope2'

]

)


display(df)

2024-03-21-02-14-25-toasts.png
But client requests to automate this on Python environment using the attached CUSIP.

pythonworkspace#technologyesgrefinitiv-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.

Upvotes
Accepted
17.8k 82 39 63

Hi @MarkJoseph.Canada

I can see you have the general approach to retrieve the emissions data. You'll just need to figure out how to programmatically retrieve the holdings data. I have no idea where this data is coming from and whether the is an API to retrieve it. Might be helpful if you provide some context of the source of data and which service is providing it and whether an API exists.

Assuming an API exists, hopefully the service does provide the ability to capture the list of CUSIPs within a text file or JSON collection to be processed. From there, it's a matter of processing the collection and submitting the request.

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

Hi team

I have extracted the data from Thomson Reuters Institutional (13f) Holdings - s34 Master File from Wharton Database API. Here is my query to extract Wharton data from python environment:
query = """

SELECT *

FROM tfn.s34

WHERE fdate >= '2008-01-01'

AND fdate <= '2022-12-31'

"""

inst_hold = conn.raw_sql(query)

I have only the possibility to get 8-digit CUSIP from the holdings. Now I want scope 1 and scope 2 of each of the companies each year based on their 8-digit CUSIP from DataStream.



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

Hi team,

I have extracted the data from Thomson Reuters Institutional (13f) Holdings - s34 Master File from Wharton Database API. Here is my query to extract Wharton data from python environment:
query = """

SELECT *

FROM tfn.s34

WHERE fdate >= '2008-01-01'

AND fdate <= '2022-12-31'

"""

inst_hold = conn.raw_sql(query)

I have only the possibility to get 8-digit CUSIP from the holdings. Now I want scope 1 and scope 2 of each of the companies each year based on their 8-digit CUSIP from DataStream.

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
17.8k 82 39 63

Hi @TatiannahMarie.Hidalgo

The above code provided by @MarkJoseph.Canada, will give you the Scope 1 and Scope 2 of each company. You provided an SQL query but the above you provided is not Python code. We can only provide guidance and examples in this forum for users to use within their own application workflows - we don't create full solutions when we don't have access to your workflows and data environments nor your permissions.

It's unclear what you need. If you are looking how to programmatically execute SQL from Python and process the results to pull out the CUSIP values from the results, I would suggest using ChatGPT or CoPilot as they can provide some great examples for you to use.


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.