Back to Community
Research and IDE data do not match - Stocktwits/Twitter/Psychsignal

I am running into the same problem I had with Estimize before the Q team found a problem with it and disabled the dataset. Pulling data in research simply does not match what is available in pipeline over in IDE. For instance total_scanned_messages for SPY seem to be higher over in IDE than what is seen in research which leads to the bullish_intensity and bearish_intensity and other factors to change.

Here is an example:

bull_minus_bear of SPY on 2011 - 01 - 02 is 0.96 in the IDE and 0.88 in research
bull_minus_bear of SPY on 2011 - 01 - 03 is 0.21 in the IDE and 0.29 in research
bull_minus_bear of SPY on 2011 - 01 - 04 is -0.03 in the IDE and 0.08 in research

6 responses

Hi Peyman,

What date column are you using to match this up? And do you mind providing code snippets?



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.

Here is the code to just print SPY's data from pipeline in the IDE. You can see the values in the logs.

Clone Algorithm
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
import pandas as pd
import numpy as np
from quantopian.pipeline import CustomFactor

from quantopian.algorithm import attach_pipeline, pipeline_output
from quantopian.pipeline import Pipeline

from import aggregated_twitter_withretweets_stocktwits_free as psychsignal

class sentiment(CustomFactor):
    inputs = [psychsignal.bull_minus_bear]
    window_length = 1
    def compute(self,today,assets,out,factor):
        factors = pd.DataFrame(factor,columns=assets)
        s = factors[sid(8554)][0]
        out[:] =  s

def initialize(context):
    pipe_columns = {
        'sent': sentiment()
    pipe = Pipeline(columns = pipe_columns)
    pipe = attach_pipeline(pipe, name='psychsignal')

def before_trading_start(context, data):   
    context.results = pipeline_output('psychsignal')
    print context.results[context.results.index == symbol('SPY')]

There was a runtime error.

Could you post the research code as well?

Here is the code to retrieve the same data over in research. I have looked at as_of_date and timestamp to cross refrence them. Additionally I have searched for the values shown in the IDE, in the entire dataset coming out of Research and they do not exist. The values are close but nevertheless not the same.

Loading notebook preview...

Hi Peyman, just a few things.

  • We match up asof_dates between the two datasets. So whatever the asof_date is will be when the data is available.
  • You're comparing two different datasets. aggregated_twitter_withretweets_stocktwits_free versus twitter_withretweets_free
  • You can remove the _free and use the full version that way :)

Give that all a shot and let me know if you still see issues.


Ah Seong, I cannot believe I missed that. Thanks a lot for catching that. Numbers match up now.