Posts

My name is Campbell Taylor. I am a rising senior and a Statistics major at The Ohio State University. Through my first few weeks as a Quantitative Research Intern for Social Market Analytics I’ve been exposed to alternative data and its applications in the financial market. In this research, I created a day trading strategy built around changes in sentiment on twitter.

Social Market Analytics (SMA) captures unstructured data through alternative sources such as Twitter. Using unique Natural Language Processing sentiment analysis, SMA rates tweets in real time and create metrics that enhance insights into equities’ market movements.

Sentiment factors used for this analysis are distributed through SMA’s S-Factor feed. The factors are:

  • S-Score: normalized representation of a stock’s sentiment on twitter over 24 hours
  • SV-Score: normalized representation of a stock’s indicative tweet volume over 24 hours
  • S-Buzz: measurement of unusual Twitter activity compared to the universe of stocks

A large S-Score (> 2) is associated with extreme positive sentiment on Twitter, while a small S-Score (< -2) is associated with extreme negative sentiment. The same applies for SV- Score. S-Buzz ranges from 0 to 4.5, with 1 being the statistical mean. The goal of this research is to use these sentiment factors overlaid with pricing momentum to develop a profitable daily trading strategy.

The momentum used for this research is defined as the following:

This isolates the pricing momentum to strictly overnight movement. Similarly, I used the differences in sentiment to capture the overnight sentiment changes. The two sentiment timestamps are taken at 9:10 AM EST of the current trading day and 3:40 PM EST of the previous trading day, both 20 minutes prior to market open and close. Subtracting the previous day’s closing sentiment from the current day’s opening sentiment isolates the overnight sentiment change.The target return can be defined as:

A popular trading strategy is buying securities with rising momentum and selling them when the momentum has appeared to be exhausted. My original hypothesis was that positive overnight sentiment movements would enhance the overnight pricing momentum. More specifically: a positive S-Score difference (increased positivity), SV-score difference (increased volume of tweets), or S-Buzz difference (more unusual activity) would lead to the positive momentum continuing until close of the trading day, and vis versa for negativity.

To find which sentiment movement was most significant in predicting returns, I built a logistic regression model. This models the probability of a discrete outcome given the input variables. In this case, the probability of positive open to close returns given the various overnight sentiment changes and the overnight pricing momentum. The idea being parameters that increase the probability of positive returns will create a trading strategy that would be more profitable than the market over time.

Before selecting the model, I checked the distribution of the variables to ensure there was no abnormalities in their distribution. The histograms below show the following distributions (left to right, up to down): Overnight Difference in S-Score, Overnight Difference in SV-Score, Overnight Difference in S-Buzz, Overnight Pricing Momentum, and Open to Close Returns. All the variables appear to be roughly normally distributed, which is beneficial for statistical modeling and taking the tails of the distribution.

Using the four remaining variables, I used a stepwise information criteria method to aid the selection of the best parameters for trading. The information criteria measure the model’s performance while considering the number of parameters used. To my surprise, the model showed that positive (negative) overnight momentum decreased (increased) the probability of positive open to close returns for the next trading day. Additionally, overnight momentum was more significant as a factor variable rather than a continuous variable. Meaning the sign of the momentum is more important than the magnitude of the momentum. Each of the sentiment changes were significant in predicting the return. A positive difference in S-Score and S-Buzz increased the probability of positive returns, while a positive difference in SV-score lowered it. While each variable is significant, it is important to consider the number of stocks that will pass the conditions of all parameters when trading. Very few daily stocks will satisfy all 3 specific sentiment parameters, which will lead to a large variance in results. Thus, it makes sense to narrow the model to one S-Factor variable. Selecting the S-Factor variable that has the most occurrences of extreme changes will give the most robust results. The difference in S-Score had more than double the number of stocks with extreme changes than SV-Score and S-Buzz. Therefore, the final trading strategy will be built around the difference in S-Score overlaid with overnight pricing momentum.

