Quantopian’s zipline - a Pythonic Algorithmic Trading Library – is a powerful platform for creating automated trading algorithms. Algorithms almost always have tuning parameters that control the entry or exit rules for trades.
As an example, a trading algorithm using Bollinger Bands (referred to as BBANDS) has three free parameters. The first is an integer time period for the look-back. The other two are floating point numbers for the “up” and “down” deviation for the trading signal. To optimize such an algorithm using a grid scan to explore all combinations is an immense task.
Currently, neither Quantopian nor zipline offer a built in method of optimizing tuning parameters.
Quantopian’s blog entry on this problem listed a few alternatives, one of which is the Spearmint Bayesian Optimizer open source tool kit. The results to me were very impressive.
Read more to see how I did it