Over the last couple of years, there has been a steep rise in the number of platforms that sell “algos” or programs that trade strategies automatically on a client’s behalf. Some of these platforms claim that their algos have generated extraordinary returns in the past and can do the same in the future — all you have to do is click a button. The first thing to remember is that there is no easy way to make money, and if something seems too good to be true, it probably is, and it will very likely cause you to part with your hard-earned money.
While these platforms still seem small in terms of revenue and users, the lure of easy profits can quickly make them grow bigger. A number of such platforms have also been using the names of brokers without their consent, including Zerodha’s, alongside their offerings. They have started attracting regulatory scrutiny. We thought this is an appropriate time to post an explainer with everything you need to know about algo trading and such platforms selling automated trading strategies.
What are algos?
In stock market terminology, algos or algorithms are software programs that can collect data for a trading strategy, backtest the strategy to see the P&L historically, and, if required, also automatically trade whenever the strategy generates a buy or sell signal.
For example, assume you have a simple strategy to buy a stock if the stock price goes above its 20-day moving average and sell if it goes below the moving average. If you don’t use a program, you will have to manually look at the charts to figure out the P&L of this strategy in the past and then track the charts for the buy and sell signals. Doing this manually is tough and almost impossible to scale since tracking beyond a couple of charts manually is impossible.
Instead, a program, or algo, can be used to do this automatically. A strategy can be coded using a programming language or with platforms that allow non-programmers to build strategies with zero or little coding. Such algos can be connected to a dataset to backtest the strategy across many stocks automatically. They could then monitor live market data and generate alerts whenever a buy or sell signal is generated, and with fully automated algos, even automate the order placement completely.
Fetching data (market data or order/position data) as an input to an algo and then placing an order automatically when trading signals are generated can be achieved in a couple of ways.
- The hacky but the most prevalent way this happens is with “scraping” utilities that consume data by reverse engineering data flowing through broker trading platforms and push to tools such as Amibroker, Metastock, Python programs or Excel etc., as an input for the strategy. There is no dearth of third party automation tools that plug into these platforms to place orders automatically on a broker’s trading application, again, through reverse engineering, when a strategy gives a buy or sell signal. This is essentially using automation tools (sometimes called “macros”) to automate software running on a customer’s computer screen. Instead of a human user moving the mouse and clicking the buy or sell button, a program could simulate the mouse movement to click them. There are off-the-shelf products available to automate broker trading platforms, commonly called “bridges”.
- The other way is by using machine-readable APIs (Application Programming Interface) if a broker offers them. Here, there is no reverse engineering involved. All interactions, for instance, programmatically pulling one’s own order and position books for analysis or placing orders in machine-readable formats, is via officially offered API channels.
Algos in the Indian context
If you are using algos to backtest strategies or generate manual alerts, the only regulation you need to be concerned about is the exchange data vending regulation. A brokerage firm is allowed to provide data only to their trading customers for free. If you consume data from any broker, you can’t republish this market data without exchange approvals. But if an algo is used to automate order placement completely, that is, there is no human involvement in clicking a buy or sell button on the screen before order placement, the regulations explained below come into play.
Algos offered by brokers
If a brokerage firm offers a discretionary algo (one that decides when to buy or sell based on a strategy) that is hosted and managed by the broker, the algo needs exchange approvals. This is applicable if the algo is used by the broker for their own proprietary trading (prop) or if it is offered to customers. When the broker offers such an algo, the algo or the program runs on the broker’s systems and not on the customers’. Whenever the algo generates a signal, an order automatically gets fired on the customer account with no human involvement from either the broker or the customer.
If the trading strategy is latency-sensitive or if the execution speed can help improve performance, such algos can run in the exchange colo (co-location). Typically, a brokerage firm runs the servers that host these strategies and their back-end execution management systems in their data centres that connect to the exchange via leased lines, which can reduce execution speed. But by being in the colo within the exchange’s infrastructure, algos can get a considerable speed advantage. Such strategies that are speed-sensitive and typically fire a lot of orders are called HFTs (High-Frequency Trading strategies). An example of HFT strategy is price arbitrage, where the price difference of a stock is monitored on NSE and BSE and at a certain threshold, sell on the exchange where the price is more and buy where it is less, and then reverse the trade as soon as the difference reduces. While the profit per trade can be pretty low, HFTs generally rely on large volumes of trades to generate returns.
By the way, when I talk about latency (delay in execution), internet-based trading typically is measured in milliseconds (1/1000th of a second) and on colo in microseconds (1/1000000 of a second). That is, the speed of order execution of an internet-based trading platform offered by a broker can be hundreds of times slower than an HFT running in a colo.
Having said that, such speeds are needed only for certain arbitrage or market-making strategies. Colo is also an expensive and complex setup, so retail investors rarely participate, and only institutions generally run algos inside exchange colo.
Algos offered by brokers need exchange approval. Today, exchange approvals involve an auditor carrying out checks to ensure that the risk management checks and order limit checks are in place. The reason for this is because these run at the broker’s end, and they carry a systemic risk, especially if they are HFTs. By systemic risk, I mean algos misfiring large orders that can cause large market movements or a large number of orders that can choke the exchange systems. Brokers aren’t allowed to offer such strategies to retail customers. The brokers who offer such algos require customers to become an authorised person or a corporate entity, create a dealer terminal with necessary approvals and only then allow automated trading. All orders that are placed through broker algos also get tagged as an algo at the exchanges.
Algos created and run by customers
Tech-savvy customers with programming knowledge have been automating their trades using automation tools from the time internet trading started. Any savvy computer programmer can easily build a utility that scrapes data from any broker’s web, desktop, or even mobile trading platform (essentially any software that runs on the client’s computers) and then use automation tools (macros) to place orders automatically at their discretion. It is impossible for a broker to find out if a customer is using automation tools on their computers or not, whether a buy or sell button was clicked by a human or a macro. However, anomalous activity can be detected, for instance, unusual patterns and rates of orders coming from a customer.
Zerodha (Kite Connect) and many other online brokers allow customers programmatic access via API to their own accounts. Tech-savvy customers can use these APIs to consume machine-readable data; for example, they can read their portfolios for analysis and place orders. Since APIs are meant for computer programmers primarily, unsurprisingly, less than 0.05% of our customers use APIs, and an even smaller fraction use them to place orders. API access to one’s accounts has been standard practice in developed markets for decades, although it is a more recent phenomenon in India.
As I said earlier, it is impossible to determine if an order from a customer was placed by them, someone on their behalf, or by a program running on their computer. Currently, regulations don’t recognise algos that run on customers’ computers. Even if there were regulations, it is impossible to regulate or enforce what customers run on their computers or whether a human or a program is clicking buy or sell buttons on a trading platform on a customer’s computer.
Risk of automation at a customer’s end
When a customer uses official APIs offered by the broker or third-party automation tools to connect to a broker’s trading platform, all the risk management checks that apply to the standard internet trading platform apply automatically. The interactions pass through the Exchange-approved Internet-based trading platform anyway, irrespective of automation. There is no systemic risk here. HFT-like behaviour is also not possible given the high latency of the internet compared to colo along with broker placed order rate limit checks. The risk here is limited to an individual customer making uninformed trading decisions with or without automation.
This is in stark contrast to algos that brokers host and run in their data centres or at Exchange colo, where there may be a systemic risk. In any case, the speed of execution of internet-based trading platforms makes automating using third-party automation tools or APIs infeasible for any strategies that are latency (speed) sensitive or need to fire a large number of orders.
A common misconception conflates algos with APIs. While algos are meant for trading, APIs are universal means to do machine-readable interactions with a system. For instance, there are popular portfolio analysis and tax reporting tools built on top of Zerodha’s Kite Connect APIs that help customers import their portfolio data and generate analysis and reports with a single click. This is a far more extensive use case of APIs than placing orders.
Algos offered by unregulated online platforms
As I mentioned in the beginning, we have seen a significant increase in platforms that offer off-the-shelf algos and strategies that claim to make profits over the last couple of years. This is in conjunction with the rise of unregulated financial platforms that also heavily advertise on TV and social media. Typically, these platforms show cherry-picked backtested returns and then give a one-click option to subscribe to a strategy and connect the algo to their trading accounts with many popular brokers.
In terms of market risk, these platforms don’t really bring any systemic risk. All orders, as I said earlier, typically go through the same risk management checks as manual orders, as these tools generally just latch onto a broker’s internet-based trading platform. But there are a few other risks that everyone needs to be aware of.
- Concentration risk — If too many people subscribe to the same strategy and if the strategy fires automated orders on a large number of customer accounts simultaneously, this can potentially cause volatility in the markets, especially in contracts or stocks with low liquidity.
- Strategy misfiring — These strategies are off-the-shelf programs offered by 3rd party vendors. The lure of one-click financial returns means there may be a large number of non-savvy users subscribing to these offerings. So for most users, this is a black box where you can’t see what is happening behind the scene. A program can face technical glitches that can get it to misfire orders causing losses for the customer. Since these are unregulated platforms, there is no easy legal recourse either.
- Mis-selling risk — Today, such 3rd party algo platforms aren’t regulated. Backtested returns shown could potentially be manipulated to lure the customer. Even otherwise, backtested returns in many cases don’t consider the impact and trading costs which, if considered, can significantly alter the P&L. Since these strategies can potentially generate more trades and higher brokerage, there is also a risk of the employees of brokerage firms who have revenue targets luring you to subscribe to them without disclosing all the risks.
There has been an increase in the number of these 3rd party algo platforms popping up displaying our logos alongside other brokers. We DO NOT have any partnerships with any of these platforms which offer algos that can automatically trade on a customer’s behalf. If any of them claim to be our partners, they are misleading you. We have been actively asking these platforms to remove any ambiguous mentions of any sort of association with our brand from their websites.
In a technology first world, where we are constantly talking about commoditising access and products, API access or machine readability to one’s accounts should not be privy to a select few. Everyone who wants to should be able to get access to it. Currently, there aren’t any regulations around providing customers access to their trading accounts through APIs. Maybe it should be introduced so that there is no regulatory arbitrage. A simple example is (non-machine-readable) PDF contract notes that are essential for tax filing. Parsing and importing hundreds of such PDFs at the end of the financial year is exceptionally tedious and error-prone. We created machine-readable contract notes that can be imported into tax filing programs via APIs with a single click, a big benefit to our clients.
While there is no systemic risk that these algo trading platforms bring to the markets, they still create financial risks, the biggest one being mis-selling. These platforms may need to be brought under some regulations so that there is accountability. If unchecked, there is a risk of these platforms becoming large by mis-selling and not disclosing the risks, which can, in turn, cause losses to retail customers. The recent phenomenon of the rising number of advertisements for various unregulated financial products may be a sign.
Concerning regulations, I guess these platforms already come under the purview of the current RIA/RA regulations, especially because they collect a fee. RIA (Registered Investment Adviser if you are giving client-specific advice) and RA (Research Analyst) if the advice is for a group of customers. Subscribing to an off-the-shelf algo created by another person that generates a buy/sell signal is very similar to subscribing to a human who tells you when to buy or sell. These platforms probably fit better under the RA framework, which is easier to comply with as well. Explicit regulations will also help these platforms grow without the fear of any regulatory uncertainty.
The 3rd party automation tools that customers run on their computers can’t be monitored or regulated. It is also impossible to regulate or stop all automation tools (bridges) from being distributed for free or sold on the internet. While these may not bring any systemic risk, but platforms that use such bridges to sell automated trading strategies pose the risk of misselling and inducing investors to make poorly thought out trading decisions. They should maybe, like explained above, be brought under the RIA/RA ambit.
I just want to remind everyone once again that there isn’t an easy way to make money when trading the markets. While an algo will not be influenced by fear or greed like a human being, markets are super-efficient. If there is an algo or strategy that can make money, enough people will quickly spot it, and soon it stops becoming effective. Another downside of algos is overtrading. A string of 10 trades where you neither make nor lose money could still potentially lose you over 10% just in trading and impact and tax costs, which typically most algo platforms don’t consider when displaying their back tested returns.
If you are interested in coding your technical analysis strategies and backtesting and visualising the P&L without any programming knowledge, check out https://www.streak.tech (a Rainmatter portfolio company). It obviously does not automate order placements; only alerts are generated whenever the strategy generates a buy or sell signal.
If you decide to use strategies built by another person, remember to consider the risks involved and only allocate a small portion of your capital towards them. This is akin to listening to someone else’s financial advice.
Hopefully, this gives you a clearer picture of retail algos and to take better trading decisions.