Since the difference in S-Score is a continuous variable that follows a normal distribution, I only wanted to trade on stocks with extreme overnight changes. I defined extreme changes as above 2 and below -2, like the S-Score variable itself. A difference in S-Score over 2 indicates there is an extreme increase in sentiment surrounding that stock on Twitter. Similarly, a difference in S-Score below -2 indicates an extreme decrease in sentiment.

I calculated the cumulative returns of 4 different trading strategies and the S&P 500 ETF trust (SPY) as the benchmark for the general market. Each of the strategies enter at market open and exit at market close with an equal weight placed on each stock. Two of the strategies will be long positions and two of them will be theoretical short positions. The long positions have parameters that increase the probability of positive returns, while the short positions have parameters that lower it.

The Long positions:

  • Trading only on stocks that had negative overnight momentum
  • Trading only on stocks that had negative overnight momentum, but an extreme increase in sentiment (difference in S-Score > 2)

The theoretical Short positions:

  • Trading only on stocks that had positive overnight momentum
  • Trading only on stocks that had positive overnight momentum, but an extreme decrease in sentiment (difference in S-Score < -2)

Trading with these 4 different strategies quantifies the effect that sentiment movement has on the overnight momentum. I expected the two long positions to give positive cumulative returns and the short positions to have negative cumulative returns. Based on the model, the long position with sentiment should give the highest returns while the short position with sentiment should give the lowest returns. Before calculating returns, I looked at the number of trades per day in the strategies with sentiment to ensure the trades won’t be too heavily weighted on one stock (top-down).

The x-axis of the histograms shows the number of trades made in a day, while the y-axis shows the number of days with that number. Both distributions suggest there will be some volatility in the number of trades per day. However, the mean and median number of trades for both strategies are high enough to ensure diversity for many of the days. There will be days where there are less than 10 trades, but those will be less than 15% of the trading days in a 10-year span. Therefore, the low volume days will be spread out and not affect the strength of the results. The average also isn’t too high to the point where it is impossible to execute the trades at the markets open. Knowing the number of trades was solid, I used these strategies to trade from December 1st 2011 to June 3rd 2022.

The time series graph shows the cumulative return of the strategies over time. Between April and June of 2020 there is a sharp increase in returns for the negative momentum with sentiment increase strategy. The abnormality can be attributed to the market condition following the beginning of lockdowns for the COVID-19 Pandemic. While markets were turbulent during this time, the long position with sentiment performed very well. Overnight sentiment movement had a significant impact on the pricing momentum. The long positions both gave positive cumulative returns, and the theoretical short positions gave negative cumulative returns. As the model suggested, trading stocks that had negative momentum with an extreme increase in sentiment gave the best returns. This strategy produced a cumulative return over 1400% in the 10-year time frame. The Sharpe and Sortino ratios suggest that the above-average returns are worth the potential volatility of this strategy. A Sharpe above 1 and Sortino above 2 are considered good for a portfolio. For the long positions, adding sentiment movement increased the Annualized Return by nearly 12%. While the effects were not as strong, adding sentiment decreased the Annualized Return of the short position by close to 7%. I then looked at how this strategy has performed since start of 2020.

The jump at the beginning is also during the lockdowns of the COVID-19 Pandemic. Each of the strategies jumped further in the direction the model predicted during this time. This time series graph follows the same behavior as the 10-year trend. The impact of the negative sentiment change on the positive momentum is more evident on this plot. Recently, the long position with sentiment strategy has performed even better than over the 10-year period. While maintaining strong Sharpe and Sortino ratios, the annualized return climbed to nearly 41%. Trading with this strategy would have given a 140% cumulative return since the first trading day of 2020. The short position with sentiment strategy also performed better in this time period. The negative overnight sentiment lowered the annualized returns by nearly 8%. Trading on the long/short positions with sentiment has been an effective trading strategy over time and shows no signs of slowing down.

The limitation with this strategy is the opening of the market being used as a part of the overnight momentum calculation and as the entry point for the trade. Therefore, there will be a delay in executing the trade. In practice this results in adding 5 cents to the opening price for the long positions and removing 5 cents to the opening price for the short positions. The returns will be a bit smaller than the ones calculated but will be very close.

