Predicting the stock market is probably one of the hardest things to do in the financial world. There are so many factors that come into play when considering the rise and fall of positions, and many differing opinions on which of these factors matters the most, from technical indicators to balance sheets. It is hard to dispute, however, that one factor has gained heavy influence in the past few decades: Media. From television to the internet, the modern day media clearly has had a large impact on financial instruments and the economy in general. Taking this as inspiration, we decided to create an app that predicts future stock prices using sentiment analysis of relevant news articles.
What it does
Mula is an app that provides an intuitive interface for users to manage their stock portfolio and predict changes that traditional methods may not catch in time. It provides a list of stocks that the user currently owns and a platform for trading them, as well as banking to store cash. Upon clicking on a specific stock, Mula provides a more detailed view of the stock’s historical prices, along with predictions of stock price changes from our algorithm coinciding with emotionally charged news. It also serves to provide a comparison between our predictions and actual price changes. Users can also put stocks on a watchlist, where they can get immediate notifications when a financial news article with significant sentiment regarding specific companies is published, as well as a recommended course of action.
How we built it
The stack consists of a Flutter front end, which allows the app to be multi-platform, and a Python Flask backend connected to a variety of APIs. The Capital One Hackathon API, aka Nessie, is used to manage a bank account, which users of the app store their currently non-invested money. The IEX Cloud API is used to retrieve historical and current pricing data on all individual publicly traded stocks, as well as news articles written about those stocks. The Amazon Comprehend API uses machine learning to analyze those news articles and determine the emotional sentiment behind them, i.e. positive or negative. We then used a weighted mathematical model to combine that sentiment data with Growth, Integrated, and Financial Returns scores from the Goldman Sachs Marquee API to create a prediction score for how the price of an individual stock will move in the coming days.
To ensure the prediction is valid, we used the Marquee API and IEX Cloud API’s historical data and news to backtest this algorithm. We searched for news stories in the past with a significant measured sentiment, and computed a prediction of future price movement from that and the historical Growth, Integrated, and Financial Return scores. We can then look a few days ahead and see how effective this prediction was, and use that to adjust the weights of the prediction model.
Challenges we ran into
We initially wanted to build our app using React Native, however we ran into problems trying to set up the design language we wanted to work with. We decided to switch to Flutter, which none of us had worked with before. It took some time before we got the hang of it, but ultimately we saw it as the better choice as it gave less problems. We were also working with multiple APIs, and having them be compatible with each other in the backend proved to be quite a laborious process.
Accomplishments that we're proud of
We are very proud that we were able to successfully find a correlation between news sentiments and stock movements. This is a major finding and could set the foundation for a rise in novel trading algorithms. Additionally, we are happy that we were able to pick up Flutter relatively quickly. Now that we know how to set up apps with it, we may use it again in the future to do the same.
What we learned
This was our first time doing a financial project for a hackathon, so we learned a lot about bank account management, risk management, technical analysis and fundamental analysis. We also learned how to combine multiple APIs together in a cohesive, valuable way. Additionally, none of us had quite done front end tasks before, so we we’re glad that we were able to learn how to use Flutter.
What's next for Mula.
We hope to further improve on our prediction modeling algorithms and sentiment analysis with more complex neural networks/deep learning. We would also like to further iterate on the UI/UX of the app to further streamline the stock analysis and prediction process.