DEV Community

Maksim Bober
Maksim Bober

Posted on β€’ Edited on

1

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 😞

Dynatrace image

Observability should elevate – not hinder – the developer experience.

Is your troubleshooting toolset diminishing code output? With Dynatrace, developers stay in flow while debugging – reducing downtime and getting back to building faster.

Explore Observability for Developers

Top comments (1)

Collapse
 
ranjithkumar_71deaa71380f profile image
Ranjithkumar β€’

Hello. How to calculate crypto triangular arbitrage position size

Dev Diairies image

User Feedback & The Pivot That Saved The Project

πŸ”₯ Check out Episode 3 of Dev Diairies, following a successful Hackathon project turned startup.

Watch full video πŸŽ₯

πŸ‘‹ Kindness is contagious

Show gratitude for this enlightening post and join the vibrant DEV Community. Developers at every level are invited to share and grow our collective expertise.

A simple β€œthank you” can make someone’s day. Leave your appreciation below!

On DEV, collaborative knowledge clears our path and deepens our connections. Enjoyed the article? A quick message of thanks to the author goes a long way.

Count me in