Stocks have generally shown to revert to their mean following overnight movement. Adding sentiment changes appears to enhance the probability and magnitude of reversion. That is why trading on stocks where the overnight sentiment contradicts the overnight pricing momentum is a very profitable strategy. Following this strategy also removes holding stocks overnight where there is risk of news and events breaking after the market close. This research also exemplifies the predictive power of the S-Factors from Social Market Analytics. The overnight S-Score movement proved to have a significant impact on the open to close returns. Capturing the sentiment movement allows traders to identify securities where the price has not yet followed the direction of the public opinion.

To learn more about Social Market Analytics email us at ContactUs@SocialMarketAnalytics.com or schedule a demo using this link.

In this video we explain how our S-Factor feed uses the Twitter firehose to build trading signals, dashboards and widgets to help investors increase alpha. To find out how SMA can help your firm, email us at ContactUs@SocialMarketAnalytics.com or schedule a meeting using our 1 on 1 Meeting Signup.

Since our founding in 2012 we have been acquiring out-of-sample history to use in development of factor models.  We now have five years of history, with this history we can create statistically significant signals with monthly and quarterly holding periods.

This blog will explore the use of sentiment data for monthly and quarterly holding periods.  A trading system is explored by looking at exhaustion in social media measured by acceleration and velocity of sentiment as an indicator of price movements.  My next blog will look at traditional monthly and quarterly holding period performance based on a multi-factor sentiment model.

Acceleration and Velocity Trading System

Acceleration and velocity metrics can identify shifting sentiment.   To build these metrics, we created a new 50 period signal in addition to our traditional 20 day signal.  Raw-S is the net sentiment over a 24-hour look back period from a point of observation, derived from Tweets captured during the look back period. By aggregating over 50 periods, we create a 50-period Raw-S we call R50 as follows,

v1

For the purpose of this blog, we use 3:40 PM US Eastern Time factors to create the new metrics. At 3:40 PM US Eastern, a signal is generated near Market Close but with enough time to enter trades and execute at the Close. All trades reported in this paper are assumed to be executed at the Closing price of the day.

The R50 Factor is a raw 50 period sentiment measure.  To normalize the factor, we compute a standardized measure, using the following formula,

v2

where,

S50 is the Z-Score of R50

MA50 (R50) is 50-day moving average of the R50

SD50 (R50) is 50-day moving standard deviation of R50

S50 is a way to represent the R50 raw sentiment estimate on a standard normal curve.

 The New Metrics

We want to identify when the sentiment trend changes direction.  We derive new Velocity and Acceleration metrics from the S50 factor to identify changes in long-term sentiment and the rate of change of long-term sentiment.

We define V50, the velocity, as the one period change in S50,

v3

In our research, the velocity and the rate of change of velocity are equally important in identifying the exhaustion of a sentiment trend.

We call the rate of change of velocity, the acceleration, A50, (the second derivative of the S50),

 v4

Building A Trading Strategy Using Velocity and Acceleration

We observed a mean reverting phenomenon with longer-term sentiment. A high positive peak in the S50 sentiment was typically followed by a decrease in price. Consequently, a local minimum of S50 was followed by price appreciation.

This is the foundation of the trading signals developed.

We used various portfolio sizes to test this trading strategy. Portfolios ranged from 20 highly followed stocks on Twitter to the full SMA equity universe.

Using the metrics defined above, we used the following entry and exit signals,

 

v5

Rational for using these signals is as follows:

  1. A mean reverting relation between S50 and Closing Price.
  2. We want to capture the change and rate of change rather than just the absolute level of sentiment.
  3. A V50 of 0.5 means a change in S50, of 0.5 standard deviations and A50 < 0 is deceleration, A50 > 0 is acceleration.
  4. Due to the mean reverting nature of S50, we wanted to enter when the sentiment was decelerating and had reduced by over 0.5 standard deviations in one day.
  5. We wanted to exit when the sentiment was accelerating and had already increased by 0.5 standard deviations.

 

