How algorithmic trading works

November 8, 2024 7 minutes read
How algorithmic trading works

What is algorithmic trading?

Algorithmic trading (AT), often called automated or black-box trading, leverages computer programs that adhere to a predefined set of instructions – algorithms – to execute trades. Algorithms use mathematical, statistical, or ML models to combine timing, price, and quantity for automated decision-making. Trading without human intervention is a key aspect of AT. Thus, AT is concerned with computer-supported trading decision-making, order submission, and order management (source). In this post – the first in a series – we will explain the basics of AT, highlighting the strategies that can be executed. Later, more technical posts will focus on how to develop, evaluate, and trade.

Why algorithmic trading?

AT offers several advantages that enhance trading efficiency and profitability. These benefits include:

  • Optimal Execution: AT ensures that trades are executed at the most favorable prices, maximizing potential returns.
  • Low Latency: The instantaneous and precise placement of trade orders minimizes the risk of significant price changes, ensuring that trades are executed at the desired levels.
  • Reduced Transaction Costs: By automating the trading process, AT can lower transaction costs.
  • Concurrent Market Analysis: AT allows for simultaneous automated checks on multiple market conditions, providing a comprehensive view of the trading landscape.
  • Elimination of Human Error: AT mitigates the risk of manual errors during trade placement. Additionally, it removes the influence of emotional and psychological factors that can sway human traders.
  • Backtesting Capabilities: AT strategies can be tested using historical and real-time data to assess their viability and potential profitability. This allows traders to refine their strategy based on empirical evidence.

AT aims to eliminate emotional biases, ensure optimal trade execution, facilitate instantaneous order placement, and reduce trading fees. Correctly executed, AT can generate profit at a speed and frequency beyond human capability. However, beyond providing profit opportunities for traders, AT also enhances market liquidity and promotes systematic trading by mitigating the influence of human emotions.

Different types of algorithmic trading

In this post, we divide AT strategies into three main categories: arbitrage strategies, fundamental analysis, technical analysis, and combining the last two – quantitative strategies. Other partitions exist, but these three and a half categories suffice for our purposes.

Arbitrage strategies

This is a trading strategy that aims to profit from market inefficiencies by simultaneously buying and selling related coins. Arbitrage opportunities occur when coins are priced differently in two or more exchanges or inconsistently priced across trading pairs (see below). This is often called spatial arbitrage. Another type of arbitrage – latency arbitrage – occurs when the price can be reliably predicted to change, like upon the arrival of a large order buy order (i.e. front running). In both cases, arbitrageurs will buy low and sell high. The opportunities are small but frequent and low-risk, and by relying on fast, automatic execution, arbitrageurs can lock in significant profit.

Spatial arbitrage

Spatial arbitrage opportunities emerge in cryptocurrency trading when dual-listed coins are priced differently on two exchanges or inconsistently priced across trading pairs. Traders profit by buying assets at a lower price on one exchange and selling at a higher price on another. In the latter case, traders can exploit the inconsistencies by, for example, trading BTC to ETH, ETH to USDT, and USDT back to BTC.

AT systems can be implemented to identify and capitalize on these price differentials efficiently. In centralized exchanges (CEX), high-frequency trading (HFT) techniques can be employed for faster execution. In decentralized exchanges (DEX), spatial arbitrage is often called atomic arbitrage. Again, rapid detection of opportunities and execution are critical. Thus, the mempool is scoured for opportunities, and transactions are submitted with higher gas fees and to miners/validators with a higher chance to write the block. Atomic arbitrage can be risk-free using smart contracts to execute trades, verify profitability, or revert, excluding external risks.

Non-atomic arbitrage opportunities, such as cross-chain and CEX/DEX arbitrage, also exist in the crypto space. Due to higher capital requirements and a more complex risk profile, these opportunities will likely be more profitable and less accessible. AT systems help traders identify and exploit price differentials, making spatial arbitrage valuable in cryptocurrency trading.

