Comparing Python platforms for automated trading.
Contents
Looking at different automated trading systems available, I've decided to focus on describing why Python, backtrader, and QuantConnect are the most appropriate as of 2019.
The most well-known professional/academic platforms that quants would be using on Wall St would be either Matlab, Python or R. There are other retail platforms such as Amibroker, Wealthlab, and Tradestation. For retail, I'd highly recommend Amibroker, as I've used it many years ago. For professional & academic use, I'd recommend Python.
Python
Many PhDs are often quite worried about the job market post-graduation, especially when several are unsure of whether they would like to take the academic or industry route. There are multiple languages and software packages that one often becomes very confused. Yes, its true that languages like C, C++, KDB, or Scala are faster and more scalable for quant trading. Its true, that most software engineers need to know Java or Javascript for web development. Yes, its true that Matlab is a more robust and stable software for optimization and academic research. Yes, its true that R has more statistical packages and can often write code for financial model development in a more succinct manner. Yes, it is true that Julia is easy to read/write and is much faster than Python for machine learning and numerical optimization purposes.
Python opens up the most opportunities as it is a general purpose language that can be used to perform academic research, build webpages, be a full-stack web developer, machine learning scientist, data scientist, quant developer, quant researcher, software engineer, etc.. It combines many of the strengths and weaknesses of C, C++, R, Matlab, Julia, Java, JavaScript, etc. In the age of change, the key is not to specialize, but to be adaptable and robust for changes.
For example, this webpage is all written in a Python-based web-framework that can be extended using Mako or Jinja. The machine learning component of my website shows how Python can be used for data science applications. The finance & economics portion shows how it can be used to perform academic financial research that involves regressions, portfolio optimization, portfolio backtesting. And this page shows how Python can be used to perform automated trading.
Python trading packages
Quantopian/Zipline
Generally, Quantopian & Zipline are the most matured and developed Python backtesting systems available Quantopian basically fell out of favour when live trading functionality was removed in 2017. Although there is some mention of other Github repos creating code for live trading, I'm not sure how mature these platforms are.
Pros
Most developed/mature automated backtesting system in Python.
Powerful cloud computing capabilities available.
Many datafeeds are freely available and built into the system. Premium datafeeds are available for a subscription fee.
Open competition for trading systems means you can make some money if you win.
Cons
Locked into the Quantopian ecosystem.
Not sure if being an expert in Quantopian is necessarily transferrable to a professional job later given that you're trapped in a fairly closed ecosystem.
Live trading (zipline-live) your own systems is only availabe with Interactive Brokers and not fully supported by Quantopian.
Need to submit your code to run on the system.
QuantConnect
QuantConnect is a more sophisticated platform with cloud capability and live trading. It is sophisticated in terms of the fact that you can write your algo-trading strategy from the cloud (ChromeOS anyone?) and deploy it from there. It is the most matured and developed platform aside from Quantopian that does not allow live-trading anymore. QuantConnect also allows for cash rewards for submissions of the best performing trading systems. The only downside is that it costs you a monthly membership to perform live trading. However, to be fair, you're getting some pretty decent cloud-computing hardware and you wouldn't have to worry as much about the technical infrastructure for performing trading so I do think that you're getting a reasonable deal with this mob.
Thus, use QuantConnect if you're happy for your trading systems to be submitted on a cloud system and you'd like powerful computing hardware without shelling out for the capital cost.
Pros
Probably the second most popular cloud-based automated backtesting system available.
Live trading & powerful computing infrastructure supported for a variety of brokers at a small fee.
Cons
Locked into the QuantConnect ecosystem.
Need to submit your code to run on the system.
Quantiacs
Quantiacs is nice that allows you to easy operationalize and test a trading system/portfolio optimization strategy. Best of all, it has toolboxes for Matlab, which my PhD research was coded in, and also for Python which the next generation of quants and financial analysts will use. As of 2019, its a perfect mix of the old and new, given that most quants 40 years and above from engineering backgrounds would have been using Matlab and those 30 and below would be more familiar with Python. Also, Quantics allows the best performing algo-trading system that us submitted to be allocated a certain portion of the profits that it makes over time. It also states that you're not signing over all your IP compared to other firms like Quantopian or QuantConnect; however, I won't take those statements seriously because once you've submitted your code somewhere there's very little you can do to stop others from copying and using it. You'd have to take legal action, and prove that the work is yours which, let's face it, most people won't go through the effort to do so.
Pros
Apparently you have more IP and control over your trading system.
More money in your pocket if you win the trading system competition.
Can easily download the Quantiacs and perform your own research and backtesting locally.
Cloud infrastructure available.
Data feed for US stocks and commodities futures available.
No cost to you.
Cons
Not clear to me whether live trading capability is supported in the system.
backtrader
Backtrader is a suitable system that allows you to run backtesting locally on your machine. Datasets are not integrated into Backtrader so you will need to connect to a provider or have your own datasets. However it is very well-documented and costs you nothing to perform live trading. Furthermore it states that its used in x2 EuroStoxx and x6 Quantitative Trading firms. I like the fact that it has 2328 commits on GitHub and its most recent commit was in February 2019, which means its still in active development.
Thus, if you want a backtesting system that you can run locally on your machine, use this. It also allows live trading when you get to that point, except remember you are limited to the hardware resources you have locally.
Pros
Learning backtrader's system is a transferrable skill since it's used by a few quant firms and Eurostoxx banks.
It is very well documented and continues to have recent commits in 2019.
Live trading capability available.
Cost to you to perform live trading is zero.
Since this platform is not running on the cloud, all your code is private and you do not need to share it with anyone.
Cons
No competition money.
Only public data feeds are available.
Numerai
Numerai provides you with a clean, codified dataset to perform binary predictions. It is not clear to the user what the features or the target means, except you just focus on building a predictive model using decision trees, gradient boosting trees, etc. I would imagine that it is basically, sophisticated blackbox feature engineering because you are not informed what the features are and therefore you can't make any informed economic/relational decisions when building the model. One can say that it allows you to purely focus on model building. But is it really that important to sort of somewhat blindly perform feature engineering on datasets that you don't know anything about? I'm not sure how useful having skills to perform blackbox predictive machine-learning models is but thats just my 2 cents.
Pros
Can focus purely on machine learning and data science modelling
Win competitions based on machine learning modelling. Therefore, no knowledge of financial markets necessary.
Cons
Not sure what transferable skillsets you get out of being able to build good predictive models out of blackbox data feeds. Maybe there are companies who would like this skillset but it would be fairly limited.
Conclusion
I would select (i) QuantConnect (ii) backtrader for use in automated trading systems
- Quantconnect
-
Quantconnect allows you to participate in open competitions so you can make money that way if you so wish, however it also allows you to live trade your own systems with powerful computing infrastructure for a pretty affordable fee. So I would say that Quantconnect is one of the most flexible and matured Python backtesting systems available with cloud infrastructure.
- backtrader
-
backtrader is being used by a few quant trading firms and EuroStoxx banks. Playing around with the framework, it is very well-documented and straightforward to use. As the backtrader module is all run locally, it is a good package to learn since you can easily run your own simple automated trading systems interfacing with Interactive Brokers and Oanda. As such, it's a pretty good platform to run low-frequency automated trading such as that which runs over the period of days or months.
Comments
Comments powered by Disqus