High frequency and high speed arbitrage and market making

Marcin Rabiej
Published in
6 min readMar 10, 2021


…and why the speed and low fees matter

Due to or thanks to the fact that each exchange has its own order books and exchanges are separate, geographically distributed entities, the order books between each exchange are different. Differences may be small or huge, they change in time and arbitragers and market makers make sure they don’t exist for too long….


The difference in price between the exchanges leads to the situations when it pays off to buy an asset in one exchange and sell it for bigger price on another exchange for the price that covers the fees for the orders plus some assumed profit — that is what we call the arbitrage. Arbitrage is a relatively simple operation in which we are takers on both sides with the use of market orders or with the use of limit orders with “Immediate or Cancel” time in force. You can find more details about this strategy in the series of my older articles Cryptocurrency arbitrage strategies.

Market making with cross-exchange hedging

When we see that the exchange A offers an asset — let’s say 0.01 BTC for the price X that is lower than the price Y on exchange B — we start offering 0.01 BTC on exchange B for the price X + fees + assumed profit. It means we are putting limit order into the books of exchange B and we actively keep adjusting this order when the price on exchange A changes. When our order is filled on exchange B, it means that we sold our BTC for X + fees + assumed profit, we execute market order on exchange A to buy 0.01 BTC for X. After this operation, our total balance in BTC didn’t change, we paid the fees on both exchanges and we have finished with some additional money in our pocket — that is assumed profit.

Figure 1: Market making with cross-exchange hedging

As in this case we are using limit order on one side, the total fees are lower than in case when we used market orders in the arbitrage and limit order on one side guarantees that the exchange matching engine will fill our order as soon as this is possible. This factor makes this method more resilient than having two taker orders on both sides as with taker orders we have higher chance for slippage.

The race for the spread

In both cases everything starts from the difference between the prices on the exchanges. To make things simpler in this example let’s assume that the spread is the difference between the prices in top level entries of the order book (in reality we should look deeper in both directions and our spread will be represented by the curve rather then single value, you can read about it in my article about cross-exchange order book matching). In case we are looking for crypto arbitrage, we will measure our spread as the difference in the bid on exchange A and ask on exchange B or ask on exchange A and bid on exchange A. In case of market making with cross-exchange hedging, the spread is the difference between exchange A ask and exchange B ask or exchange A bid and exchange B bid.

Let’s say that at the moment T1 we see start seeing the spread between the exchanges. This is the moment when the race starts. Whoever closes the gap first, will profit from that price difference.

Figure 2: Spread in time

For the simplicity I’ve assumed that the spread is liquidated in linear way. In fact the spread will be liquidated in one or more discrete steps so this chart should look like stairs.

So when we start seeing the spread, it is 3$. The total cost of the fees on both exchanges is 70cents — it is represented by the red dotted line on this diagram. In theory if we would be able to close the operation instantaneously, we would profit 2,3$. If we don’t manage to close the operation before the spread falls below 70cents, it means that we have lost on this operation or in case we were using limit orders with Immediate or Cancel time in force when hedging, it means that our order was cancelled without any fills and we didn’t manage to hedge at all and now we are exposed. Knowing the total turnaround time of our operations from Figure 1 starting from point 1 to 5 is 400 ms, we can see that at the moment T2 when we close the operation, the spread is 2$. After subtracting the fees it is 1.3$ — that is 76% less than if we would close instantaneously and that is 38% less than if our operation time would be two times shorter — if it would take 200ms.

Now let’s take a look at what happens with the spread when we have high volatility period on the exchanges at Figure 3.

Figure 3: high volatility situation

Total number of trades and their volume may rise hundreds times compared to the calm periods. That may result in bigger price differences between the exchanges as well as with more challenging conditions to run your operation. For the sake of this example, let’s assume that the price difference between the exchanges would be closed two times faster than in normal conditions — that is in 500ms. You can expect that exchange may have slight delays when sending the order books — more price points, more clients, more load means less performance usually. Second thing is that the traffic from the exchanges will affect overall throughput of the exchange internet connection. And third is that exchange APIs that accept your orders, under the heavy load will need more time to process your order requests. Taking all these three factors under account, let’s assume that our normal turnaround time grows by 30% from 400ms to 530ms. And voila — we are under the water. After 530ms that took for our operation to execute we either lost (relatively a lot) or we have failed to hedge and now we are looking what will be the toss of the coin with our exposure. These numbers are a bit theoretical, but the point here is: the speed matters!

A bit on fees

Let’s get back to the situation when markets were calm (Figure 2) and let’s assume we have much lower fees — thanks to the fact that we have high volume of trades, our fees are significantly reduced instead of having to pay 70cents we just need to pay 20cents

Figure 4: lower fees

Not only we will earn more if we accomplish the operation successfully within normal expected time, but we also get approximately 20% more time to finish the whole operation without risking of being exposed.

And of course the example presented in this article is just an attempt to visualize the phenomenon that is much more complex, but hopefully it clarifies why the speed and low fees matter!



Marcin Rabiej

Software developer, cloud architect & arbitrage enthusiast. Founder of BitSpreader: https://www.bitspreader.com