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)
But client requests to automate this on Python environment using the attached CUSIP.
Best Answer
-
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.
0
Answers
-
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.
0 -
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.
0 -
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.
0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