Mariner Backtesting - SMA 15 Minute Snapshots Example

Social Markets Analytics

SMA 15 minute Snapshots Example

Social Market Analytics Inc (SMA) provide sentiment data for the US stock markets.

You will find ready to clone scripts for accessing the SMA Sentiment Data in the public scripts area under Sentiment.

SMA Sentiment data is available from 2011-12-01 to the current date.

SMA 15 minute snapshots come in two forms, TWITTER (tw) and STOCKTWITS (st).

To read the 15 minute snapshots that come throughout the trading day you will need to take two steps.

1) Register to the event stream..

 @classmethod
def register_event_streams(cls, md, service, account):
    return {'!sentiment/sma/tw/15min': 'on_event_sma_tw', '!sentiment/sma/st/15min':'on_event_sma_st'} 

Here we have registered for both and so will receive callbacks on both.

2) Receive callbacks throughout the day on the following...

 def on_event_sma_tw(self, event, md, order, service, account):
    print event.field['s-score']
    print event

def on_event_sma_st(self, event, md, order, service, account):
    print(event.field['s-score'])
    print(event)

Link to Demo Script

Example of a complete SMA Event :

 symbol|muts_timestamp|timestamp|raw-s|raw-s-mean|raw-volatility|raw-score|s|s-mean|s-volatility|s-score|s-volume|sv-mean|sv-volatility|sv-score|s-dispersion|s-buzz|s-delta
AA|1524024600000000|2018-04-18 04:10:00|0.269|0.573|1.043|-0.292|0.148|0.294|0.485|-0.301|36.0|18.444|20.674|0.849|0.778|1.675|0.077
Event values
Field Description
Symbol Symbol
muts_timestamp Muts Timestamp
timestamp Date and time of sentiment estimate (UTC)
Raw-S Raw-S is the summation of sentiment of unique tweets received in a rolling 24-hour window
Raw-S-Mean Raw-S-Mean is the 20-day moving average of Raw-S
Raw-S-Volatility Raw-S-Mean is the 20-day moving standard deviation of Raw-S
Raw-Score This is the statistical Z-Score of Raw-S
S Similar to Raw-S. S is the exponentially time weighted summation of tweets in the 24-hour window.
S-Mean The 20-day moving average of S
S-Volatility The 20-day moving standard deviation of S
S-Score Normalized value of S. This is SMA's S-Score-TM, >1 Positive, >2 High Positive, >3 Extreme Positive (Negatives are same but the inverse, values between -1 and +1 are considered Neutral) - Fidelity have a nice PDF with more info
S-Volume Volume of Unique Tweets used to compute the sentiment estimate.
SV-Mean 20 day moving average of S-Volume
SV-Volatility 20 day moving standard deviation of S-Volume at the time of observation
SV-Score Normalized value of S-Volume. A Z-score of the S-Volume, computed like Raw-Score and S-Score
S-Dispersion Measure of the Tweet source diversity contributing to a sentiment estimate.
S-Buzz A measure of unusual volume activity compared to a universe of stocks.
S-Delta Change in S-Score over a 15-min lookback period.