1. Background and Introduction

Stocktwits is a social media platform designed specifically for people interested and involved with trading, and investing. Discussions on the platform include almost all asset classes, even though publicly traded assets from certain countries and categories are not on the platform (for example, crypto currencies only got added in 2022). This has likely to do with the fact there is not much demand for having discussions around them. The website has about 6 million registered users, although the number of daily active users is much lower, about 1 million (Tan, 2021). These users have the right to post their thoughts about companies, crypto currencies, and other asset classes like commodities whereby they are only allowed to express themselves with a limited number of characters on their post. Stocktwits is therefore quite similar to Twitter, but with a more niche topic space and user group. Additionally, the instruments featured on Stocktwits are all labeled using a cashtag ($), again similar to Twitter, and when tweeting, putting a $ in front of a specific symbol, like for example $AAPL, means that the tweet is going to be visible on the thread pertaining to $AAPL stock, which is the stock symbol for Apple. Other people are not going to be able to see the tweet unless they are that user’s follower or follow $AAPL on Stocktwits. Furthermore, specific to this platform, users can tag their post as bullish, bearish, or leave it without a tag, which makes it easier for other people to discern from their post whether they think the stock is going to go up (bullish) or down (bearish) or whether they are ambiguous (no tag).

Due to the large number of users and the data they generate by writing posts on the platform even within the time frame of a single day, Stocktwits can be seen as a goldmine of valuable information that can potentially be used to make certain inferences about the assets listed on there. Recent studies have shown that sentiment analysis of Stocktwits tweets can be a good predictor of asset prices in the future as well as other important financial information such as the volatility of the price of an instrument and the trading volume (essentially, how many contracts, ownership certificates, or other financial instruments were traded) of stocks, currencies, commodities, and other instruments on a certain day (Batra & Daudpota, 2018). However, no study up till now has specifically focused on searching for these relationships for the timeframe between the end of 2019, when the SARS-CoV-2 virus was first detected, and now, November 2022, when we are still feeling the ramifications of the COVID pandemic.

In my report, I will thus be focusing on the timeframe from 2019-11-19 to 2022-11-19 to determine how data from Stocktwits on any particular day can help us predict certain paramaters connected to stock performance on the next day. Similarly to other such studies, I will narrow down my focus on some of the biggest and most talked about stocks on Stocktwits and disregard other asset classes and even smaller stocks. The stock I chose for my analysis are the following:

- AAPL or Apple
- XOM or Exxon Mobil
- NVDA or Nvdia
- AMD or Advanced Micro Devices (AMD)
- META or Meta (formely known as Facebook)
- MSFT or Microsoft
- BABA or Alibaba
- AMZN or Amazon
- DIS or Disney
- NFLX or Netflix
- GOOG or Alphabet (formely known as Google)

The main reason only large stocks were selected for the analysis is because smaller stocks often have substantially lower daily message volumes (number of tweets per day), which would make any inferences from such data far less convincing and reliable. Additionally, the people who post on most of the small cap stock threads are usually the same people (a few persons make up for the majority of tweets for the stock), and the stocks are often subject to more volatility and days when there is no serious trading or messaging volume, which would make my model quite unstable. Because of that I have decided to only choose big stocks, that are talked about a lot during a given trading day, and where individual (retail) investors are not likely to have a large impact on the share price; that is because of higher volume and market capitalization (market values) of these stocks - one person selling all of their shares is likely not going to cause a big enough supply surplus of shares to depress the price by a lot, while in stocks with smaller market capitalization and daily trading volume this is much more likely.

2. Hypotheses

In this paper we are going to test 4 hypotheses. All of them have to do with the impact of a certain variable from Stocktwits on a particular day, like for example the number of tweets, on some variable related to the stock on the next day, like for example volatility or the stock price.
H1: The number of tweets for a specific stock on a particular day is positively correlated with the volatility of that stock compared to the broader market (S&P 500 or SPY) on the next trading day
H2: The number of tweets for a specific stock on a particular day is negatively correlated with the number of bearish posts (bearish ratio is higher) on the next trading day
H3: The number of tweets for a specific stock on a particular day is negatively correlated with the returns (change in price of the stock) on the next trading day
H4: The number of bearish tweets (higher bearish ratio) on a particular day for a particular stock is negatively correlated with the returns of the stock on the next trading day
H5: The number of bearish tweets (higher bearish ratio) on a particular day for a particular stock is positively correlated with the volatility of the stock compared to the SPY on the next trading day
H6: The volume of a stock on a particular day is not correlated to the returns of the stock on the next trading day
H7: The volume of a stock on a particular day is positively correlated with the volatility of the stock compared to SPY on the next trading day

