The Future of QTPyLib
I released the first version of QTPyLib, my Python library for algo traders, in 2016. If you had told me then that I would still be working on it three years later, I probably wouldn't have believed you. But guess what? That's precisely where I'm doing :)
The first release of QTPyLib was a basic engine for live trading using Interactive Brokers. That's it. Nothing more. Nothing less. I have developed it for my own personal use and decided to release the code on Github for whoever finds it useful.
Over time the library had more features added and it even gained a decent amount of users, but, through it all, the development lifecycle remained pretty much the same: I was adding features that were specific to my own needs and releasing them to the public.
Using this approach, I've also released several other libraries, including fix-yahoo-finance, ezIBpy, PyStore, QuantStats, and a few others, which became the building blocks in my algo research & trading ecosystem.
My vision for QTPyLib moving forward is to have it combine all of these tools, among others, into a single, cohesive tool that lets you backtest, analyze, and trade anything. This is no small task, and it will going to take some time to complete.
So... here's what's in store for the next major release of QTPyLib:
1. Brokers & Data Vendors
The most significant change in the next major version of QTPyLib is the ability to work with any broker and any market data source. This is going to be achieved by converting both the
blotter and the
broker submodules to using a standardized extension/plug-in model.
While I initially only plan to release QTPyLib with support for Interactive Brokers as a broker, I will be providing a template for anyone who wants to add support for any broker or market data source.
For those without a real-time market data subscription, I will be adding the option to use EOD data from Yahoo! finance or EOD/intraday data from AlphaVantage out of the box.
This feature alone will allow QTPyLib users to trade Stocks, ETFs, Futures, Forex and Crypto on any broker they choose (as long as they have an API).
Given the fact that QTPyLib was originally developed as a tool for live trading, I've never given the "backtesting-mode" the full attention it deserved. That's about to change.
The new QTPyLib's backtester will have a web-based progress visualizer, that, upon completion, will generate a detailed tearsheet and trade analysis - thanks to deep integration with QuantStats.
Lastly, I plan on introducing slippage and commission models to produce more realistic results.
2. Data Storage
QTPyLib will switch to use PyStore as the default storage engine. This will allow for enhanced portability and performance - especially on a single machine setup - by leveraging the power Dask and the Parquet file format.
Those wishing to use SQL databases will be able to use either MySQL or PostgreSQL, as the database access will be abstracted by using SQLAlchemy as the driver.
4. Other Changes
- New dashboard UI
- Scheduler module (inspired by Quantopian's)
- Rebalance module for easy portfolio rebalancing
- Option to submit orders as a faction of account value instead of quantity
- Support for IB sub-accounts (useful for Financial Advisors)
on_bar()event when using multi-instrument algos
- Code speedup by converting core modules to Cython
- Various other minor code improvements
- Release of video guides and tutorials
That it for now :)
If you think of anything else that might benefit others, please submit a feature request on Github, and I try to include it.
Adding this many new features will take time. My goal is to release the next version by the end of the year. This means that the beta version will probably be released around October-November, and will be released on Github.
More than anything I need help writing unit tests and converting code to Cython, but I would appreciate any help. If you're a Python developer who also trades and want to help, I would be more than happy to get you on board.
Wish me luck! :)
Updated on 16 May 2019. For the latest version, please see: