Quantopian zipline trading algorithm parameter optimization with Spearmint Bayesian Optimizer - Part 1

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

Winning Quantopian Morningstar data Fundamentals algorithm


In late 2014, Quantopian – the pythonic trading platform - made available programmatic access to fundamental data from Morningstar.  Python trading algorithms can use this data in trading logic.  To introduce the community to the use of this data, developers were invited to submit algorithms exploring this new avenue.


My python trading algorithm submission “Using #Fundamentals to identify uptrending volatile small caps”  was one of seven selected by Quantopian as best showing use of this data.


Read more…


Subscribe to RSS - zipline