Stocktwits Sentiment Data - Event Stream Example
In the public scripts under Sentiment, you will find a script for accessing the Stocktwits sentiment data.
Stocktwits data is available from 2010-01-01.
Historic Data Query
To read sentiment data that came before your script started you will need to use the code in the on_start function.
Event Data
To receive the events "as they occur" you need to take two steps.
1) Register to the StockTwits event stream..
@classmethod
def register_event_streams(cls, md, service, account):
return {'!sentiment/stocktwits': 'on_stocktwits'}
2) Receive callbacks throughout the day on the following...
def on_stocktwits(self, event, md, order, service, account):
print(event.field['Confidence'])
print(event)
Example of a complete Stocktwits Event:
timestamp=1497879003000000,
symbol='AAPL',
field=
{
'sector': 'Technology',
'user_id': 181317,
'exchange': 'NASDAQ',
'timestamp': '2017-06-19 09:30:03',
'industry': 'Personal Computers',
'sentiment_score': 0.5571,
'company_name': 'Apple Inc.',
'message_id': 86293581
}
Stocktwits are a financially-themed social media platform, and the stocktwit sentiment scores stem directly from this platform.
It will tend to have a much higher volume of comments and sentiment updates, but with a smaller impact than more traditional news articles.
'sentiment_score' = -1.0 to +1.0 (-1 worst score, +1 best score)