In one of our recent articles we’ve talked about most popular backtesting platforms for quantitative trading. Here we are sharing most widely used Python libraries for quantitative trading.
Python is a free open-source and cross-platform language which has a rich library for almost every task imaginable and specialized research environment. Python is an excellent choice for automated trading when the trading frequency is low/medium, i.e. for trades which do not last less than a few seconds. It has multiple APIs/Libraries that can be linked to make it optimal, cheaper and allow greater exploratory development of multiple trade ideas.
Below is a brief description of some of the important Algo Trading related libraries available for Python:
Event-driven library which focuses on backtesting and supports paper-trading and live-trading. PyAlgoTrade allows you to evaluate your trading ideas with historical data and see how it behaves with minimal effort. Supports event driven backtesting, access of data from Yahoo Finance, Google Finance, Ninja Trader CSVs and any type of time series data in CSV. The documentation is good and it supports TA-Lib integration (Technical Analysis Library). It outperforms other libraries in terms of speed and flexibility, however it’s biggest drawback is that it doesn’t support Pandas-object and pandas modules.
Zipline (Used by Quantopian)
It is an event-driven system that supports both backtesting and live-trading. Zipline is currently used in production by Quantopian – a free, community-centred, hosted platform for building and executing trading strategies. Zipline is well documented, has a great community, supports Interactive Broker and Pandas integration. At the same time, since Quantopian is a web based tool, cloud programming environment is really impressive. However, Zipline is slower compared to commercial platforms with backtesting functionality in a compiled application and isn’t very convenient for trading multiple products.
Vectorized backtesting framework in Python / pandas, designed to make your backtesting easier — compact, simple and fast. It allows user to specify trading strategies using full power of pandas while hiding all manual calculations for trades, equity, performance statistics and creating visualizations. Resulting strategy code is usable both in research and production environment. Currently only supports single security backtesting, Multi-security testing could be implemented by running single-sec backtests and then combining equity. The developers are working to get include multi asset backtest capabilities.
It is a vectorized system. A python project for real-time financial data collection, analyzing and backtesting trading strategies. Supports access of data from Yahoo Finance, Google Finance, HBade and Excel.
TWP (Trading with Python)
TradingWithPython library is again a Vectorized system. It is a collection of functions and classes for Quantitative trading. It includes tools to get data from sources like Yahoo Finance, CBOE and Interactive Brokers and often used P&L benchmarking functions. The documentation and course for this library however costs $395.
As mentioned above, each library has its own strengths and weaknesses. Based on the requirement of the strategy you can choose the most suitable Library after weighing the pros and cons. Watch webinar on ‘Automated Trading in Python’ and learn how to create and execute a quant strategy in Python.