SFOX
Jun 20 · 9 min read

Up until the 1970s, stock market transactions were handled manually, with stockbrokers gathering on the floor of an exchange like the NYSE and flashing hand signals to each other to initiate trades. The advent of electronic trading would change all of that.

In 1971, the NASDAQ opened trading as the world’s first electronic stock market. At first, the NASDAQ simply provided an electronic quotation system that displayed the price of equities electronically — it didn’t provide a way to actually execute trades electronically. By the 1990s, electronic trading had rapidly spread, along with the rise of the internet and the availability of cheap personal computers that allowed people to trade from their homes. This opened the doors to a completely new form of trading: trading by algorithm.

Algorithmic trading evolved in lockstep with electronic trading. When the NYSE began to computerize its order flow (i.e. buy and sell orders) in the ’70s, it introduced a system known as DOT (“designated order turnaround system”) that would route orders electronically to a trading post, where they would then be executed by a person. This then led to Smart Order Routing, which automated the process of handling orders across trading venues.

Once trading had been digitized, the next step was virtually inevitable: not only were computers being used to trade, but they were also being used to help decide when to trade and how to best execute trades.

Today, an estimated 85% of trading in the US stock market is driven by algorithms. While the cryptocurrency market is much newer than the traditional equity market, cryptocurrencies can be traded on online exchanges — most of which offer the ability to place orders via an API, allowing for algorithmic trading.

There’s a huge amount of variety amongst trading algorithms, spanning from the very basic to the incredibly sophisticated. That makes algorithmic trading an extremely versatile tool in a trader’s wheelhouse: depending on the trader’s specific use case, a certain class of algorithm may be well-positioned to improve that trader’s execution. Here’s what you need to know about the algorithmic tools of the trade in crypto markets.

What is algorithmic trading for crypto?

Simply put, “algorithmic trading” refers to using a computer program or system to trade on the market according to a specified set of rules. Algorithmic trading often makes use of mathematical models and formulas to decide when and how to trade assets on an exchange. (That doesn’t mean the algorithms always need to be super complex, though: a program that buys one asset every 5 minutes for 60 minutes, for example, is a simple trading algorithm we’ll consider below.)

Cryptocurrency markets provide several advantages for algorithmic traders. First, cryptocurrency markets typically have much higher volatility than traditional markets, creating bigger swings in prices and opportunities for traders. Cryptocurrency markets also are open for business 24/7, further expanding the universe of opportunities for automated trading. Finally, algorithmic trading in traditional markets is dominated by proprietary strategies run by multibillion-dollar quant funds. Cryptocurrency markets are much younger, which means it’s relatively less saturated with massive funds.

There are typically two aspects of trading to which algorithms can be applied:

  1. When to trade: Algorithms can trade according to technical indicators, momentum, and fundamentals.
  2. How to trade: Algorithmic trading can also help traders execute orders more efficiently, from routing orders across different exchanges to slicing a large order into smaller pieces. Algorithms can help traders to execute their trades at the best price available according to the size of their trade, the time of the trade, and market conditions.

It’s important to keep in mind that algorithmic trading encompasses an extremely broad range of strategies, with an endless variety of different strategies for when and how to trade. These categories aren’t mutually exclusive, either, as sophisticated traders will frequently employ multiple algorithms in a single trading system. Ultimately, algorithms seek to improve trade execution — i.e. trade price, cost, and time — which should theoretically be value-adding to any trading strategy.

We’ll walk through each category in greater detail below and touch on some of the most popular trading strategies for each one.

When to trade

Algorithmic trading can help traders determine when to trade by looking at anything from price, to momentum, to volume — and beyond. The advantage of algorithms is that they can act on these signals much faster than a human can. But trying to figure out exactly when to trade is a little bit like trying to tell the future: it’s impossible to get it right all the time. Below, we’ll walk through a couple of different ways algorithmic trading is used to decide when to trade.

Arbitrage

Algorithmic trading can capitalize on arbitrage opportunities where the price of an asset on one exchange is different from the price of the asset on another exchange. Algorithms are able to rapidly sniff out these inefficiencies in the market and profit off of them — much faster than a human could.

SFOX connects to multiple exchanges and liquidity providers in a single order book. The image above shows a $4.96 arbitrage opportunity in between sell and buy orders on the order book.

In the image above, the asking price of BTC on “market1” is $5894.96 while the selling price of BTC on Kraken is $5890. If an algorithm is able to instantly place an order on both exchanges at the same time, theoretically it could capture $4.96 of profit per BTC, before fees.

In practice, pulling this off is harder than it seems. While an algorithm can spot potential arbitrage opportunities across exchanges, turning a profit means that it has to take into account potential time delays in execution, liquidity across different exchanges, and fees charged by exchanges. In volatile times, though, these arbitrage opportunities can be larger and therefore relatively easier to capture — we actually offer a Twitter bot for the sole purpose of tracking the larger bitcoin arbitrage opportunities.

Market-Making

A market maker is a trader or a firm that provides liquidity by offering simultaneous buy and sell orders either on an exchange or OTC. Market makers are typically agnostic to whether the price of an asset is moving up or down — they simply want to profit off the spread between the bid and ask price. On cryptocurrency exchanges, market makers can also earn profits in the form of maker fees in exchange for providing liquidity to the market.

