Back to Community
Social media message volume as a proxy for stock volatility

Hey all,

This is something I've been working on and wanted your feedback. Social media data is generally pretty new in finance and I think we're only beginning to discover the uses for them. If you follow my other posts, I've tried creating a few fun projects using PsychSignal's trader mood signals as buy/sell signals for securities. However, after much reading and discussion with folks much smarter than I am, I've been playing around with the idea of using social media as a proxy for stock price volatility within the context of the much documented volatility effect.

As a quick summary, the volatility effect often shows that securities with low volatility often outperform (risk-adjusted returns) securities with high volatility. Much of the studies on this effect ended in the mid-2000s and the research I'm doing now can be considered "out-of-sample".

So here's what I've done so far:

  • I've begun testing two factors in Andrew Campbell's Factor Tearsheet. The two factors are stock price volatility and StockTwits message volume. From the initial tearsheet it looks like social media message volume contains more Information Coefficient and is more consistent in returns over the different factor quantiles. Your thoughts are appreciated in expanding this notebook.
  • Taking the observations from above, I plugged in the StockTwits message volume factor into James Christopher's long-short multi-factor pipeline algorithm as a quick validation of the tearsheet. I found that the factor itself alone did not provide useful as an alpha factor.

Critique, thoughts, feedback are appreciated.

Loading notebook preview...
Notebook previews are currently unavailable.

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

2 responses

Here's the algorithm that's discussed above

Clone Algorithm
Backtest from to with initial capital
Total Returns
Max Drawdown
Benchmark Returns
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 57755bcc2d7a311207daeea1
There was a runtime error.

I'm wondering what these lines do.
def src_std_error(rho,n):
return np.sqrt((1-rho**2)/(n-2))
err=ic.apply(lamda x:src_std_error(x,obs_count))
err=err.reset_index().groupby(['sector_code']).agg(lambda x:np.sqrt((np.sum(np.power(x,2))/len(x))))