0

GOOG で取引アルゴリズムをテストするために簡単なジップライン チュートリアルを実行しようとしていますが、動作しません。これが問題です:

dma = DualMovingAverage()
results = dma.run(data)

以下を返します。

data msgpacks aren't distributed with source.
Fetching data from Yahoo Finance.
data msgpacks aren't distributed with source.
Fetching data from data.treasury.gov
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-11-daf3c4eec6f3> in <module>()
      1 dma = DualMovingAverage()
----> 2 results = dma.run(data)

/home/luis/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/zipline/algorithm.pyc in run(self, source, sim_params, benchmark_return_source)
    297                 trans_descr['class'],
    298                 *trans_descr['args'],
--> 299                 **trans_descr['kwargs']
    300             )
    301             sf.namestring = namestring

/home/luis/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/zipline/transforms/utils.pyc in __init__(self, tnfm_class, *args, **kwargs)
    111             # usually resolves to our super call.
    112             self.state = super(TransformMeta, tnfm_class).__call__(
--> 113                 *args, **kwargs)
    114         # Normal object instantiation.
    115         else:

TypeError: __init__() got an unexpected keyword argument 'days'

私は自分の開発用のライブラリ (pandas、scikit-learn、numpy、seaborn、mcerp などに加えて、多くの依存関係を持つ自分のライブラリ) の使用に「重い」ので、それが何か関係があるかどうかはわかりませんそれ。

それに加えて、Ubuntu (Virtual Box) VM 内で Enthought の Python 2.7 ですべてを実行しています。

この問題を解決する方法はありますか?

乾杯

4

2 に答える 2

0

" data msgpacks はソースと共に配布されません。" データがソース コードに付属していないことを示す単なる免責事項です。

それはあなたのエラーの原因ではありません。

エラーは DualMovingAverage() TradingAlgorithm の宣言にあるようです。「日」の代わりに start_time と end_time を使用する必要があるかもしれません... 私はデータ フェッチャーで zipline のビルドを使用しません。代わりに、自分で pandas でデータを取得し、正しい形式で zipline に渡します。(列としての銘柄記号、行としてのタイムスタンプ、値としての価格データ)

run メソッド (アルゴで実際に作業を行うメソッド) の zipline ソース コードから:

def run(self, source, sim_params=None, benchmark_return_source=None):
    """Run the algorithm.

    :Arguments:
        source : can be either:
                 - pandas.DataFrame
                 - zipline source
                 - list of zipline sources

           If pandas.DataFrame is provided, it must have the
           following structure:
           * column names must consist of ints representing the
             different sids
           * index must be DatetimeIndex
           * array contents should be price info.

    :Returns:
        daily_stats : pandas.DataFrame
          Daily performance metrics such as returns, alpha etc.
    """

http://zipline.readthedocs.org/en/latest/_modules/zipline/algorithm.html

http://zipline.readthedocs.org/en/latest/zipline.html

于 2014-06-19T16:12:17.527 に答える
0

ルイス、

パッケージを調べ始めたところです。この講演による私の理解http://www.youtube.com/watch?v=RntTy7-ZHt0 Pandas、Scikit-Learn、Numpy は問題を引き起こさないはずです。実際、王子のデータには Panadas を使用しています。

また、クイック スタート ビデオがある Dan Dunn YouTube サイトへのリンクもあります。 http://www.youtube.com/channel/UC606MUq45P3zFLa4VGKbxsg

ダグラス

于 2014-02-12T12:11:27.853 に答える