Market-making is ideally suited for algorithmic trading because a market maker is trying to capture the change in a spread by adjusting the price of multiple orders simultaneously. The goal is to win very frequently in small amounts and minimize losses, and to achieve this market-making algos will typically layer in execution algos for speed. Market-making algorithms help to increase liquidity and price discovery, working as counterparties for traders in the market.

How to trade

Algorithms can also help traders execute their orders more efficiently and at better prices, based on factors like the size and timing of the order, along with which venue to place the order on. Rather than determining “when to trade,” this category of algorithm is all about achieving the best possible execution on a trade. We’ll walk through some common types of execution algorithms below.

Smart Routing

Smart routing was one of the first types of algorithmic trading designed. It’s a strategy that automates order processing, with the aim of achieving better pricing and faster execution by routing an order across multiple trading venues and finding the best execution price to fill the order on each exchange.

In crypto, the top of the order book often consists of small amounts (<5 BTC), meaning that someone looking to buy or sell a medium-to-large quantity of BTC would need to go deeper into the order book to complete their order.

Say that you were trying to buy 10 BTC earlier this May at a price of $6,077.10 per BTC. If the order book looked like the image above, placing this order would eat into the sell side of the order book, from $6,077.10 all the way to 6,080.50. To make matters worse, while the order was filling, other traders could front-run the order, delaying the time it took to execute the order and increasing the ask price.

Smart routing algorithms allow traders to receive better liquidity by splitting an order up and spreading it across multiple exchanges simultaneously. While you could theoretically do this yourself, that would require maintaining funds across these different exchanges and placing the orders manually. A smart routing algorithm helps traders automate this process, assess liquidity across exchanges, and place orders via API accordingly.

Iceberg algorithm

An iceberg algorithm allows traders to buy or sell large orders of an asset without showing the orders’ true size to the market. They’ll typically divide a big order into smaller pieces to hide the true size of the order — only showing the “tip of the iceberg” to the market. This allows traders to benefit from more market liquidity than they would if they were to dump their entire order onto the market for all to see at a single time.

If you’re trying to sell 150 BTC at a current price of $9,400 per BTC, the last thing you want to do is put it in a single limit or market order that’s visible in the order book. Your $1.4 million order could potentially create a sell wall that artificially dampens the price, pushing it down as other traders trade ahead of it, forcing the order to trade at a worse price. An iceberg order allows traders to enter and exit large positions without showing their hand, breaking a big order into smaller pieces that won’t move the market as much. At SFOX, our Polar Bear algorithm functions as a hidden iceberg order specifically designed to stay one step ahead of trading bots that can pull you deeper into an exchange’s order book.

Time-weighted average price (TWAP)

A time-weighted average price (TWAP) strategy allows traders to buy or sell a fixed amount of an asset gradually over time. A TWAP algo aims to execute an order at the average price of an asset over a fixed time period. The goal is to minimize the impact of volatility on a trade.

For example, if you wanted to sell 1000 BTC over the next six hours, a TWAP algo would aim to execute the order at the average price of BTC during those six hours by dividing the order into smaller parts and selling it at intervals over time. TWAP algorithms allow traders to place large orders and have it execute over time rather than all at once, which reduces the potential of moving the market.

Volume-weighted average price (VWAP)

A volume-weighted average price (VWAP) algorithm seeks to execute at an asset’s average price based on its traded volume over a specified period of time. It breaks up an order into smaller slices, with the aim of executing them as close to the volume-weighted average price as possible. Like the TWAP algorithm above, VWAP algorithms allow traders to distribute a large order over a period of time, but it uses the distribution of an asset’s volume over that time frame to achieve the best execution.

The Value of Algorithms

In the modern trading landscape, algorithms are a vital tool in a trader’s wheelhouse for improving trade execution, whether that trader is an investment firm or a single day-trader. Algorithms can be applied to nearly every aspect of trading, from choosing when to place trades for market-making and arbitrage algorithms, to achieving better pricing and execution on trades. Simply using algorithms alone won’t guarantee profits, but employed properly, they can help traders de-risk their trading strategies and manage volatility.

Got another minute? Check out:


The above references an opinion and is for informational purposes only. It is not intended as and does not constitute investment advice, and is not an offer to buy or sell or a solicitation of an offer to buy or sell any cryptocurrency, security, product, service or investment. Seek a duly licensed professional for investment advice. The information provided here or in any communication containing a link to this site is not intended for distribution to, or use by, any person or entity in any jurisdiction or country where such distribution or use would be contrary to law or regulation or which would subject SFOX, Inc. or its affiliates to any registration requirement within such jurisdiction or country. Neither the information, nor any opinion contained in this site constitutes a solicitation or offer by SFOX, Inc. or its affiliates to buy or sell any cryptocurrencies, securities, futures, options or other financial instruments or provide any investment advice or service.

SFOX Edge

Crypto analysis from SFOX, the primier crypto trading venue.

SFOX

Written by

Prime dealer of cryptoassets for sophisticated traders and institutional investors.

SFOX Edge

Crypto analysis from SFOX, the primier crypto trading venue.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade