Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Price mismatch at Pipeline and get_pricing

Price mismatching at USEquityPricing and get_pricing

from quantopian.pipeline.data.builtin import USEquityPricing  
import pandas as pd  
from quantopian.pipeline import CustomFactor, Pipeline  
from quantopian.research import run_pipeline


security = symbols(45000)  
df=get_pricing(security, start_date='2016-06-30', end_date='2016-06-30',  
            symbol_reference_date=None, frequency='daily', fields= 'close_price', handle_missing='raise')

print 'get_pricing',df.tail(1).values[0]

def make_pipeline():  
    latest_close = USEquityPricing.close.latest  
    return Pipeline(  
        columns = {  
            'latest_close':latest_close,  
        },  
    )

result = run_pipeline(make_pipeline(), '2016-06-30', '2016-06-30')

result = result.reset_index()  
print 'USEquityPricing',result[result['level_1']==security][['latest_close']].values[0][0]

get_pricing 50.36
USEquityPricing 49.44

why is mismatching ? numbers should be equal.

5 responses

Hello Volodymyr,

The get_pricing function actually uses a different data feed than the one used by the backtester and the pipeline API. We are working on migrating get_pricing to use the new data feed so the datasets match in both environments.

Sorry for any confusion this might have caused.

Disclaimer

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.

get_pricing() now uses the same adjusted data source as pipeline and the backtester.

Disclaimer

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.

I tried experiment

from quantopian.pipeline.data.builtin import USEquityPricing  
import pandas as pd  
from quantopian.pipeline import CustomFactor, Pipeline  
from quantopian.research import run_pipeline  
from quantopian.pipeline.factors import SimpleMovingAverage



security = symbols(45000)  

def make_pipeline():  
    latest_close = USEquityPricing.close.latest  
    sma = SimpleMovingAverage(inputs=[USEquityPricing.close], window_length=7)


    return Pipeline(  
        columns = {  
            'sma':sma,  
            'latest_close':latest_close  
        },  
    )

result = run_pipeline(make_pipeline(), '2016-01-30', '2016-06-30')

result = result.reset_index().set_index('level_0')  
print result[result['level_1']==security][['sma','latest_close']] #print result of pipeline

df=get_pricing(security, start_date='2016-01-30', end_date='2016-06-30',  
            symbol_reference_date=None, frequency='daily', handle_missing='raise')

print df #print get pricing output

  1. No data are the same. At get_pricing return the price and close_price columns are the same.
    Also they doesn't match with pipeline data.

  2. Suppose I calculate average wrongly or make mistake with adjusted and close price. But if I change price to 'high' and 'low' at pipeline and get_pricing the also will don't match.

3.I also tried to calc different way of calculation average by hand(pandas rolling mean) and by pipeline.I friend to get the same result and also not successfully. (Can you give me code where return of SimpleMovingAverage, and pandas rolling on get_pricing will match ?)

I am also trying quandl data and comparing them to get_pricing and get different prices.

Is this also related to the same issue mentioned here on different numbers between get_pricing and pipeline?

get_pricing and run_pipeline use the same data and will return the same results. See this post https://www.quantopian.com/posts/research-updates-get-pricing-and-jupyter-notebook-upgrade

If one is seeing a difference between the two it's likely one of these things...

@Shahrouz Raeisi Not sure what 'differences' you are seeing but it could be one of these?