PsychSignal Trader Mood

Overview

PsychSignal is a data analytics firm that provides real time Trader Mood metrics for US equities. PsychSignal uses their natural language processing engine to analyze millions of social media messages in order to provide quantified sentiment scores for each security. Two sources for social media are used: Twitter and StockTwits.

Psychsignal data is available via the Pipeline API, which means it can be accessed in Research and the IDE.

Properties
  • Coverage: US only
  • Data Frequency: Daily
  • Update Frequency: Daily (updated every morning at ~7am ET)
  • Timespan: July 2009 to present.
  • Point-In-Time Start: January 2016
  • Holdout: None
Methodology
Point-In-Time

Starting in January 2016, PsychSignal data has been collected and surfaced in a point-in-time fashion on Quantopian. This corresponds to when Quantopian started downloading and storing PsychSignal data on a nightly basis. Timestamps for historical data prior to January 2016 are approximated by adding 24 hours to the asof_date of each record.

Usage

There are four PsychSignal pipeline DataSets available on Quantopian that assign trader mood scores to US equities. The four datasets have the same structure but are different in the subset of Twitter and Stocktwits trader messages they use to generate mood scores. Each dataset is located in the quantopian.pipeline.data.psychsignal module. The sections below provide more information on the PsychSignal datasets that are available on Quantopian including a code example.

Import
from quantopian.pipeline.data.psychsignal import (
        aggregated_twitter_withretweets_stocktwits, #Psychsignal data from Twitter and Stocktwits.
        stocktwits,                                 #Psychsignal data from Stocktwits.
        twitter_noretweets,                         #Psychsignal data from Twitter (no retweets).
        twitter_withretweets,                       #Psychsignal data from Twitter (with retweets).
)
Example

This code snippet constructs and runs a pipeline that computes the percentage of total scanned messages that are classified as 'positive' by PsychSignal. Note that this example uses the twitter_withretweets dataset, importing it under the alias twitter_sentiment.

from quantopian.pipeline import Pipeline
from quantopian.pipeline.data.psychsignal import twitter_withretweets as twitter_sentiment
from quantopian.pipeline.domain import US_EQUITIES
from quantopian.research import run_pipeline

# Define a positive sentiment percent factor, dividing the number of bull
# scored messages by the total number of scanned messages for the equity.
positive_sentiment_pct = (
        twitter_sentiment.bull_scored_messages.latest
        / twitter_sentiment.total_scanned_messages.latest
)

# Add the factor as a column in the pipeline.
pipe = Pipeline(
        columns={
                'positive_sentiment_pct': positive_sentiment_pct,
        },
        domain=US_EQUITIES,
)

# Run the pipeline over one year and print the first few rows of the result.
df = run_pipeline(pipe, '2015-05-05', '2016-05-05')
print(df.head())
Pipeline Datasets & Columns
Datasets
  • aggregated_twitter_withretweets_stocktwits - A pipeline dataset that provides access to trader mood data collected from StockTwits posts as well as Twitter posts, including retweets.
  • stocktwits - A pipeline dataset that provides access to trader mood data collected from Stocktwits posts, including retweets.
  • twitter_withretweets - A pipeline dataset that provides access to trader mood data collected from Twitter posts, including retweets.
  • twitter_noretweets - A pipeline dataset that provides access to trader mood data collected from Twitter posts, excluding retweets.
Fields

Each PsychSignal dataset has the following fields (accessible as BoundColumn attributes):

  • asof_date (dtype datetime64[ns]) - The effective date of the sentiment record (date when the record first applies).
  • bear_scored_messages (dtype float) - Total count of bearish sentiment messages scored by PsychSignal's algorithm.
  • bearish_intensity (dtype float) - Continuous value ranging from 0 to 4 representing the average intensity of bear scored messages.
  • bull_bear_msg_ratio (dtype float) - Ratio of bull scored messages to bear scored messages.
  • bull_minus_bear (dtype float) - Difference of bull scored messages minus bear scored messages.
  • bull_scored_messages (dtype float) - Total count of bullish sentiment messages scored by PsychSignal's algorithm.
  • bullish_intensity (dtype float) - Continuous value ranging from 0 to 4 representing the average intensity of bull scored messages.
  • total_scanned_messages (dtype float) - Number of messages coming through PsychSignal's feeds, regardless of whether the PsychSignal sentiment engine can score them for bullish or bearish sentiment.