SPDR S&P 500 ETF TRUST
Education

9 things that do not come easy when implementing Algo Trading

A collection of less obvious hurdles you may discover on the Algo trading implementation journey.

#1 Data is king

Some brokers provide basic data feed for algo trading, but more often you will be looking for:

  • Decent amount of historical data of decent quality for backtesting.
  • Real time market data. Not the end of the day, and not 15 minutes delayed. As close to real time as possible, with possibility to subscribe for data push notifications.
  • Data aggregated from multiple exchanges. If you want to make decisions (you do) based on pre- or after- market hours data, this is a must have.
  • No or reasonable limit on the number of tickers you can get data for concurrently.
  • Data on market index constituents. And ideally historical data, as constituents change, and you want to backtest our algos without “cheating” (survival bias).
  • Corporate and fundamentals data. Historical data is quite useful here as well.


Even to satisfy this short list, you need a specialized data provider or a few. For personal use it comes to a couple of hundred dollars of fees a month. It might be under one hundred if you sacrifice some requirements and data quality.

#2 Orders can be over-executed

Ever encountered a situation when your limit order and stop-loss order were executed simultaneously?

Well, it does happen. It’s much more rare when trading manually, but when a program is able to submit orders so much faster, and generate higher order flow, probability of it naturally increases.

A trading engine must be able to recognize such situations and react accordingly. I.e. calmly close the resulting short position (or long position if you are exiting a short trade).

#3 Not all brokers let you set order validity

Quite typical for brokers is to allow an order validity of 1 day, but not shorter.

A common situation is that you submit a buy limit order, the market goes up, our order remains pending, and never executes expiring at the end of the day. A good trading engine would be able to handle such cases and provide configurable validity.

E.g. submit a limit order and if it does not execute after 5 minutes — cancel the order and try something else, adjust the price or try a different ticker altogether.

#4 Circuit breakers is the new reality

Remember when the SEC halted trading on meme stocks or the stocks would not trade during the covid news? Halts happen for various reasons, so a trading engine needs to react accordingly. I.e. not go frenzy during the pause, and continue trading as soon as trading reopens.

#5 Stock splits, ticker renames, mergers and acquisitions are a lot more challenging for an algo

Apple, Tesla, anyone who decides to do a stock split, you need to handle that properly as well: take it into account when exiting the trade, calculating profits and benchmarks. Same with reverse split, which is quite common for the stock trading under $1. As well as another subtle but similar in nature event of issuing stock dividends by a company.

Facebook renames to Meta and changes the ticker. Hertz files for bankruptcy and emerges back on the market under a new ticker. Cloudera gets acquired and becomes private.

All these and many more need to be smoothly handled by the engine, data needs sourced to be linked back to action.

#6 Penny stocks need a special treatment

Stocks under $1 are quite special indeed. Besides the risk being delisted if a stock trades for under $1 for a period of time, such stock has also a privilege, it can be traded for sub-penny amounts, i.e. for multiples of $.0001. You should carefully handle that in the trading engine, so you can benefit from more precise order placement and stop losses.

#7 Index constituents are harder than it should be to

For a good trading engine you need an ability to continuously screen a set of securities for desired market patterns. Probably you don’t want to manually enter a bunch of tickers, but use well recognized “buckets” such as market indexes, S&P 500, DJIA, and others. And of course you need to monitor how the constituents of these buckets change over time. Get the historical data and index updates in a reliable way is a project on it’s own.

#8 Speed of execution matters a lot

Working with the arrays of data, monitoring and trading multiple tickers soon starts taking quite a bit of time, minutes or even hours. Performance optimization, parallel execution and scaling are soon to come as a requirement. Even for a retail trader delays longer than a few seconds may noticeably impact the gains.

#9 Unattended execution is costly

You don’t want the algo to stop trading when you close a laptop, or don’t have internet connectivity. To achieve unattended execution, you need the right infrastructure, monitoring, backups, disaster recovery and many other fun things. It’s an extra buck but definitely worth the spend.

Disclaimer