Zipline data msgpacks aren't distributed with source -algo trading

389 views Asked by At

I am trying to run a simple zipline tutorial to test a trading algorithm in GOOG, and can't get it to work. This is the problem:

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

Returning the following:

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'

I am 'heavy' in the use of libraries for my dev (pandas, scikit-learn, numpy, seaborn, mcerp, etc. plus my own libraries with many dependencies), so I don't know if that has anything to do with it.

In addition to that, I am running everything in Python 2.7 from Enthought, inside a Ubuntu (Virtual Box) VM.

Any help out there in how to fix this issues?

Cheers

2

There are 2 answers

0
PabTorre On

" data msgpacks aren't distributed with source." is just a disclaimer telling you that the data doesn't come with the source code.

that's not the source of your error.

the error seems to be on your declaration of the DualMovingAverage() TradingAlgorithm. maybe you need to use start_time and end_time instead of "days"... I don't use zipline's build in data fetcher, instead I prefer to get the data in pandas myself, and then pass it into zipline on the right format. (stock symbols as columns, timestamps as rows and price data as values)

From the zipline source code fo the run method (the method that actually does the work on the algo) :

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

0
user3055920 On

Luis,

I'm just starting to look into the package. My understanding according to this talk http://www.youtube.com/watch?v=RntTy7-ZHt0 Pandas, Scikit-Learn, Numpy should not cause issues. In fact it is using Panadas for prince data.

Also, here is a link to Dan Dunn YouTube site which has a quick start video. http://www.youtube.com/channel/UC606MUq45P3zFLa4VGKbxsg

Douglas