3. Data and Methodology

3.1 Web scraping and early preprocessing

To obtain meaningful data from Stocktwits for any sort of analysis, I first decided to web scrape the platform pertaining to threads related to my 11 selected stocks. The main reason I decided to carry this out was the unavailability of similar datasets online. When webscraping a particular stock thread, I extracted the following information:

* date when the tweet was made
* body of the tweet
* username of the poster
* whether the poster included a bullish or a bearish tag
* amount of likes and replies a post received

After obtaining all tweets for my particular stocks from 2019-19-11 to 2022-19-11, I grouped them together by date. By doing this I reduced each dataset from a few hundred thousand rows, each corresponding to one tweet, to 758 rows with each one corresponding to one trading day - weekends were excluded as the stock market is closed during the weekend. In this process, I created another variable which states the number of tweets made on a specific date. Additionally, I created another variable called bearish_ratio which is yielded by dividing the number of bearish tags per day with the number of bullish tags per day.

\(bearish\_ratio = \frac{number\_of\_bearish\_tags}{number\_of\_bullish\_tags}\)

The possible values of bearish_ratio range from 0, indicating a completely bullish day, to potentially infinity in case there are no bullish posts and only bearish posts (or only neutral posts) on a given day, which is highly unlikely and not present in any of my datasets.

Afterwards, I also web scraped the information about individual stock performance from Yahoo Finance pertaining to the stock I just web scraped coupled with the same information for the S&P 500 index or SPY (index of 500 largest publicly listed companies in the United States). The reason I also included the SPY data is because it is seen in the financial community as a benchmark index that measures the performance of the broader US stock market. This status is exemplified by its impact on the financial jargon as when someone says that a certain strategy or fund is outperforming the market or a certain stock more volatile than the market, the word market refers to SPY. The data from Yahoo Finance about each individual stock and SPY I web scraped contained the following:

* opening price of the stock
* closing price of the stock
* lowest price of the stock on the day
* highest price of the stock on the day
* volume of the stock on a given day (here I normalized the values because some stocks have much higher volumes than others which could potentially distort regression and visual output)

After obtaining these two datasets, I merged them to create a full dataset. A more detailed step by step way of how I obtained it can be found in this Google Colab file.

This dataset was then ready for further processing such as calculating the daily volatility and returns of a stock compared to the day before.

3.2 Returns

Return on investment is a measure that tells you by what percentage the value of an instrument (in our case a stock) changed over a period of time. The general formula for computing returns for an investment is:

\(return_ = \frac{value_{now} - value_{before}}{value_{before}}*100\)

For example if one buys a stock (or some other instrument) at 100 $ and then one month later the stock is worth 120 $, then we are speaking of a 20 % return since if one chooses to sell the stock (or any other instrument) he/she would have made 20 $ or 20 % extra of the amount they had invested. For the purpose of my paper, I will only be considering daily returns, or by what percentage did the price of a stock change compared to the previous day.

3.3 Daily volatility of the stock

One of the most important financial measures for any financial institution and also most individual investors is the volatility of their financial instruments and ultimately their portfolio. It can be thought of as a measure of how spread out the returns are over a given timeframe. For example, a stock that does not increase or decrease much in its price over a given day will have a low volatility compared to a stock that experiences large price swings. The reason this measure is so important is because it tells investors with diverse risk appetites whether an investment suits their investment style or not. An investor, with a low appetite for large price swings and therefore risk will thus choose to invest in a stock with lower volatility, while an investor that can handle more instability may be more inclined to invest in stocks with higher volatility (Hayes, 2022). Because I am analyzing data from a relatively short time horizon I will only be considering and calculating each stock’s daily volatility, and thus neglecting longer timespan volatility measures. Interestingly, it is quite hard to accurately asses the stock’s daily volatility and because of that many methods have been proposed, with each making a slight improvement over the previous one. The one I will be using in this paper is known as the Yang-Zhang Volatility Estimator and is believed to be the best estimator of daily volatility today as it is 14 times as historical (close-to-close) volatility, which is the highest among all estimators (Yang & Zhang, 2000).

