Automated Trading Strategy Using Twitter Sentiment

By: The Deltix Quantitative Research Team


This paper describes the implementation of an automated quantitative equity trading strategy based on sentiment factors derived from Twitter and the results from back-testing this strategy. The sentiment factors were provided by Social Market Analytics (SMA).  SMA produces a family of metrics, called S-Factors™, designed to capture the signature of financial market sentiment. SMA applies these metrics to data captured from Twitter to estimate sentiment for indices, sectors, and individual securities; yielding and recording time series of these measurements on daily and intraday time scales.

We implemented the strategy in the Deltix QuantOffice research platform, a purpose-built C# development studio with embedded math, statistics and data libraries.

The strategy, which uses SMA’s intraday S-Scores, generates trading signals based on the S-Score trend-lines. We applied industry standard moving average methodology for S-Score time-series data and established trend-lines by comparing slow and fast moving averages. In addition we generated several filters to improve signal accuracy.

We made a series of experiments on the members of S&P100 index from December 2011 till March 2013. We compared the following scenarios:

a)      Open a position using day open price

b)      Open a position at 9:32am using current price

In addition, we added a hedging rule against the market using the SPY ETF and investigated the impact of hedging for each of the above scenarios. In the consolidated results table below, “H+” means with hedging, “H-”means without.

The results of the backtesting showed Information Ratios between 3.0 and 3.72 across the four scenarios tested. The primary effects of hedging were to reduce average profit per share and drawdown amounts.


Consolidated results

 SP100, H-,S&P100, H+,S&P100, H-,S&P100, H+,
gap 0.5%gap 0.5%9.32, gap 0.5%9.32, gap 0.5%
Average Profit per Share0,080,040,080,03
Information Ratio3,313,723,313,3
Net Profit/Loss3,601.192,089.433,668.971,711.99
Total Profit9,058.9211,376.368,788.8610,922.18
Total Loss-5,457.73-9,286.93-5,119.88-9,210.19
Cumulated Profit %3.60%2.09%3.67%1.71%
Max Drawdown-338,39-126,02-339,28-171,73
Max Drawdown %-0.33%-0.12%-0.33%-0.17%
Max Drawdown Date4-May-20124-May-20124-May-201213-Dec-2012
Return/Drawdown Ratio10,6416,5810,819,97
Drawdown Days %62.46%63.36%62.46%66.67%
Max Drawdown Duration36394239
Sharpe Ratio3,313,723,313,3
Annualized Volatility0,850,440,870,41
Sortino Ratio6,178,316,67,19
Information Ratio3,313,723,313,3
Optimal f388,54845,22380,3812,9
All Trades #1598184215991844
Profitable Trades Ratio0,580,550,570,55
Winning Trades #92210209151019
Losing Trades #676822684825
Average Trade2,251,132,290,93
Average Winning Trade9,8311,159,6110,72
Average Losing Trade-8,07-11,3-7,49-11,16
Avg. Win/ Avg. Loss Ratio1,220,991,280,96
Average Profit per Share0,080,040,080,03


Detailed results

1. Open position at day open time


Performance report:

ParameterAll TradesLong TradesShort Trades
Net Profit/Loss3,601.193,768.95-167,77
Total Profit9,058.928,316.09742,82
Total Loss-5,457.73-4,547.14-910,59
Cumulated Profit %3.60%3.77%-0.17%
Max Drawdown-338,39-338,39-206,71
Max Drawdown %-0.33%-0.33%-0.21%
Max Drawdown Date4-May-20124-May-20123-Aug-2012
Return/Drawdown Ratio10,6411,14-0,81
Drawdown Days %62.46%60.66%89.79%
Max Drawdown Duration3640299
Sharpe Ratio3,313,53-0,73
Annualized Volatility0,850,830,18
Sortino Ratio6,176,69-0,93
Information Ratio3,313,53-0,73
Optimal f388,54422,1-404,48
All Trades #15981449149
Profitable Trades Ratio0,580,590,49
Winning Trades #92284973
Losing Trades #67660076
Average Trade2,252,6-1,13
Average Winning Trade9,839,810,18
Average Losing Trade-8,07-7,58-11,98
Avg. Win/ Avg. Loss Ratio1,221,290,85
Average Profit per Share0,080,1-0,03
Max Conseq. Winners21207
Max Conseq. Losers20207


