trying to interpret results of 'Getting Started Test'

62 views
Skip to first unread message

Jake Seltz

unread,
Aug 17, 2015, 11:45:39 PM8/17/15
to Zipline Python Opensource Backtester
new user here--

I installed and ran the getting started command :
run_algo.py -f dual_moving_average.py --symbols AAPL --start 2011-1-1 --end 2012-1-1 -o dma.pickle
 
I was unable to find run_algo.py when inserting python in front.. not sure the issue there. Anyways, in ipython, I then run :


import pandas as pd

pd.read_pickle('dma.pickle')


here is a sample of my output:



there is no data in orders. I think there is something wrong.


I'm wondering if anyone has written up anything on how to interpret results of a zipline run? Also, what do you see in the results when you run 'getting started'.



Thanks for helping me get set up!




John Ricklefs

unread,
Aug 18, 2015, 7:53:36 PM8/18/15
to Zipline Python Opensource Backtester
Hi Jake,

Welcome to Zipline!

The way I think of the output of zipline is of a series of snapshots of your algorithm's performance after each time period. In the example you're running, the time period is based in days, so each row of that pickled dataframe is how your algorithm is doing on each day. Internally, zipline's Trading Algorithm class is structured as a python generator that consumes your data source, runs your functions, and yields a dictionary of performance information (we usually refer to them as 'perf packets') after each bar. Thus, this pickled DataFrame is a collection of those perf packets, one per row.

By example, if you were to run a backtest on quantopian.com and watch the chart grow as the backtest progresses, your browser is simply receiving those perf packets and displaying them to you in a fancy chart.

As for why your output looks so ... bland ... it's a quirk of the dual_moving_average.py sample. If you look at the algorithm code you'll see that for the first 300 days, handle_data is set to simply `pass`. This is so that the 300-day moving average can populate. Since your run_algo.py parameters specify fewer than 300 trading days, your algorithm's not actually doing much. Try stretching your start/end dates out to two years and you should see a lot of activity after 300 trading days.

Hope that helps!

Cheers,
--John "JD" Ricklefs
Director of Engineering @ Quantopian
Reply all
Reply to author
Forward
0 new messages