This was a successful trading strategy across all universes selected.  Below are performance statistics for various universe sets.  20 liquid stock portfolio universe is a universe of stocks that are highly followed on Twitter.  100 liquid stock universe is a universe of 100 stocks that are highly followed on Twitter.  Top 1000 mkt. cap and universe are self-explanatory.

v6

This data is statistically significant, out of sample, and reproducible.  To learn more about the possibilities of sentiment data in your model please contact SMA at ContactUs@SocialMarketAnalytics.com.

Thanks,

Joe

 

Social media beats the mainstream media on a regular basis.  Last week social media beat the news wire in reporting the MSFT acquisition of LNKD (blog post below) and Tuesday Twitter broke SCTY being acquired by TSLA.  This information is not theoretical – it is actionable data in our feed!

Tesla Motors lit up Twitter, yesterday, when CEO, Elon Musk came out and said their cars can float on water.  Tuesday June 21, the electric car manufacturer took everyone by surprise when they announced their decision to buy the solar panel company SolarCity (SCTY) minutes after the markets closed. The first news article to mention this came out at 4:18 PM CDT. Twitter had already gotten wind of this development 8 minutes prior with a tweet from the account “TopstepTrader”.

TSLA -SCTY

The tweet from “TopstepTrader” was deemed to be credible by Social Market Analytics’ sophisticated algorithm, which separates signal from noise to create actionable intelligence. The sentiment started to move in a positive direction the very next minute. By 16:12 CDT, SMA’s subscribers received ‘S-DeltaTM’ alerts on SCTY. The PredictiveSignalTM from SMA became positive at 16:13 CDT and at 16:18, when the first news article came out, the sentiment had already reached an extremely positive level, with Tweet volume soaring high; as was the stock price. Traders who incorporated social media sentiment from SMA into their trading models were ahead of the curve, making profits as the rest of the market was just learning of the news.

SCTY

The S-Delta metric also flagged this move.  The below chart illustrates the delta values for SCTY.  Delta represents the change in S-Score over a 15 minute lookback.  Delta values of 2 or higher are huge outliers. An SMA alarm based on Delta or S-Score would have provided an alert to this breaking news.

SCTY_Delta

To find out how you can use SMA S-Factors in your investment process contact us at Info@SocialMarketAnalytics.com

 

 

Signals derived from Twitter data have typically been viewed as shorter term signals.  There are a number of reasons for this.  One reason is the lack of out of sample data to back test trading systems on.  At SMA we now have nearly four and a half years of sentiment metrics to use in the creation of longer term signals.  Long-Term is a subjective term when discussing holding periods.  For our purposes we will be looking at trading signals that generate an average holding period of one month to three months.

At SMA we do not believe that one metric provides the full tone and context of a Twitter conversation.  That is why we publish a family of metrics call S-Factors that provide a richer view of the conversation than what is available with a single metric.

With history we have been able to look at longer term metrics and changes in security prices over longer periods.  We looked at large rapid negative changes in sentiment and determined that these sentiment movements are overreactions and lead to buying opportunities. We introduce two new metrics: Velocity and Acceleration.  The universes for these back test range from 20 large Twitter followed liquid stocks to the entire equity universe.  As you can see below these strategies identify solid buying opportunities and generate healthy average profit per share.  Please contact SMA to learn more about using sentiment to generate longer holding period trading signals with sentiment data.

Below are equity curves and trading statistics net of commissions with various universes. Overall you generate much fewer trades and hold them for longer periods of time.  The 50-day S-Score chart uses the SMA S-Score, Velocity and Acceleration Metrics.  You see that the holding periods are much longer than signals typically generated by social media.  The columns represent different universe sizes.

Slide1

200 Day S-Scores returns are below.  Again, please contact SMA for more detailed information.  Slide2

To learn more please contact us at: ContactUs@SocialMarketAnalytics.com

At Social Market Analytics we specialize in sentiment for capital markets.  However, our technology can be leveraged in many areas of sentiment.  As we expand our capabilities to look at other topics I thought it would be interesting to open up the fire hose to the full Twitter universe and capture sentiment on the current conversation about candidates and issues – boy is it!   With the upcoming debate and Iowa Caucuses we are getting a lot of good stuff on the political landscape.