2.  Open position at day open time, hedged version


Performance report:

ParameterAll TradesLong TradesShort Trades
Net Profit/Loss2,089.433,819.76-1,730.33
Total Profit11,376.368,610.222,766.13
Total Loss-9,286.93-4,790.47-4,496.46
Cumulated Profit %2.09%3.82%-1.73%
Max Drawdown-126,02-382,58-1,730.33
Max Drawdown %-0.12%-0.37%-1.73%
Max Drawdown Date4-May-20127-Nov-20121-Mar-2013
Return/Drawdown Ratio16,589,98-1
Drawdown Days %63.36%61.86%89.79%
Max Drawdown Duration3941299
Sharpe Ratio3,723,55-2,04
Annualized Volatility0,440,840,66
Sortino Ratio8,316,7-2,71
Information Ratio3,723,55-2,04
Optimal f845,22421,79-307,84
All Trades #18421499343
Profitable Trades Ratio0,550,580,43
Winning Trades #1020872148
Losing Trades #822627195
Average Trade1,132,55-5,04
Average Winning Trade11,159,8718,69
Average Losing Trade-11,3-7,64-23,06
Avg. Win/ Avg. Loss Ratio0,991,290,81
Average Profit per Share0,040,1-0,12
Max Conseq. Winners12205
Max Conseq. Losers162011

3. Open positions at 9.32am


Performance report:

ParameterAll TradesLong TradesShort Trades
Net Profit/Loss3,668.973,861.32-192,34
Total Profit8,788.868,073.09715,77
Total Loss-5,119.88-4,211.77-908,11
Cumulated Profit %3.67%3.86%-0.19%
Max Drawdown-339,28-339,28-200,74
Max Drawdown %-0.33%-0.33%-0.20%
Max Drawdown Date4-May-20124-May-201221-Feb-2013
Return/Drawdown Ratio10,8111,38-0,96
Drawdown Days %62.46%59.76%89.79%
Max Drawdown Duration4242299
Sharpe Ratio3,313,55-0,84
Annualized Volatility0,870,850,18
Sortino Ratio6,67,22-1,05
Information Ratio3,313,55-0,84
Optimal f380,3415,71-466,28
All Trades #15991450149
Profitable Trades Ratio0,570,580,48
Winning Trades #91584372
Losing Trades #68460777
Average Trade2,292,66-1,29
Average Winning Trade9,619,589,94
Average Losing Trade-7,49-6,94-11,79
Avg. Win/ Avg. Loss Ratio1,281,380,84
Average Profit per Share0,080,1-0,04
Max Conseq. Winners21207
Max Conseq. Losers202010

4. Open positions at 9.32am, hedged version


Performance report:

ParameterAll TradesLong TradesShort Trades
Net Profit/Loss1,711.993,900.98-2,188.99
Total Profit10,922.188,352.472,569.72
Total Loss-9,210.19-4,451.49-4,758.71
Cumulated Profit %1.71%3.90%-2.19%
Max Drawdown-171,73-414,77-2,188.99
Max Drawdown %-0.17%-0.40%-2.19%
Max Drawdown Date13-Dec-20128-Nov-20121-Mar-2013
Return/Drawdown Ratio9,979,41-1
Drawdown Days %66.67%60.96%89.79%
Max Drawdown Duration3942299
Sharpe Ratio3,33,56-2,5
Annualized Volatility0,410,860,68
Sortino Ratio7,197,21-3,1
Information Ratio3,33,56-2,5
Optimal f812,9414,81-367,24
All Trades #18441500344
Profitable Trades Ratio0,550,580,44
Winning Trades #1019867152
Losing Trades #825633192
Average Trade0,932,6-6,36
Average Winning Trade10,729,6316,91
Average Losing Trade-11,16-7,03-24,78
Avg. Win/ Avg. Loss Ratio0,961,370,68
Average Profit per Share0,030,1-0,15
Max Conseq. Winners19205
Max Conseq. Losers17209

1.      Open positions at 9.32

The following two tabs change content below.

The Deltix Quantitative Research Team

Latest posts by The Deltix Quantitative Research Team (see all)