带有zipline的adfuller测试的bug

时间:2015-07-09 20:56:04

标签: python statsmodels zipline

我已经使用stattools测试了ADF,我的代码是

import statsmodels.tsa.stattools as ts  
from datetime import datetime

import zipline  
from zipline import TradingAlgorithm  
from zipline.api import order_target, record, symbol, history, add_history

data = get_pricing(['AAPL'],start_date='2015-01-13',end_date = '2015-02-13',frequency='daily')  
result = ts.adfuller(data.price.values,1)

但是,我收到了以下错误,

ValueError                                Traceback (most recent call last)  
<ipython-input-45-44774ff05797> in <module>()  
      7  
      8 data = get_pricing(['AAPL'],start_date='2015-01-13',end_date = '2015-02-13',frequency='daily')  
----> 9 result = ts.adfuller(data.price.values,1)

/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/stattools.pyc in adfuller(x, maxlag, regression, autolag, store, regresults)
    209  
    210     xdiff = np.diff(x)  
--> 211     xdall = lagmat(xdiff[:, None], maxlag, trim='both', original='in')  
    212     nobs = xdall.shape[0]  # pylint: disable=E1103  
    213 

/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/tsatools.pyc in lagmat(x, maxlag, trim, original)
    322     if x.ndim == 1:  
    323         x = x[:,None]  
--> 324     nobs, nvar = x.shape  
    325     if original in ['ex','sep']:  
    326         dropidx = nvar

ValueError: too many values to unpack

我无法看到问题。我认为adfullter的参数还可以。

任何人都可以帮忙吗?非常感谢...

0 个答案:

没有答案