3.4 Processed data

After adding both returns and daily volatility to my dataset, I had enough variables to start making relationships between the datasets. But before doing that I also added another variable which measures the stock’s volatility compared to the broader market. I did this because an increase in volatility of the stock may not come as a result of some internal processes within a firm such as earnings, but may be caused by some external, more global, factor(s) such as the COVID pandemic for example, which made global financial markets unstable and increased the volatility of all asset classes. To get a measure of how volatile a stock is compared to the broader market I also added another variable that is the quotient of a stock’s daily volatility and the SPY’s daily volatility.

\(ratio = \frac{volatility_{stock}}{volatility_{SPY}}\)

Lastly, I also deleted the outliers, marked as red dots on the boxplots below, from my dataset because leaving them in my analysis would yield faulty regression results as it would underestimate or overestimate the relationship between my explanatory and outcome variables.


After doing these final additions, my dataset got its final shape visible below.

4. Discussion

To test my hypotheses using the data from my dataset, I first decided to check whether the relationships I hypothesized about in the beginning actually make sense and exist in some way. I tested them by making some simple plots and fitting a best fit line to my data show to show the direction of the relationship.


As can be seen, the number of tweets on a particular day has a very slight positive relationship with the returns of the stock on the next day. We can even say there is no relationship because the best fit line is very flat. Therefore, the number of tweets on a particular day has no predictive power for the returns of the stock on the next day. Furthermore, there is a positive relationship between the number of tweets on a particular day and the volatility of the stock compared to the S&P 500 on the next day. This means that if the number of tweets on any given day is higher than average, we can expect very large price swings on the next day, which are going to be higher than those of the broader market (other large stocks included in the S&P 500). Lastly, there is a positive relationship between the number of tweets on a particular day and the bearish ratio of the stock on the next day (number of bearish tweets). This means that if there is a greater number of tweets on a particular day for a particular stock then tweets on the next day are going to include a higher number of bearish posts compared to bullish posts, i.e, people are going to be more negative about the stock. This observation makes sense because most of the tweets in my dataset come from a time period in which we experienced the COVID pandemic, lockdowns, and many other disasters. This means there was a lot of turmoil in the markets at that time and asset prices of most instruments (including stocks) tended to go down because of inhibited economic activity.

As seen from the first plot, there is no relationship between between the trading volume of the stock on a particular day and the returns of the stock on the next day. Trading volume therefore has no predictive value for the stock price on the next day. Interestingly, there is, however, a negative relationship between the trading volume of the stock on a particular day and the volatility of the stock on the next day. This means that higher volume days are most likely going to be followed by a day that exhibits a lower level of volatility compared to the broader market than that day.


The most interesting explanatory variable seems to be the Bearish ratio. From the first plot we can discern that there is a negative relationship between the Bearish ratio of the stock on a particular day and the returns of the stock on the next day. This means that the a higher bearish ratio of a stock on a given day on average leads to negative returns (decrease of the stock price) of a stock on the next day. Secondly, there is a negative relationship between the Bearish ratio on a given day and the volatility of the stock compared to the broader market on the next day. This means that a higher number of bearish tweets compared to bullish tweets on a given day leads to lower volatility of the stock compared to the broader market on the next day.
However, if we do the same relationship test between the bearish ratio on a particular day and the daily volatility of the stock on the next day (see the graph below), we see that there is a relatively strong positive relationship between the two variables. This suggests to us that a strong bearish sentiment is on average followed by an increase in volatility on the next day. However, the daily volatility on the next day is going to be lower than the volatility of the broader market. This means that more than the usual bearish days came about as a reaction of events related to the broader market as opposed to events within a company. Interestingly, this is again in line with what we would expect as we are dealing with a dataset that is set in a rather negative time for the markets and the economy and thus it is understandable that macro events played a more important role in determining key stock parameters than the companies, and thus stocks, themselves (the extrinsic factors trumped the intrinsic factors).


