Figuring out what dependencies are needed

alex23 wuwei23 at gmail.com
Thu Dec 12 00:48:42 EST 2013


On 11/12/2013 10:44 PM, sal at nearlocal.com wrote:
> I'm a Python beginner.  I want to use it for stats work, so I downloaded Anaconda which has several of the popular libraries already packaged for Mac OS X.
>
> Now I'd like to use the backtesting package from zipline (zipline.io), but while running the test script in iPython, I receive the following error:
>
> AssertionError                            Traceback (most recent call last)
> <ipython-input-6-f921351f78e2> in <module>()
> ----> 1 data = load_from_yahoo()
>        2 dma = DualMovingAverage()
>        3 results = dma.run(data)
>
> 1)  I assume that I'm missing some packages that aren't included in Anaconda, but how do I know which ones to upload?

You're not missing a package, you're missing parameters. This is the 
signature for load_from_yahoo:

     def load_from_yahoo(indexes=None,
                         stocks=None,
                         start=None,
                         end=None,
                         adjusted=True):

The first thing it does is call a helper function 
`_load_raw_yahoo_data`, which has this assertion:

     assert indexes is not None or stocks is not None, """

As you're passing no parameters into `load_from_yahoo`, both `indexes` 
and `stocks` default to None, so the assertion fails. Take a look at the 
examples in the zipline library to see what it is expecting.
> 2)  Often I'll just unzip a library file and put the main folder in the iPython folder, but I notice there's usually a setup.py file in the main library folder.  I've been ignoring this.  Should I be using it?
>
> Thanks
>




More information about the Python-list mailing list