Quantitative investment strategy: several common Python back-testing frameworks (libraries)
Original address: http://blog.csdn.net/lawme/article/details/51454237
This article is reproduced in the article. This time in the study of quantitative strategy direction, studied zipline for some time, but the follow-up found he only support U.S. stocks, collect quantitative strategy articles, reproduced in the blog.
The quantitative trading strategy must be backtesting before real trading. Here, we evaluate the commonly used Python backtesting framework (library). The scale of the evaluation includes the scope of use (backtesting, virtual trading, real trading), ease of use (good structure, document integrity) and extensibility (fast, simple to use, compatible with other framework libraries).
- Zipline: Event-driven backtesting framework. Quantopian is using it.
- Zipline has a large community, complete documentation, strong support for the well-known brokerage firm interactive Broker (IB), integrated pandas, clear grammar, easy to learn and master.
- There are a lot of routines examples. If you are primarily trading US securities, it is the best option. Quantopian allows backtesting, sharing, and discussing trading strategies in their communities.
- However, according to our experience, the speed ofZipline is very slow. This is its largest short plate. Quantopian some countermeasures, such as running in parallel in the cloud. If you are interested, you can read this blog post.
- Zipline seems difficult to use local data files and non-American data.
- It is difficult to use for different kinds of financial assets.
- Pyalgotrade: is also an event-driven backtesting framework that supports both virtual and real-time transactions. The document is complete and integrates the Ta-lib (Technical Analysis Library). In terms of speed and flexibility, it is stronger than Zipline . However, one of its major mishap is the modules and objects that do not support Pandas.
- pybacktest: It is a very simple and lightweight method of backtesting with vector data. May 21, 2015, the project has a resurgence of signs.
- Tradingwithpython: This jev Kuznetsov expands pybacktest to form its own backtesting program. This library seems to have been updated in February 2015. However, the relevant documentation and course prices are $395.
- Other Items: ultra-finance
|
Zipline |
Pyalgotrade |
Tradingwithpython |
Pybacktest |
Type |
Event-driven |
Event-driven |
Vector processing |
Vector processing |
Community |
Larger |
So so |
No |
No |
Cloud computing |
Quantopian |
No |
No |
No |
Support IB |
Is |
Whether |
Whether |
Whether |
Data source |
Yahoo, Google, NinjaTrader |
Yahoo, Google, NinjaTrader, Xignite, Bitstamp provide data in real time |
|
|
Document |
Complete |
Complete |
$395 |
Rarely |
Events can be customized |
Is |
Is |
|
|
Speed |
Slow |
Fast |
|
|
Support Pandas |
Is |
Whether |
Is |
Is |
Trading Calendar |
Is |
Whether |
Whether |
Whether |
Support Ta-lib |
Is |
Is |
Is |
|
Suitable for |
For US securities Trading only |
Real Trading Virtual Disk Trading |
Virtual Disk test Transaction |
Virtual Disk test Transaction |
Comparison of Zipline and Pyalgotrade score
  |
zipline |
pyalgotrade |
description |
Virtual disk trading |
" |
? ? ? |
zipline does not seem to work with non-US data and local data, and Pyalgotrade can use any type of data |
Real trading |
?? |
? |
Both are good, but Quantpian's cloud computing programming is good |
flexibility |
?? |
?? |
pyalgotrade supports a variety of advanced orders and has more business events. Zipline provides a simple slippage mode |
speed |
? |
?? |
zipline slower than Pyalgotrade |
Ease of use |
??? |
? |
pyalgotrade not supported pandas |
Quantitative investment strategy: several common Python backtesting frameworks (libraries)