However, we cannot state that these naive relationships actually represent the real state of affairs and that they are indeed meaningful just based on these graphical representations. To determine whether these relationships really hold and are statistically significant, we need to run a linear regression that encompasses as many other relevant variables as possible in order to not underestimate or overestimate a certain linear relationship. For this purpose, I created 3 linear models with one having returns on the next day, the second one volatility compared to the broader market on the next day, and the third one the bearish ratio as their outcome variable (see the appendix for regression tables).
Based on the estimate values obtained from the more sophisticated linear regression models, we get a clearer picture about the significance and directions of the relationships we looked at and analyzed before. The results are the following:
1. There is no statistically significant relationship between the number of tweets for a specific stock on a particular day and the volatility of that stock compared to the broader market (S&P 500 or SPY) on the next trading day
2. There is a highly statistically significant positive relationship between the number of tweets for a specific stock on a particular day and the number of bearish posts (bearish ratio is higher) on the next trading day
3. There is a highly statistically significant positive relationship between the number of tweets for a specific stock on a particular day and the returns (price of the stock) on the next trading day
4. There is a highly statistically significant negative relationship between the number of bearish tweets (bearish ratio) on a particular day for a particular stock and the returns of the stock on the next trading day
5. There is a relatively high statistically significant negative relationship between the number of bearish tweets (bearish ratio) on a particular day for a particular stock and the volatility of the stock compared to the SPY on the next trading day
6. There is a relatively high statistically significant negative relationship between the volume of a stock on a particular day and the returns of the stock on the next trading day
7. There is a relatively high statistically significant negative relationship between the volume of a stock on a particular day and the volatility of the stock compared to SPY on the next trading day

Interestingly enough, these 7 points show the same correlations as the plots above but they also include the significance of the relationship. Therefore, naive relationship plots were not a bad estimate of the actual relationships.

5. Conclusions

This analysis gives an important insight on how reactions from the public in the form of tweets on the social media platform Stocktwits related to some stock can help us predict certain outcomes related to that stock’s performance like its share price and volatility on the next trading day. Furthermore, it allows us to reach certain conclusions about the particular relationships we hypothesized about at the beginning.
I can thus reject the first hypothesis, which claims that there is a positive correlation between the number of tweets for a stock on a given day and the stock’s volatility on the next day compared to SPY as our model shows that there is no statistically significant relationship between these two variables.
I can also reject the hypothesis that the number of tweets for a specific stock on a given day is negatively correlated with the bearish ratio of the stock on the next day. That is because the relationship appears to be actually positive.
Thirdly, I can reject the hypothesis that the number of tweets for a specific stock on a particular day is going to be negatively correlated with the returns of the stock on the next day. That is because the correlation is actually positive.
Fourthly, I can fail to reject the hypothesis that a higher bearish ratio on a particular day for a particular stock is negatively correlated with the returns of the stock on the next trading day.
Fifthly, I can reject the hypothesis that a higher bearish ratio for a stock on a particular day is positively correlated with the the volatility of the stock compared to the broader market. That is because the correlation is actually negative. However, I would fail to reject the hypothesis just by looking at daily volatility, as its relationship with the bearish ratio is positive and statistically significant. The reason that the aforementioned relationship is negative is thus most likely because days with really high bearish ratios mainly came about as a result of negative global market trends, such as COVID lockdowns, and thus the volatility compared to the broader market appears lower even though the daily volatility of the stock actually increased.
Sixthly, I can reject the hypothesis that there is no relationship between the volume of the stock on a particular day and and the returns of the stock on the next trading day. That is because there is in fact a string negative relationship between these two variables.
Lastly, I can reject the hypothesis that there is a positive correlation between the volume of a particular stock on a particular day and the volatility of that stock compared to SPY (broader market) on the next day. Again, that is because the relationship goes in the opposite direction, as it is in fact negative.

5.1 Limitations and Potential Improvements of the research

