# Cryptocurrency Arbitrage, Real Experience

With the start of the bitcoin rush, countless interesting projects have appeared on the Internet, ranging from ICOs, cloud mining to vlogs and courses on trading, mining, etc. I drew attention to crypto arbitrage, which we will talk about now.

For a long time I looked closely at this topic, read a lot of articles, did not believe, doubted, then I got inspired, and finally understood, if I didn’t try, I don’t know.

There are many strategies, but for myself I have divided arbitration into two branches: intra-exchange (tri-legged) and inter-exchange (spatial) arbitration.

This article was written back in 2018 and only now I found it and decided to share it. Therefore, do not judge strictly if some information is irrelevant.

### Intra-exchange arbitrage

This strategy is implemented on one specific exchange and looks something like this.

Let’s say we have BTC, we sell them for dollars, we buy LTC for these dollars, and then we change LTC to BTC – we get a profit in BTC. Just as people move the price – there is always some kind of gap on which to make money. If you multiply all prices, ideally you should get 1, and on any deviation from one you can earn money by going clockwise or counterclockwise along the triangle. There does not have to be three currencies, there can be any number of them.

It looks confusing in words, let’s look at a specific example in numbers, close to an ordinary person. Take the three Dollar-Euro-Pound.

Dollar-Euro – 0.9

Euro-Pound – 0.8

Pound-Dollar – 1.3

0.9 * 0.8 * 1.3 = 0.93

Often, the final result is less than one, that is, after completing all transactions, we will receive fewer coins than it was originally. But if we go in the opposite direction, the coefficients will be inversely proportional.

1 / 0.9 * 1 / 0.8 * 1 / 1.3 = 1.07

The situation is further complicated by the fact that we pay a commission for each operation. And for three trades we will pay a triple commission.

There are many bots on github, paid and free, that look for arbitrage opportunities and generate trades. Such programs either do not inspire confidence or do not meet the requirements. In general, I decided to do everything myself and check it out. Used the library ccxt… To begin with, I took one triple and every few seconds I checked whether there was an opportunity for arbitration and there really were such opportunities, but I could not fully assess the picture. So I’ll add a few more triplets. I even tried to trade. Soon I decided to remake the bot, added a web interface to it, and connected other exchanges. I started scanning each one in turn, looking for arbitration situations. But no matter how hard I tried, I didn’t manage to trade. If there is an arbitration situation, then in a second, at most two, it is gone.

The main parameters in this type of arbitrage were the speed and liquidity of the price. Arbitrage was calculated on the last order in the order book, and often this order was worth about a dollar. I suspect that someone saw the arbitrage situation faster than me and made deals, leaving a few unfortunate cents from the last order. So, perhaps, liquidity has nothing to do with it.

Even if you manage to calculate and start trading, you may not be able to make the last deal and be left with an unnecessary coin to anyone.

As a result, speed plays an important role: you need to read quickly and trade quickly. Therefore, in order to be able to earn good interest, it is necessary

1. a powerful server, closer to the exchange on which you trade, but it is better to rent capacity from the exchange itself, and some even offer this for a lot of money;

2. high-speed communication channel with the exchange;

3. use a high-performance programming language such as C, Assembler, perhaps even microprocessor programming to bypass the use of the OS, and work directly with hardware;

4. optimize your program to the maximum;

5. and it is better to keep the required amount immediately in the required currency. For example, we trade BTC-> LTC-> USD, then it is necessary that the equivalent of \$ 100 was in both LTC and BTC and USD. Or you can use margin trading if the exchange and its API allow it.

I used polling requests with an interval of several seconds, but some exchanges provide a communication channel via web sockets, which, in theory, should speed up the exchange of data with the exchange.

Of course, you can make money using your server or computer, but according to my calculations, an amount of \$ 1000, scattered across different exchanges, for different coins, will bring several tens of dollars a month, and this is, at best, if everything goes smoothly. Does anyone else believe it is possible to arbitrate manually?

### Inter-Exchange Arbitration

This is not the case with inter-exchange arbitration. It involves buying a coin on one exchange, where it is cheaper, and selling it on another, where it is more expensive.

Arbitration situations (surebets) arise when a coin is bought or sold in a large volume on one exchange, moving the price at the same time. On this exchange, the price of a coin is different from the price on other exchanges. People, including affiliates, understand where the price will go on other exchanges and begin to level the price with their actions.

