Inspiration

Over the last 10 days, all you here in the news is the havoc that tariffs are causing on the U.S. and global stock markets. With the havoc, the question is where are there opportunities? My guess is, part of identifying the opportunities is determining when investors are becoming more positive on individual stocks. Therefore, I thought if there was a way to track headlines to look at changes in sentiment, that could be a good indicator.

What it does

This Python program creates a web application which leverages multiple APIs to analyzes the sentiment of recent news headlines for a given stock ticker. It uses a predefined list of positive and negative keywords to score the sentiment of news titles fetched from Google Custom Search, displaying a sentiment summary and individual headlines with their sentiment. The application also utilizes the yfinance library to show a 30-day stock price chart and basic company information for the entered ticker, providing a combined view of news sentiment and stock performance.

How I built it

The application was built in python leveraging a series of publicly available APIs and my personal knowledge of investment sentiment keywords. I utilized Streamlit to host my app and Google Colab as my code editor.

Challenges Ig ran into

There were many challenges I ran into. The first of which, was trying to find out how to pull news articles from the web. I moved through multiple APIs and eventually settled on Google Programmable Search Engine to filter the web results to be only news articles related to the specific ticker. This led to other issues with the free version of this only allowing 100 requests per day through the API key. Once I got all of this working, I ran into another issue with the scaling. As I allowed the program to search through more news articles, my methods of weighting the final overall sentiment were off resulting in me having to change the scaling levels. To do this, I went through a series of test searches to adjust the final parameters.

Accomplishments that we're proud of

Despite only having 1-2 days to work, I am proud of how functional and easy to use the application is, as well as the graphical output.

What I learned

I've gained a much deeper knowledge into how varying stock market sentiment can be on an individual stock and that the collective perspective is what really matters. I have also enhanced my skill using finance APIs and Python. In particular, taking a python program and turning it into an application with a user friendly and functional output.

What's next for Stock Sentiment Analysis App

The next steps for this application include integrating and testing my tool against stock market performance, as well as enhancing its capabilities.

Built With

Share this project:

Updates