Inspiration

Investing for a profit isn’t enough. With the irreversible effects of climate change around the corner, investors have become more climate conscious. And as society has become more socially conscious - more investors have begun to hold companies accountable for socially impactful action. Investors have increasingly begun to not only search for profit in the securities they hold but commitment to a brighter tomorrow.

What it does

Our program takes user input - how much users want their investments to be shaped by the ESG index - and creates a viable portfolio based on that weight.

How we built it

For the back end: We used a web scraper to collect ESG indexes and ESG components of different stocks to create a “card” of all these values. We parsed through a CSV file (sourced from NASDAQ) which contains all the tickers listed on the NASDAQ. Then for each ticker, we applied an exponential regression using lmfit to historical data from yfinance and from that calculated a key performance indicator (KPI). We then took the ESG index and components and KPI and used a weight based on user input to generate a viable portfolio. For the front end: We built a static website which primarily uses html files to display pages and a javascript file to get user input for the ESG weight. Most of the html files are formatted with the same css with the exception of the profile page which uses slightly different formatting.

Challenges we ran into

While calculating the exponential regression, we initially attempted to use scipy’s optimize and curve_fit methods. This solution wasn’t ideal, it produced warnings and accuracy was a concern. Switching to lmfit proved to be a satisfactory solution - no warning and good accuracy. Another challenge we encountered was the time it took to make web requests. While determining the 5th letter identifier, which was essential to web scraping for the ESG indexes, we needed to make many requests which greatly increased runtime. A challenge we encountered while building the website was integrating our python files.

Accomplishments that we're proud of

We’re proud of the lin_reg_ticker() method in assess_value.py that can find accurate exponential regressions with historical stock data. We’re proud of our progress in learning how to webscrape. We’re proud of how our website aesthetically looks.

What we learned

We’ve gained insight on how to use the python libraries request, lmfit, scipy, optimize, csv, yfinance, matplotlib, pickle, and bs4. We’ve grasped web scraping and determining ideal regressions to use. We’ve learnt how to calculate a key performance index. We’ve learnt how to integrate python into a website.

What's next for Capital for Good: EthInvest

We’d like to build on our ethical component by doing more web scraping to more personally tailor the portfolios. We’d like to apply machine learning to our analysis of securities to create a more accurate KPI. We’d like to add more functionality to our website. https://github.com/BenAltermatt/EthicalInvesting

Share this project:

Updates