Latency arbitrage

Latency arbitrage—when the price can be reliably predicted to change and thus taken advantage of (e.g., upon the arrival of a large buy order)—is a hot topic in crypto. On a CEX, this is similar to standard HFT in traditional markets and is not much discussed. However, it is different on a DEX, where it is called a sandwich attack. A sandwich attack is an MEV technique where miners or validators reorder transactions to extract maximum value. In a sandwich attack, searchers buy tokens to drive up prices by front-running large DEX orders detected in the mempool. It is then sold to the buyer who submitted the original order at a higher price (back running), and the searcher can pocket the difference. Sandwich attacks, like spatial arbitrage, are atomic arbitrage strategies executed in a single block for guaranteed profit.

Statistical arbitrage

Statistical arbitrage, another form of arbitrage, employs advanced statistical models to identify and capitalize on temporary price discrepancies between related assets. In finance, statistical arbitrage typically involves mean reversion models with broadly diversified securities portfolios held for short periods, ranging from seconds to days.

Statistical arbitrage strategies, such as pairs trading, index arbitrage, basket trading, and delta-neutral strategies, focus on trading relative values and profiting when prices converge. These strategies vary based on the number, types, and weights of digital assets in a portfolio and its risk-taking capacity. Statistical arbitrage is often employed in HFT due to its brief window of opportunity. Statistical arbitrage can identify and exploit temporary price discrepancies between digital assets or exchanges in cryptocurrency trading, enabling traders to generate profits efficiently.

Fundamental analysis

Fundamental analysis is a method used in finance to evaluate the intrinsic value of a security, sector, or market by examining its underlying financial and economic factors. This approach evaluates a company’s future earnings against its current value, identifying undervalued stocks as promising investments. Analysts use tools like financial statements, economic indicators, and news to assess a company’s financial health and profitability. Cryptocurrency fundamental analysis examines blockchain tech, project growth, adoption, market sentiment, regulations, and global economic factors affecting asset value. Fundamental analysis is not effective for trading meme coins, despite ongoing discussions on its usefulness in crypto.

Technical analysis

Technical analysis examines historical price and volume to reveal market psychology, focusing on trends over intrinsic asset value. TA uses tools like indicators, volume, chart patterns, and support levels to identify market trends and patterns. These tools help traders make informed decisions based on market momentum, mean reversion, and investor sentiment. Technical analysis in cryptocurrency uses historical prices and volume to predict future asset prices and market movements.

Combining fundamental and technical analysis: the quantitative approach

Quantitative strategies relying on ML and AI have revolutionized Algorithmic Trading, including cryptocurrency trading. These advanced techniques combine fundamental and technical analysis, merging multiple data sources to enhance trading strategies. ML models can analyze vast amounts of structured data to identify patterns and anomalies and generate predictive signals. AI systems based on natural language processing (NLP) can process unstructured data like news articles, project announcements and social media to detect trends and adapt to changing market conditions. For example, newsreader algorithms leverage real-time news feeds to analyze sentiment and identify potential trading opportunities. Well-designed and tested, such algorithms can easily overcome human limitations in processing large amounts of information.

However, using ML and AI in quantitative investment strategies comes with challenges, such as overfitting, data snooping, and the need for robust evaluation methods (see below). Another challenge is data availability. Accessing and processing informative data, like sentiment analysis of tweets, is often time-consuming and complex. Carefully curated datasets are very valuable and tradable in their own right. A well-suited platform reduces the significant resources and expertise needed for implementing advanced techniques.

Upcoming…

In the next installment, we’ll explore Algorithmic Trading risks, control methods, and evaluation/testing.

Ready to Defy the Odds?

Become part of a growing movement. check out the Whitepaper for more information. Start Trading Soon, Stake Token Soon. Until then you can find more information on our website

Ready to Defy the Odds?

Become part of a growing movement

Section background

Sign up for updates!