API trading platforms enable traders to trade the market automatically with pre-built or custom strategies. We have reviewed some of the best brokers for API trading including IG, CMC Markets, Saxo Markets, and Interactive Brokers and compared them by API offering, pricing and market access so you can choose the best platform for your algorithmic trading.
IG API Trading
- Web API
- FIX API
CMC Markets Algo Trading
- High Frequency Trading
- Arbitrage Trading
- Volume-weighted average price execution
- Time-weighted average price execution
66% of retail investor accounts lose money when spread betting and/or trading CFDs with this provider
Saxo Markets API Trading
- Saxo APIs
- OpenAPI for Excel
- 3rd-party platforms
- Receive tailored multi-
asset liquidity via FIX API
- Access Excel’s powerful automation functionality
70% of retail investor accounts lose money when trading CFDs with this provider
Interactive Brokers API Trading
Client Portal API
- RESTful API
- Pro Account
- Proprietary, open-source API
- Trader Workstation
- IB Gateway
- C++, C#, Java, Python, ActiveX, RTD or DDE
- Industry standard solution
- Direct access to the IBKR
- VPN, dedicated line or cross-connect
60% of retail investor accounts lose money when trading CFDs with this provider
What is algo trading?
The advancement of technology has revolutionised trading. So powerful are computers these days that trading can be executed automatically using a suite of pre-programmed functions.
Algorithmic trading (‘algo’) is a combination of computational, technical, fundamental, statistical and quantitative knowledge – all blend into buying and selling of financial instruments. Once unleashed, algo rules dictate buying and selling according to pre-set thresholds with minimal human intervention.
There are thousands of algo strategies at work every day in the financial markets. These algos trade stocks, foreign exchange, commodities, bonds and derivatives. Some algos are aimed at high-frequency intervals (sub 1 second), some intraday, and others positional lasting days. A high percentage of US stock trading is done by machines.
Many of these trading systems are profitable. Unsurprisingly there are a large number of investment funds dedicated to algo trading. One of the most successful funds is Renaissance Technologies. Its famed Medallion Fund gained 76% in 2020.
Algo trading pros
Algo trading has many advantages, including:
- Efficiency – once set up, the strategy can be trusted to run as long as markets are opened
- Scientific analysis of the strategy – including backtesting of the strategy and optimisation of the risk parameters
- Fewer human errors – disciplined execution of the trading orders
- Optimised – from trader triggers to actual orders can all be optimised for maximum profitability
Algo trading cons
However, there are also some drawbacks to algo trading, such as:
- Crowding – everyone else is doing the same thing
- Paradigm shift – strategies no longer work and cause large damage to capital base before owners abandon them
- Technical expertise – some of the algo testing require deep statistical and financial knowledge
- Complexity – some algo strategies can be too complicated to understand
- Programming – if a strategy has thousands of lines of code, there could be hard-to-detect programming errors
Once in a while, the market will go through a period of turbulence that hit all quant funds in the same manner, leading to steep losses for all of them.
One such event was the Covid-19 pandemic in March 2020. Market turbulence dragged quant funds deep into the red (see below).
Source: Financial Times (paywall)
Finding the best Algorithmic trading platform in the UK
The best algorithmic trading platforms depending on what type of trader you are, professional traders will need a DMA broker, institutional traders will need a prime broker and retail traders can create algo trades with an MT4 broker. However, the main things to consider when looking for the best broker for algo trading are:
- Market access
- API access
- Capitalisation and regulation
Types of algo trading strategies
There are many types of algo trading strategies, such as:
- Technical Indicators – most famous of them is ‘trend following’ strategies
- Mean reversion (or pair trading) – betting on similar securities moving together or apart
- Arbitrage – betting on similar securities have the same price, say between stock index futures and the underlying stocks
- Transactional – breaking orders to reduce costs such as VWAP (volume-weighted average price)
- High-Frequency – trading instruments multiple times within a second
- Machine learning – applying newer strategies such as deep learning to capture patterns
Of course, there is nothing to stop a fund from using a combination of all these strategies to gain an ‘edge’ over its fellow traders.
Some strategies, however, are more capital intensive than others. The initial investment can run into millions.
Factors to consider when setting up algo trading
- Strategy – what type of trading strategy do you intend to employ? What is the target market? Do you believe you have an edge over the more mature funds? Some strategies are probably better suited for professional trading firms.
- Data – what type of data do you need for your strategy? If you require tick-by-tick data, it would be quite expensive to buy. By contrast, end-of-day data is much cheaper.
- Data Storage – where would you be storing your data? Buy or rent space?
- Software – how would you be absorbing and analysing all the incoming data? Which programming language? Do you need to hire quality programmers to build a trading system? How reliable is the software?
- Brokers – who would you be using to execute your trades? How much capital do they need to run an algo trading model?
- Risk management – on top of buy/sell signals, you will need a robust risk management system to allocate positions, calculate weighting, and monitoring open positions. For example, how do you deal with drawdowns and volatile periods?
- Research – do you continually run backtesting on new models? Good quant ideas are rare. Firms that found them will exploit them to the hilt.
- Initial capital – how much capital do you have to start trading? If the initial capital is too small, you may not be able to withstand prolonged periods of drawdown.
All these factors are important. It takes time to think about all these input and a lot of effort to make sure they integrate in one coherent system.
More importantly, how involved would you be in setting up the business? Does it suit your personality, skillset and temperament? Remember, even with all these systems set up and running, the return on capital may be too volatile or too low. There is no guarantee it will hit your target returns.
Example – Setting up an automated trading strategy
One of the simplest examples of a rule-based strategy is also an old one: buy and sell a stock based on moving averages.
A moving average is a smoothing calculation to average past prices. The parameter N is the number of days to average. The larger the N, the smoother the average line. The chart below shows the 150-day moving average on British American Tobacco (BATS).
The rule: Buy stock when prices move above the moving average; sell stock when prices slip below the moving average; do nothing when prices is at the moving average.
At first glance, the rule is simple enough.
However, when we get to the actual implementation, things become more complicated. For instance,
- How much to buy and sell the stock as a percentage of total assets?
- Do we need additional filters such as waiting for a confirmed signal ie closing price above moving average?
- Do we add more (‘leverage up’) when the trade is going well?
- Is there a max loss limit (stop losses) on the trade?
- What about intra-day movements – do we ignore or factor into the system?
- How we trade the stock – at market or limit or near closing?
Furthermore, at the portfolio level how many stocks are we going to trade? Is there a particular sector focus?
Finally, is the parameter 150 good enough? Is there any other better possibilities such as 140 or 78? Have we tested the model on other stocks? Is the result consistent enough to warrant more capital allocation to this particular strategy?
As you can see, even when the trading rule is very simple, the design of the trading model is not. There are many other factors at work – and questions to answer – even before we bet a penny on a trading strategy. Many things can go haywire.
Once the strategy is mapped out, you will need to ‘test run’ it. That is, use real prices to generate p-and-l but without employing any real money. This is to assess the strategy in real-time.
Investing in algorithmic trading
There are many services that claim to offer algo trading strategies for sale and offer a chance to invest in their algorithm. However, trading signals are often a scam, unless they are attached to a well-respected, established and regulated fund. Even then, algo trading through a third party strategy comes with a very high degree of risk
Successful backtesting an algo trading strategy
Backtesting is a cornerstone of algo trading. This process assesses the profitability and reliability of trading models. It answers the question ‘should we trade it?’
What is backtesting? It is applying trading system to historical data. Backtesting allows us to visualise how well – or poor – the model is.
Some common yardsticks to measure a model’s overall characteristics:
- Profits and losses – total, max profits and loss, trade-by-trade pnl
- Volatility – of each trade, drawdowns and total equity curve
- Returns – including risk-adjusted returns over time
- Distribution of trades – is the system dependent on a small number of large trades?
- Mechanics of trade – how volatile are the results based on different assumed entry prices, slippage and transaction costs
Once you have the system results, it gives you an idea on how well the model is working historically. However, there are some biases in these testing results, including:
- Optimisation bias – fitting the model to data which has no predictive value
- Look-ahead bias – an error that included future data for current calculation
- Survivorship bias – using data that are not representative of the whole sample
To mitigate these biases, you start with data. Are the data bias free? A good quality dataset is used preferred. Second, conduct out-of-sample statistics tests to examine the original results. Examine trading models with sensitivity tests. Simulating parameters or bootstrapping data and see if model results are good enough.
A good backtesting process takes time and effort to set up. It is crucial in giving traders confidence in their activities.
Where to learn algo trading for beginners?
If you intend to use algo to trade, there are many websites dedicated to this activity where you can learn, including:
- Books, e.g. Ernest Chan’s Algorithmic Trading, Robert Carver’s Systematic Trading
- Online courses such as udemy or coursera.org
Algo trading FAQs:
How does algo trading work?
Algo trading works by creating an algorithm to automatically execute buy and sell trades based on preset parameters.
What is algo HFT trading
Algo HFT trading is using an algorithm to execute High-Frequency Trading (HFT)
What is algo trading in forex?
Algo trading in forex is using an algorithm to automatically execute trades on the foreign exchange market.
What is algo trading in the stock market?
Algo trading in the stock market is using an algorithm to automatically execute trades on the shares of listed companies.
What is algo trading software?
Algo trading software is the program used to create automated trading strategies.