Back to Community
Rolling Period Backtests

I would like to test my algorithm based on a series of rolling timeframes, similar to what cfiresim does.

For a time frame with length N days, find the returns for all timeframes with length N between dates A and B

For example.
N = four years of trading days
A = 2001
B = 2010

The analysis would run the backtests for the following time periods:

2001-2004
2002-2005
2003-2006
2004-2007
2005-2008
2006-2009
2007-2010

This seems trivial to implement if I was able to:

call my algorithm with (starting time, ending time, starting capital)
and have it return a few relevant items to me such as (alg returns, benchmark returns, volatility, max drawdown, etc)

I'm a python noob (and new to quantopian). I kind of seems like the tearsheet analysis does some of what I'm looking for. Is it possible to use a notebook to "call" an algorithm for a specific time period using the tearsheet method some how? and have specific outputs stored into an array for processing later?

1 response

Hi Scott,

There is no way to call an algorithm with (starting time, ending time, starting capital), but you can simply run the set of backtests by tweaking the settings manually (note that backtests run in parallel, so you can just launch one right after the other). Then, you can pull the data into the research platform, using get_backtest (each backtest would be pulled in individually). With a little fiddling, you should be able to extract the values of interest from each set of backtest data. Or, since you are a "python noob" (and this is the way I would approach things first-pass), you could simply run a tear sheet on each backtest and jot down the parameters of interest in a spreadsheet.