Inspiration

Every investor faces the challenge of knowing what stocks to invest in. A common tool that many use to do research is social media, so we decided to create a tool that essential automates this task for Twitter.

What it does

Though there is already websites out there that track the real-life stock prices, not much delve into incorporating the opinions of stock buyers into the consideration for oneself to decide whether to buy or not. As such, we focus on bridging the gap between the two aspects of quantitative and qualitative feedback for stocks. Specifically, we go through twitter tweets that focuses on the discussion of stocks, and, through a pre-trained AI, get the connotation of that tweet (whether it is positive towards that stock(s) or not)

Initially, we had one person work on the website (front-end), one person working to get the twitter (tweepy) api working to get tweets on stock tickers, one person working to get the hugging face machine learning model to work, and one person creating the module to integrate MongoDB and possibly Twilio (which we unfortunately ended up not having enough time for). After we got the basic functionalities to work, we collaborated to integrate our code with one another and continued to fix bugs with each others help.

How we built it

The web app essentially queries twitter (with the tweepy api) for a stick ticker, we then take these tweets, clean up the text, and pass it to a machine learning model to determine the connotation (whether it is positive or negative) and gave every ticker a score. Negative scores under -0.1 are discouraged stocks while positive scores over 0.1 are recommended (which we found are rare). Anything in between is a neutral stock. Users on the web app can search for stock tickers (if they don't know any or want a reminder) and can then add them to the list of stocks that have scores or update an already existing one.

Challenges we ran into

We ran into many challenges. Many of us did not have concrete knowledge of python, javascript, html & css, and more coming into this. As we worked on it, we learned and helped each other. There were many bugs that we had to fix, including but not limited to: Adding concurrency, getting css to properly render with the html, working with tweets that had emojis or non-english text, certificate errors with the pymongo client (mongodb), converting python scripts to python classes, and many more.

Accomplishments that we're proud of

We got the basic functionality working. At the end of the day, we were able to translate almost all of our initial thoughts and ideas into the web app and had an extremely fun time doing so. We were able to optimize our code at one point (by adding concurrency) to be 3x faster than it initially was. We're also proud of integrating all of our work together to work (to the best of our ability) as seem-less as we could. We're also proud of the css animations that we were able to add to our site to make it look that much better. While it is no where close the end, we are so proud of ourselves because it was our first time doing something like this.

What we learned

That building a fully functional application that has both a well-defined structural back-end and an attractive-looking front-end from scratch is really challenging. If it were not for the jokes and laughters that occurred at intervals throughout the hackathon, building this app would be an even more challenging task

Firstly, we learned that people stray towards mostly post negative things about stocks (seemingly because of losses) and less about the positives. Other than that, we learned so many new technologies. None of us came into this being experts by any means. Every one of us learned at least 3 technologies with this project. Many of us learned the essence of web-apps, with there being a front-end and a back-end. With this project, we learned to create a back-end api with Flask and integrate it with a front end made with HTML5, CSS3 and Javascript.

What's next for Twitter Stock Suggester

Currently, the program supports multiple inputs to run the algorithm on. However, the front-end aspect hasn't cover multiply input forms yet, so this could be a first step taken to improve Twitter Stock. We also want to add functionality to avoid bot accounts as much as positive. Sometimes, they upload tweets stating the statistical decrease or increase of stocks, which in term result in their respective connotations from the machine learning model we used. We want to possibly isolate actual user inputs as much as possible. We also want to improve on our algorithm that calculates the scores for the tweets. We use a pretty simple equation and would like to make it more accurate. One thing we wanted to do but could not get to was user sign up. The plan was for users to sign up with their phone numbers, to create customized lists of stock tickers, and receive SMS updates (from the Twilio API) on whether a stock ticker was doing good. We also wanted to add functionality to repeat the checks on the stocks on a certain interval.

Share this project:

Updates