DEV Community

Maksim Bober
Maksim Bober

Posted on • Edited on

Is it possible to do triangular arbitrage on Coinbase?

Triangular arbitrage is the result of a discrepancy between three foreign currencies that occurs when the currency's exchange rates do not exactly match up. These opportunities are rare and traders who take advantage of them usually have advanced computer equipment and/or programs to automate the process. - Investopedia

Illustration of how it works?

Let's use a fictitious ideal example.

image

You can see here that if you have 1 unit of USDC you can sell it for 3 units of BTC. Then you can sell 3 units of BTC for 1 unit of ETH each so you get 3 units of ETH. Now, you call sell 3 units of ETH for 2 units of USDC each, so you get 6 units of USDC. Thus by going in such a cycle you can make initial investment of 1 unit into 6 units. Pretty sweet deal 🚀🚀🚀

Let's try seeing if we can do the same thing on Coinbase Pro and make some real 💸.

How to get data?

You will get trading pairs that are available on Coinbase Pro.

You can save them to a file and then load them into your Python script to do the analysis.

Let's explore it 🔬

I decided to analyze this data with Wolfram Language since it's much easier and faster.

Here is how the directed graph of trading pairs looks like.
image

Now, we need to find out if there are any cycles that we can exploit to do Triangular Arbitrage.

image

Interestingly, there are no cycles within the trading pair graph. So it seems that you cannot do triangular arbitrage within the broker without withdrawing your money and then buying crypto again 😞

Top comments (1)

Collapse
 
ranjithkumar_71deaa71380f profile image
Ranjithkumar

Hello. How to calculate crypto triangular arbitrage position size