(MSCI) ESG Rating Scraper - Example Inside Using Fund and ISIN by Selenium and The API
What is ESG
ESG stands for environmental, social and governance. These are non-financial factors investors use to measure an investment or company’s sustainability. Environmental factors look at the conservation of the natural world, social factors examine how a company treats people both inside and outside the company and governance factors consider how a company is run.
ESG Investing
ESG investing is a form of sustainable investing that considers environmental, social and governance factors to judge an investment’s financial returns and its overall impact. An investment’s ESG score measures the sustainability of an investment in those specific categories.
Read more: Environmental, Social and Governance (ESG) Investing and How to Get Started - NerdWallet
ESG Fund Ratings and Climate Search Tool
In this article, we leverage on ESG Fund Ratings - MSCI.
Explore the Implied Temperature Rise and MSCI ESG Fund Ratings of more than 56,000 equity and fixed income funds.
How does MSCI ESG Fund Ratings work
MSCI ESG Fund Ratings are designed to provide greater transparency and understanding of ESG characteristics of fund and ETF components in investor portfolios. As the number of ESG funds proliferate, and ESG-oriented investment options and strategies are being adopted by wealth and fund managers, we strive to provide the tools and solutions to help investors better understand ESG risks.
How to Scrape
Modules
First we import
the needed modules
.
|
|
Search Funds
We use driver = webdriver.Edge(service=Service(EdgeChromiumDriverManager().install()))
here to deal with DeprecationWarning: executable_path has been deprecated selenium python
1.
Then do iteration on whatever the ISIN list you provide and requests.get()
the html
using this secrete API.
https://www.msci.com/our-solutions/esg-investing/esg-fund-ratings?p_p_id=esg_fund_ratings_profile&p_p_lifecycle=2&p_p_state=normal&p_p_mode=view&p_p_resource_id=searchFundRatingsProfiles&p_p_cacheability=cacheLevelPage&_esg_fund_ratings_profile_keywords={ISIN}
Most important part comes with using this API to search the Fund by ISIN.
|
|
I use params == '[]'
to handle empty response.2 3 4
You might be thinking, why we need the selenium
at the first place right? Here it comes, since the website has made it not easy to scrape with js
, we need a driver
to interact with the site to trigger the js
and get the right Fund’s path
from the params
(requests.get().text
) we got above by another API.
https://www.msci.com/our-solutions/esg-investing/esg-fund-ratings/funds/{params['encodedTitle']}/{params['url']}
Scraping
But, how do we actually interact with the Site? How to locate and insert a value (input text) in a text box to be exact?5 6
We use the above method instead of click()
element method7 in Selenium.
|
|
Then write it back to your list
. Esay, isn’t it?
DeprecationWarning: executable_path has been deprecated selenium python - Stack Overflow ↩︎
python - POST requests gives me an empty result - Stack Overflow ↩︎
Requests Python module in QGIS return nontype or empty CSV - Geographic Information Systems Stack Exchange ↩︎
How to locate and insert a value in a text box (input) using Python Selenium? - Stack Overflow ↩︎
Getting Started — Selenium Python Bindings 2 documentation (selenium-python.readthedocs.io) ↩︎