Inspiration

We have always had an interest in data analytics, especially in the realm of quantitative finance. Observing the effects of the COVID-19 pandemic on market volatility had us both thinking what trading signals could be developed to see through the chaos. During this hackathon, we arrived at lay sentiment as an interesting avenue to explore, so we decided to see what results we could obtain.

What it does

This program compares the performance of our sentiment-driven stock trading algorithm, SentimentStrategy, against the performance of an extremely common stock trading signal, the simple moving average (SMA), across 20 different companies within the S&P500 stock index from 1/1/2020 to the current date.

How I built it

We used python in conjunction with pushshift.io, firebase, vaderSentiment, and backtrader to perform our research. Pushshift was used to get comment data from Reddit. We used vaderSentiment to examine the positivity or negativity of each Reddit comment. Firebase stored our averaged sentiment scores for use with backtrader. Backtrader hosted our strategies and allowed us to compare their performance using real world price data.

Challenges I ran into

We had a lot of trouble collecting data in the beginning. Collecting large swathes of data using APIs can be challenging. Ready access to large databases or forum information could have made our data collection process much faster and freed up time for more in depth quantitative analysis.

Accomplishments that I'm proud of

Our sentiment strategy was able to outperform the common SMA crossover strategy. This proves that our research has real application in the world of quantitative finance and merits deeper investigation.

What I learned

We learned a lot about the modelling that goes into sentiment analysis, as well as what is required to create a trading strategy. Hopefully we can take this information further in expanding this research or into other hackathons down the road.

What's next for Sentiment Trader

We would like to expand our strategy to include more statistical measurements. We are presently limited to moving average measurements, but including exponential measurements or other more complex measurements could help us to refine our trading calls. We would also like to expand our data collection beyond just Reddit. Large amounts of stock sentiment data is created on platforms like Twitter and Facebook. Access to those datasets could allow us to generate more accurate sentiment measures for each stock. We would also like to perform back testing over longer periods of time. Right now, our back testing range is limited by our data collection scope. Improved data collection and larger stores of data could help us to generate longer term back tests that we could use to refine our strategy.

Built With

Share this project:

Updates