我用 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的参数还可以。
有人可以帮忙吗??非常感谢...