For maximum profitability, it is better to keep money on two exchanges, in the currencies we work with, in order to immediately buy on one and sell on the other. For example, take a BTC-ETH (bitcoin-ether) pair, we have approximately the same amount of ETH and BTC on both exchanges. On exchange A, ether is cheaper, so we buy it there, and on exchange B where it is more expensive, we sell the same amount of ether. There are more ethers on exchange A, and more bitcoins on exchange B. We are transferring ethers and bitcoins to equalize their amount on both exchanges. This strategy makes it possible to instantly react to the situation, because the transfer time of some coins can last several hours, or even more. To earn and reduce the commission for the transfer (since it is not a percentage, but a fixed one), it is advisable to operate with amounts of \$ 300 or more. Not everyone can afford to hold such amounts in many coins on different exchanges.

Since I had already set up work with several exchanges, I decided to modify my system for monitoring inter-exchange arbitrage situations.

In order not to think for a long time, almost all coins are traded for the main currency, let’s take bitcoin.

After analyzing various programs and telegram bots, I quickly made a table that showed where to buy, where to sell, and how much interest you can earn on this, excluding commissions.

Inter-exchange arbitrage situations exist longer than intra-exchange arbitrage situations, because it takes time to transfer a coin from one exchange to another. The prices were updated once an hour or upon request.

About 30 exchanges participated in the search.

My service, like others, showed many arbitrage situations with percentages from 0 to 100 and higher. But as it turned out:

• where there is a high interest rate, coins are not available for withdrawal or even for trading;

• where there is a small percentage, you can not earn at all and even lose on commission;

• often you need to look at the trading volume for a coin to be liquid. Well, when the trading volume is several bitcoins, it means that it is not so easy to pump the coin, and during the purchase the price will not rise much, but during the sale it will go down;

• you need to take a trusted exchange that does not freeze wallets for personal gain;

• I would like to exclude all fiat currencies from the sample, because withdrawal in dollars or another fiat currency is accompanied by additional difficulties and high interest rates.

Based on the above features, I decided to make a filter. Now it has become possible to limit profitability, specify the minimum trading volume in 24 hours, select the exchanges you want to work with, exclude fiat currencies and save filter settings.

I also wanted to filter the list of currency pairs by the availability of wallets on the exchange. Weed out those where withdrawal or input is closed, but few exchanges provide such information via API. Therefore, we had to check the wallets manually. But I didn’t have to check much. After filtering out the selection, there are only a few options left. After checking each one, I was not surprised to see that the same wallets are not available everywhere.

It remains only to wait and watch when somewhere the price starts to change abruptly and there will be an opportunity to trade. And there are chances, and you can trade, but on dishonest exchanges, the transaction can often freeze for several days, or even weeks. Several times I managed to trade, once I did not have time, sometimes the money hung for a long time. In general, I spent more nerves than I made money. In the meantime, I was trading, I decided to make two more features – this is a profitability table for a specific coin at the moment and a graph of price changes for a specific coin on different exchanges.

The price dynamics seemed to me an interesting function. Using it, you can easily determine where the price is lagging behind, see the spread at a particular moment in time.

Analysis of price dynamics graphs can be combined with a spatial arbitrage strategy in which you do not need to withdraw coins from the exchange, but simply wait for prices to smooth out. That is, we buy coins where they are cheaper and wait for the price to rise.

Now the service is no longer developing, as interests have changed. As you can see, arbitration works, but how much you can earn on it is another question. It all depends on the volatility of the coins, and as you know, it decreases. New laws are being passed, cryptocurrencies are becoming more regulated and less prone to spikes. Exchanges are becoming more sophisticated and trying to protect their users from fraud in markets such as spoofing, artificial pumps and dumps on low volume coins. A similar situation was observed in the exchange markets.

As a result, you cannot earn much on intra-exchange arbitration without a good speed of work with the exchange, which is not cheap. In inter-exchange arbitration, there are more opportunities, but also more problems and risks, there is an opportunity not only not to make money, but even to lose, and I’m not talking about the fact that exchanges can be closed, block transactions or entire accounts. I heard people were “celebrating” the anniversary of a ticket with no response on an unscrupulous exchange. It is possible to further develop the idea of ​​automating trading on exchanges, whether it is arbitrage, or trading according to a certain strategy or signals. Catching profit on rebounds with a sharp fall, or making money on shorts with pumps. Creating the visibility of the trading volume for price movement, etc. On the net you can find many more interesting strategies that, most likely, someone has already implemented and a bunch of ideas that still have to be implemented.