With the recent rally in many financial instruments, many youths are not sure how to get started with investing. This led our team to try and create tools that can help inform the user, which in turn will provide them with simple-to-understand information so they are able to make a more informed decision!
What it does
We created a Telegram Chatbot that will take in stock tickers from users. It will then scrape the news or article headlines from financial websites and perform a sentiment analysis on it. It will then return the sentiment score to the user as well as the sentiment of the selected stock.
How I built it
I used the PyTelegramBotAPI package to connect and control my chatbot on Telegram. To webscrape and check the validity of a stock ticker, I used requests. Once the stock ticker is validated, I will use beautifulsoup to parse the HTML page and extract out the news and article headlines. I then used the NLTK package using vader lexicon to do a polarity score on the headline.
Challenges I ran into
During the start of this hackathon, my team and I decided to try incorporating Natural Language Processing into our project as we have never tried it before! So picking up and understanding how Natural Language Processing works was a challenge and did take up a large amount of our time.
Another challenge that we ran into while developing was that some websites would block bots from accessing the websites, but a workaround we managed to figure out was to add a header to request for a browser page. That way, the website will no longer block the bot from having access to the page.
Finally, due to learning a new technology and the time constraint, we were not able to fully develop the bot into what we envisioned at the start of the hackathon. So we reverted to the older version with less capabilities but a stable build. We still intend to continue working on this bot once the hackathon is over!
Accomplishments that I'm proud of
Using sentiment analysis! It is the first time my team and I have dabbled into this technology and being able to see the score and result is really something we are proud of!
What I learned
I really appreciate joining Hack and Roll because of how chill it is and how it really encourages us as hackers to step out of our comfort zone and learn new things for cool and fun projects! We actually learned how Natural Language Processing works under the hood, albeit not professionals, but it was interesting and I think we are able to hold a conversation on this topic now!
I also learned more about webscrapping and how websites prevent bots from scraping their websites, and how headers can also be used to manipulate the request sent to the server!
What's next for Sentiment Analysis Stock Bot
We want to add the following capabilities to the bot post-hackathon:
- Watchlist for each user
- Historical sentiment scores (storing and collecting data each day)
- Expand to other websites to scrape investor and analyst sentiment