Sign up ×
Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. It's 100% free, no registration required.

Except Zipline, are there any other Pythonic algorithmic trading library I can choose? Especially, for backtesting?

share|improve this question
What does your employer currently use? –  chrisaycock Sep 6 '13 at 13:08

8 Answers 8

up vote 11 down vote accepted

Aside from Zipline, there are a number of algorithmic trading libraries in various stages of development for Python.

From the commercial side, RapidQuant looks very interesting though I haven't tried it yet. It's from some of same developers that brought us the excellent Pandas data analysis library. I think Wes McKinney (Pandas's main author) is involved.

From the open source side, you might check out ultra-finance. It aims to be a fully featured event-driven based backtesting system.

Also check out PyaAlgoTrade. It's coded to allow for distributed testing of strategies on Google's cloud infrastructure. It incorporates the open source TA-Lib technical analysis library.

Finally, take a look at TradeProgrammer. It also uses the TA-Lib library. The package is free to use for backtesting, but its live trading version is commercial.

Aside from that, I think that many proprietary traders build their own systems. There is definitely something to be said for using a tool you understand on that level.

share|improve this answer
Which one you would recommend? –  Terence Ng Sep 9 '13 at 5:57
Zipline is an equity backtester only. What can I do if I want to use it in Currencies and Futures? Which one I can choose? Do I have to select an library and modify the code myself? –  Terence Ng Sep 11 '13 at 7:32

possible update:

based on

both were easily installed and somewhat usable for a novice. would love some examples other that github documentatiion

share|improve this answer

You can check also QSTK

It's an open source library developed by Georgia Tech and used in a Computational Investing course.

share|improve this answer

I have also been searching for algo trading in Python.

According to my findings:

  • there are many such librairies available, open-source or proprietary,

  • they are all built quite specifically. as a result, when you know how to use one, it is the only one you are able to use.

  • their stage of development is quite heterogeneous and future uncertain, eg what did happen to cite above?

  • no such library is well off and outperforming all other competing librairies.

With all the above, I would rather build my own tools as suggested above by someone else.

share|improve this answer

There is a module called visualize-wealth that provides:

  • Documentation auto-generation capability with sphinx
  • Portfolio construction methodologies in 3 ways (trade blotter, weight allocation frame, and static allocation series)
  • All basic statistical measures, including many sophisticated ones such as CVaR, Mean Absolute Tracking Error, Cornish Fisher Approximation (to incorporate skew and kurtosis), correlation structure preserving algorithms, Appraisal & Information Ratios, and M^2 (to name a few)

    NOTE: The sphinx documentation renders into MathJax equations with clickable links and papers around more academic concepts

  • Excel file with manual calculation to most of the analytical calcs, allowing the user to dig into the manual calculations if they should like (the results of this file are actually used as the data to test the module calcs)
  • Utilities to work with Yahoo!'s API as well as HDFStores, to construct portfolios from
  • Classification algorithms to determine the "likely asset class" of a time series, to enable asset selection and tactical allocation attribution functionality.

FULL DISCLOSURE: I am the developer of the visualize-wealth module and have been building it entirely on my own for the past 14 months.

share|improve this answer

A (now) very mature (imho) Python backtesting framework is "backtrader":

Blog posts with samples and new developments:

The documentation on readthedocs can be reached from any of the above links

Some features:

  • Can run in (pseudo)event-mode (called 'next') or (pseudo)vectorized mode (called 'runonce')

    • In "next" mode it can also be configured to work in "exactbars" mode which will keep memory consumption to the minimum (disabling plotting along the way)
  • Order/Trade notification to strategies (this obviously is always an event)

  • Supports CSV (some specific sources and a Generic CSV loader) binary sources (VisualChart, Pandas, Blaze) and online (Yahoo Finance Data)

  • Data Resampling and Data Replaying

  • Mix datas of different timeframes (including a data and its "resampled" counterpart)

  • Multi-Asset capable

  • Multi-Strategy capable

  • A fine (imho) broker implementation supporting stocks-like and futures-like (with margin) instruments with user implementable commission schemes if needed.

    The nicest part is cash adjustment for future-like instruments on each bar

  • Has a comprehensive list of implemented indicators

  • A few analyzers (AnnualReturn, Sharpe, TradeAnalyzer)

  • Can optimize strategies and use multiple cores for the task

  • Plotting support via Matplotlib (>= 1.4.1) with a high degree of configurability and flexibility (plots look nice)

  • A text writer for console output of data points (csv) and datas/strategies/indicators/analyzers summaries

  • Heavy use of metaclasses and operator overloading in order to implement ease of use and a declarative expression approach for the strategy/indicator logic and implementation

  • Works with Python 2.7 / 3.2 / 3.3 / 3.4 / 3.5

The framework has only one compulsory dependency: six (for Python 2/3 compatibility although it could for sure be removed)

Disclosure: I am the author having worked during 2015 on this as a hobby project but aiming at making it as feature complete and professional as possible

It is of course left to the reader to decide if the aforementioned statements and goals have been reached

As mentioned by edouard each framework has its own quirks and I actually started this after toying around with pyAlgoTrade and not really liking the API, which is of course a matter of personal taste.

share|improve this answer

You can have a look at :

TradingWithPython library (TWP Library)

Like Quantopian / Zipline it uses Python Pandas library.

It includes an Interactive Brokers module to trade realtime.

share|improve this answer

Trying to start framework which allows lots of flexibility.

share|improve this answer
How do you know this framework? do you use it? did you write it? –  SRKX Feb 10 at 5:23
Yes - work in progress. First doing historical analysis of trades so no opinion about how simulation is implemented. (Up to user) Attempting to modularize components for simple usage in other frameworks. Still in alpha but within 2 months should be hardened and in production. Bloomberg API alone is worth a look if you use this data. Also looking for contributors or open source partners to create a framework usable in ipython by novices. –  Brian Smith Mar 14 at 3:05
Then you should include these inside your answer, stating very clearly that you're part of the project. –  SRKX Mar 16 at 1:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.