Part 2: Crypto Linear Arbitrage
In my previous post, I wrote about my investigation into profitable triangular arbitrage opportunities in the cryptocurrency market. Triangular arbitrage is when you start with currency A, trade it for currency B, then trade that for C, and finally trade C back to A.
Due to market inefficiencies, this can sometimes result in having more of currency A than you had at the beginning.
The result of my initial investigation was that these opportunities seem to occur about one to three times a minute when filtering out those with profit below 1% (considering trading fees).
At that time, I was polling Bittrex's API roughly every 250ms. Sometimes an opportunity would be printed out once, and sometimes multiple times. That meant some were present for longer than others. Given there are three trades in triangular arbitrage, and each trade takes time, some opportunities may not be around long enough to be actionable.
Time for some more coding!
Until now, the program was only outputting each opportunity as it came along, so I changed it to keep track of them. Afterwards, the program wrote a message when a new one opened, when it closed, and the duration for which it was open. Below are a few examples.
22:24:37 + ETH-VIB > VIB-BTC > BTC-ETH @ 1.33%
22:24:40 - ETH-VIB > VIB-BTC > BTC-ETH @ 1.33% (3.144s)
22:24:41 + ETH-VIB > VIB-BTC > BTC-ETH @ 1.33%
22:24:41 - ETH-VIB > VIB-BTC > BTC-ETH @ 1.33% (0.243s)
22:27:38 + BTC-BAT > BAT-ETH > ETH-BTC @ 2.06%
22:27:42 - BTC-BAT > BAT-ETH > ETH-BTC @ 2.06% (3.812s)
It's interesting to see that an ETH > VIB > BTC > ETH
opportunity was open for 3.144s, closed for about a second, then reopened at 1.33% again for only 243ms. We may have been able to trade the first one successfully, but the second closed quite quickly. Some opportunities close even quicker than this, while others are open for anywhere up to 30 seconds. That's very inefficient, but the problem is that the inefficiency is unpredictable... right?
Bittrex has three base currencies; BTC
, ETH
, and USDT
. I call these base currencies because you can buy most altcoins with them. In the above example, you can see two opportunities started and ended with ETH
, and one with BTC
.
In fact, after observing for a day, I noticed that around half started with ETH
and the other half with BTC
, while only a small amount started with USDT
. I happily hold both BTC
and ETH
, which made me question the point of trading back to the starting currency, which incurs an additional fee.
What if we only followed the opportunity path from ETH
to BTC
, and then stopped? Likewise, we'd keep the ETH
when starting with BTC
. This strategy is what I'm calling linear arbitrage.
I ran this strategy in observation mode for almost 48 hours capturing 2,314 opportunities above 1%. You can take a look at the data if you like. Here's a summary:
Min | Avg | Max | |
---|---|---|---|
Profit | 1.00% | 1.90% | 14.80% |
Duration | 0.030s | 5.050s | 156.520s |
The most commonly inefficient currencies were FUN, XLM, DGB, SNT, ADA, and ENG. Each of these gave above 100 opportunities each, but I'm not convinced there is anything to read into here. More importantly is the fact some opportunities are open for as little as 30ms. There are two trades in linear arbitrage, and that's barely enough time to place a single order. You could solve this by owning all altcoins and doing both trades simultaneously, but I'd rather avoid that.
Some of the shorter-lived opportunities may be market-manipulating bots placing small orders which get eaten up quickly. Perhaps the duration can be predicted based on the order size. I ran the strategy in trade-mode very briefly. The results were mixed, so I think this is going to be an essential part of deciding to trade.
Are you interested in hearing more about this project? Let me know!
very interesting article~!
R u programer?
Can you let me know little more tips?
This is some amazing work here. Please keep on posting.
After typing in google triangular crypto arbitrage u were there at the top. The traffic is all yours mate.
I enjoy reading your posts.
I would like to know more! I enjoy reading your posts, write me back and let me know how your crypto arbitrage bot is doing. :)
Found something interesting regarding direct arbitrage on internet - https://www.coins2gains.com
Congratulations @zaccharles! You received a personal award!
Click here to view your Board
Congratulations @zaccharles! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!