Donald Trump skipping the debate is bringing strong reaction.  Sentiment for Trump the candidate has dropped quickly over the last 24 hours since he announced he wasn’t participating in the debate and his ongoing feud with Fox News.

The chart below illustrates the real-time tone of the conversation and the change of sentiment over the last 24 hours (4:00pm central 1/27/2016)  for Donald Trump as calculated by our engine.  The Yellow decreasing line represents the falling sentiment for Donald Trump and the red line illustrates the conversation is overall negative over the last 24 hours.

This is early data from our expanding capability to look at other topics, I  thought our readers would find it interesting.   To learn more about our capabilities please contact Social Market Analytics at ContactUs@SocialMarketAnalytics.com.

Keep in mind this is over the last 24 hours and will definitely change so stay tuned!!!

trump sentiment

 

Thanks,

Joe

 

People ask about the persistence of SMA sentiment signals over time.   The signal length is dependent on the S-Factor used.   S-Mean for example represents a 20 day look back period and is generally used as a longer term signal.  We looked at a theoretical strategy using a universe of the Russell 1000 and S-Factors: S-Score, S-Volume and price.  It is not intended as a proposal of a trading strategy using S-Factors as a single factor in an alpha model it does illustrate the persistence of the signal over time.

We primarily looked at the signal prior to market open instead of prior days close to include the most recent social media conversation in the metrics.  If you use a sentiment score from the prior days close you don’t include overnight information such as news, foreign markets, and indication of market open…

The universe of stocks considered is the Russell 1000 representation as of 06/26/2015.  The back test period is 2011-12-01 to 2015-11-12.  There are no transaction costs/impact costs assumptions included in this analysis.

The simulation uses S-Score > 3 / S-Score < -3 AND S-Volume > 5 AND Price at Entry > $5.  An S-Score > 3 means the current conversation is more positive than 99% of conversations over the look back period (20 days).  The reason for choosing the threshold of 3 for S-Score is motivated, in part; on research results presented by Markit using the SMA S-Factors (contact us for the research).  The position holding period is Open to Close (+2), (i.e. close 2 business days from now).  The S-Factors signals used were selected at 09:10 AM (ET).

In the below chart, the Green Curve shows the results of going long on Positive Signal (S-Score positive with the thresholds used).  Similarly, the Red Curve shows the returns of the negative (S-Score <-3, negative return is good in this case). The Blue Curve is the result of going long on Positive Signal Portfolio and short the Negative Signal Portfolio each day.   Black Curve is the ONEK ETF (Russell 1000 SPDR ETF) and serves as a market reference for the back test period.  Risk adjusted performance measures (Sharpe, Sortino) and average daily returns are presented for each filter.

The results of Open to Close (+2) Strategy using |S-Score|> 3 & S-Volume > 5 & Entry Price > $5 signal at 09:10 AM are below.  To test the strength of a signal with strong threshold, we decided to hold the position for 3 days, (buying at the open when the signal met requirements of the filter and selling it at the close 2 business days later).  If a stock appears on 2 consecutive days, the trades are made in isolation, irrespective of the position that is held due to previous signal. The Positive and Long Short outperform the ONEK benchmark.  A large spread between Positive results and the benchmark is evident.

In our simulation the positive S-Score portfolio returns 23 bps per day versus the benchmark of 9 bps per day.  The long/short portfolio returns 28 bps versus the 9 bps per day for the benchmark.  Certainly significant reason for further analysis of adding sentiment signals to your portfolio.

These results illustrate that adding S-Volume and price filters, in conjunction with S-Score, yields significant positive returns performance.

Please contact us for much more detail and other back test or to explore how sentiment metrics can be used in your environment.

R1000 S-Score

RtnsTable

Social media is a new and rich source of trading ideas.  To illustrate this point, below are some recent  trading opportunities social media data presented.  In each case activity and sentiment increase prior to the actual event.  Social media is a leading indicator of stock performance and SMA is the leader in providing metrics based on social media.

Teva acquires Allergen

