We are going to cover the most popular Python Trading Platforms in this article. 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 trading platform and 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 in case of low/medium trading frequency, 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.
Algo Trading related libraries available for Python
An 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 the 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-centered, 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.
You can check the following link to know more about Zipline
Vectorized backtesting framework in Python/pandas, designed to make your backtesting easier — compact, simple and fast. It allows the user to specify trading strategies using the 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 to 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.
Trading on Interactive Brokers using Python
Interactive Brokers is an electronic broker which provides a trading platform for connecting to live markets using various programming languages including Python. It provides access to over 100 market destinations worldwide for a wide variety of electronically traded products including stocks, options, futures, forex, bonds, CFDs and funds. IB not only has a very competitive commission and margin rates but also has a very simple and user-friendly interface. Here we will discuss how we can connect to IB using Python.
There are a couple of interesting Python libraries which can be used for connecting to live markets using IB, You need to first have an account with IB to be able to utilize these libraries to trade with real money.
It is an easy to use and flexible python library which can be used to trade with Interactive Brokers. It is a wrapper around IB’s API which provides a very simple to use solution while hiding IB’s complexities. To learn to utilize this library you can check out the following links
IBPy is another python library which can be used to trade using Interactive Brokers. Details about installing and using IBPy can be found here:
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.
Free and Open Source Python Platforms
Listed below are a couple of popular and free platforms that can be used by Python enthusiasts in algorithmic trading.
Quantiacs is a free and open source Python platform which can be used to develop, and backtest trading ideas using the Quantiacs toolbox. Quantiacs provides free and clean financial market data for 49 futures and S&P 500 stocks up to 25 years.
You can develop as many as strategies as you want and the profitable strategies can be submitted in the Quantiacs algorithmic trading competitions. At Quantiacs you get to own the IP of your trading idea. Quantiacs invests in the 3 best strategies from each competition and you pocket half of the performance fees in case your trading strategy is selected for investment.
You can check the following links to know more about the Quantiacs platform
Similar to Quantiacs, Quantopian is another popular open source Python platform for backtesting trading ideas. Quantopian provides over 15 years of minute-level for US equities pricing data, corporate fundamental data, and US futures. Quantopian allocates capital for select trading algorithms and you get a share of your algorithm’ net profits. Quantopian also has a very active community wherein coding problems and trading ideas get discussed among the members.
Upcoming AMA Session
Do you have any questions about Algorithmic or Quantitative trading?
Join us for the upcoming Ask Me Anything Session on Tuesday, 5 December 2017
7:30 PM IST | 9:00 AM ET | 10:00 PM SGT
We, at QuantInsti, bring you this exclusive AMA session with our top boss. You are free to ask him all your queries pertaining to the sector. Going by experience and the feedback we receive from our course participants, your doubts shall be done away in no time.
Click here to register now!