In this article series so far, we have learnt about the basics of algorithmic trading, and the essential skills required to venture into the algorithmic trading domain.
The next logical step would be to understand how to automate your trading strategies. In our first article, we explained the benefits of automating one’s strategies. Automation helps a trader by improving the speed and accuracy of execution, enhances scalability, brings in higher discipline, opens up a wider range of strategies that one can build, and enables the use of more advanced techniques and methods with potentially higher predictability.
If you've been trading, it would be beneficial to transform your strategy into an easily programmable rule-based strategy or into a well-researched and tested quantitative method that can probably be much more efficient, effective and dependable. Automation can help with that. So, in this article, we’ll be focusing on, “How to automate your algorithmic trading strategies?”
So, how do we go about that? What follows are the various steps or if I may as well call it “an execution pipeline” to automate your algorithmic trading strategies.
Getting the data: You’ll need access to market data for validating your strategy hypothesis, back-test, and to execute your strategy in real markets. For historical data, you can get it from the exchanges, data vendors or from the financial portals that give access to historical market data. For real-time market data, you can get it from your broker for free or at a nominal cost. In case you prefer not to take the data from your broker for some reason, you can also get it from the exchange/vendors.
Research: Top financial organisations spend a lot developing their proprietary algorithms mostly because of the technologies involved in making it. The good news is that with the advent of data sciences, a lot of such methods are becoming open-source, i.e. they have become easily accessible to retail and small traders, especially the ones that are being created in Python. You can use such research tools and packages in your research to come up with institutional grade ideas.
Creating your algorithm: Coding skills come in handy here. Either you should be able to program, or you can hire someone who could code or if it is a very simple strategy, you can use some of the software that can allow you to build your strategy, within the defined complexity constraints, without coding. You would be creating these strategies on a software, called ‘Algorithmic Trading Platform’, which may be offered to you by your broker or through a software vendor.
Backtesting the strategy: It is necessary to know how your trades have done in the past. Algorithmic traders spend most of their time researching and backtesting their trading strategies using historical market data and other data-sets as required by the strategy.
Market access: This is about setting up a connection with the exchange. Unless you have your own membership, you would need to access the exchange through a broker to trade. Some brokers provide APIs in Python and other programming languages to connect with them after authenticating your credentials.
Streaming live data: You can fetch live data from your broker or from exchange/vendor using their respective APIs. But one needs to check for the lag that might occur due to network latency. If you are not in co-location, it would make sense to have the server in the same datacenter as your brokers’.
Forward testing or paper trading: Next step would be to test your strategy on the real market data (but NOT in the real market!) in a demo account. Most of the algorithmic trading platforms come with a simulated environment that you can use for forward testing. This is the same as doing paper trading using real and live market data. Once you're satisfied with your trading strategy performance, you can finalise the strategy along with optimized parameters.
Sending orders: Based on the market data, your algorithm will generate trading signals. These trading signals are interpreted by the order manager of the algorithmic trading platform and corresponding buy and sell orders are placed on the exchange. It is important to do the ‘state management’ of your live orders, like checking for any unfilled orders already present and remove them if necessary before sending out a new one. Also, all your orders must go through the mandatory risk checks before they are sent to the exchange.
Regulatory approvals: Every exchange, regulator and geography have a set of rules that need to be followed before you can go for automation. In India, there are well-defined rules that are laid down by SEBI and the exchanges relating to algorithmic trading. In case you are trading through a broker, you must consult with your broker and get the required approvals before you automate your strategies using any platform.Analyze and review: Once you go live, it is very important to continue to review the performance of your trading strategy and trading system. Is the strategy performance in the real market matching the corresponding back-tested results? Are your orders getting filled at the intended price levels? Have there been changes in market microstructure and does that warrant change in your strategy or system? Your strategies should get adjusted as per the market conditions and continue to evolve to become more robust.
Algo Trading is often pictured by people as a set-it and forget-it system, which it is often not. These steps canvas what goes into executing a trading algorithm and automating your algorithmic trading strategies. Your trading results are directly proportional to the efforts you put in. Algorithmic trading won’t make you money by itself but it can help you in your journey towards the same through a systematic and efficient approach.
We will go deeper into more details in the coming articles and would hope to help you #GoAlgo.
The author is the co-founder of QuantInsti, an Algorithmic trading training institute that offers Executive Programme in Algorithmic Trading (EPAT).This article is part of a series where we will be covering various aspects of Quantitative & Algorithmic Trading, including the strategies across various asset classes, techniques, infrastructure requirements, regulations and skills required in this domain.