Most tweets in the dataset I obtained come from the period of the COVID pandemic and its aftermath which quite possibly makes the results from my analysis a bit extraordinary as the tweets that allowed for this analysis to be made come from an extraordinary time. Therefore, a possible improvement could be extending the web scraping of particular stock threads and thus my dataset to capture a longer time frame. My analysis would thus be more relevant to normal market conditions than abnormal market conditions. Additionally, most stocks in my dataset were stocks of technology companies, which also makes my dataset a bit biased as I am for the most part only representing one sector (besides one oil company) in my analysis. So, a potential improvement would be including stocks from more industries in the web scraping and analysis process to get a more complete picture of how tweets from Stocktwits predict certain stock parameters more generally, and not just for tech stocks. If possible, it would also be quite interesting to extend this analysis to stocks of companies with smaller market capitalizations (value) as they behave quite differently from the big market capitalization stocks that were included in this analysis.

Additionally, my R squared values are not that high in most models which means that I have omitted a lot of relevant variables, and subsequently all my conclusions are quite unstable. Some correlation results are thus different, and some may not even be statistically significant. So, any subsequent analysis should aim at increasing R squared (and adjusted r squared) by including more relevant variables into the models used.

6. Bibliography

Batra, R., & Daudpota, S. M. (2018). Integrating stocktwits with sentiment analysis for better prediction of Stock Price Movement. 2018 International Conference on Computing, Mathematics and Engineering Technologies (ICoMET). https://doi.org/10.1109/icomet.2018.8346382

Hayes, A. (2022, September 13). Volatility: Meaning in finance and how it works with stocks. Investopedia. Retrieved December 19, 2022, from https://www.investopedia.com/terms/v/volatility.asp

Tan, G. (2021, December 16). Social Media Platform Stocktwits valued at $210 million after latest funding. Bloomberg.com. Retrieved December 19, 2022, from https://www.bloomberg.com/news/articles/2021-12-16/social-media-platform-stocktwits-nabs-210-million-valuation

Yang, D., & Zhang, Q. (2000). Drift‐Independent Volatility Estimation Based on High, Low, Open, and Close Prices. The Journal of Business, 73(3), 477–492. https://doi.org/10.1086/209650

7. Appendix

Results for lagged returns as the outcome variable
Dependent variable:
lagged_ret
returns next day
number of tweets 0.086***
(0.023)
bearish ratio -2.581***
(0.120)
volatility ratio 0.057
(0.067)
volume -0.551**
(0.222)
volatility 2.090***
(0.416)
number of likes -0.015
(0.039)
returns 0.009
(0.012)
volatility X volatility ratio -0.568***
(0.168)
Constant -0.026
(0.202)
Observations 6,459
R2 0.070
Adjusted R2 0.069
Residual Std. Error 1.881 (df = 6450)
F Statistic 60.892*** (df = 8; 6450)
Note: p<0.1; p<0.05; p<0.01
Results for lagged bearish ratio as the outcome variable
Dependent variable:
lagged_bear
bearish ratio next day
number of tweets 0.007***
(0.002)
returns 0.002*
(0.001)
volatility ratio -0.020***
(0.006)
volume -0.129***
(0.020)
likes -0.015***
(0.003)
volatility 0.243***
(0.037)
bearish ratio 0.524***
(0.011)
volatility X volatility ratio -0.022
(0.015)
Constant 0.118***
(0.018)
Observations 6,459
R2 0.368
Adjusted R2 0.367
Residual Std. Error 0.169 (df = 6450)
F Statistic 468.741*** (df = 8; 6450)
Note: p<0.1; p<0.05; p<0.01
Results for lagged volatility ratio as the outcome variable
Dependent variable:
lagged_v_r
volatility ratio next day
number of tweets -0.001
(0.005)
returns -0.001
(0.003)
bearish ratio -0.066**
(0.026)
volume -0.264***
(0.049)
likes -0.003
(0.008)
volatility 0.001
(0.038)
volatility ratio 0.879***
(0.006)
Constant 0.330***
(0.033)
Observations 6,459
R2 0.780
Adjusted R2 0.779
Residual Std. Error 0.412 (df = 6451)
F Statistic 3,261.136*** (df = 7; 6451)
Note: p<0.1; p<0.05; p<0.01