Teva Pharmaceutical Industries surged in pre-market trading on July 27, 2015 on news that the company will be acquiring Allergan’s (AGN) generic drug business. Before this happened, sentiment on Twitter had already become strongly positive. At 4:00 AM EDT, when the stock price was $66.00 there was significant positive sentiment on Twitter. The sentiment rapidly shifted positive. By 7:24 a.m., the stock was trading at $72.30. The stock opened at $67.80 when the sentiment was 3.92 and closed at $72.

Figure 1:  S-Score™ For TEVA Pre- and Post-Announcement.

TevaSentiment

TevaHistoricalSentiment

Historically, daily sentiment scores for TEVA fluctuated near 0 (Neutral), with low social media activity as indicated by the time series of the S-Volume™ metric.  This behavior started to change on July 26 with significant upticks in indicative Tweet volumes and sentiment levels.  On the morning of July 27th,TEVA’s S-Score™ increased sharply to a high positve level, coincident with a spike in S-Volume™ consistent with high social media activity, indicating that SMA’s processing technology had sucessfully detected the signature of positve sentiment for TEVA embedded in the Twitter data stream.  This high positive sentiment level persisted through the open on July 28th and then started to return to typical historical levels as the markets and social media fully integrated the effect of the announcement.

Rumored Announcement of Acquisition:  Twitter (TWTR)

On July 14, 2015 at 11:39 AM EDT, a rumor started spreading on Twitter about Twitter being acquired by Bloomberg.  At 11:40 AM, there was a Tweet from user ‘beckyhiu’ indicating that Bloomberg had offered $31 Billion to buy Twitter and that Twitter was considering the offer. This rumor caused the stock price to rise rapidly. A Tweet, about 30 seconds later, at 11.41 AM,  by ‘zerosum24’ confirmed that the rumor had reached Twitter and people had started talking about it. The sentiment had started rising rapidly by this time. The changes in S-ScoreTM and S-DeltaTM were significantly positive. At 11:42 AM, the sentiment was over 2, and was statistically significant.

It was soon realized this might be a hoax and that no offer was made. At 11:42 AM, ‘TurboResearch’ questioned the credibility of the buyout offer.

There had been no official statement from Bloomberg, and hence, both the sentiment and the stock price kept rising. At around 11:50 AM, a journalist from Bloomberg Tweeted that the news was a hoax and that it was not to be believed. At this point sentiment started declining as people starting tweeting negatively. The stock price dropped rapidly.  After that, there were mostly negative comments driven by the refuted rumor.  The figures below show SMA sentiment factors leading the stock price quite accurately.

TWTRSentimentPrice

Figure 2: TWTR S-ScoreTM vs. Price

TwitterVolumeSpike

Figure 3:  Intraday   S-Volume™ Chart for TWTR

Amazon (AMZN) Earnings Announcement 

Twitter sentiment can predict stock changes even after market close, as in the case of Amazon. Amazon reported earnings on July 23, 2015. While the market consensus was that the company would not beat expectations, the conversation on social media was different.

SMA data showed a sharp increase in sentiment metrics around 2:49 PM EDT. By 2:51 PM, the sentiment on Amazon was two standard deviations higher than its typical level. The stock was trading at $480.45 at this point. At market close, it traded at $482.18, higher than the price at the time when sentiment on Amazon became positive.

It was interesting to see how the stock traded after-hours once the company reported earnings. Amazon’s stock shot up more than 17% — to $568 — from its price at 3:51 PM EDT after the company reported a surprise quarterly profit. The hidden sentiment value in Twitter data predicted what “conventional” market speculators failed to predict.

AmazonTweets

AmazonEarnings

Figure 4:  Intraday S-Score™ And S-Volume™ Behavior across Amazon’s Earnings Event.

The progression of intraday S-Score™ and S-Volume™ metrics for Amazon is shown above from 1:00 PM EDT to 4:25 PM EDT.  Amazon’s sentiment remained positive throughout the day and became significant around 2:50 PM. The sentiment saw a sharp rise post the earnings announcement after market close.

We publish our own research and analysis.  We invite you to check our Research site for new updates and publications.

Thanks,

Joe