Sometimes, the market can be inefficient and there can be a situation that if we convert BTC into LTC, and then to USDT, and finally back to BTC, we can get more BTC than what we have originally, i.e. triangular arbitrage.
Triangular arbitrage is a simple way to make profit by taking no or very little risk. To detect triangular arbitrage opportunities, we need to simply compute the final rate of the three conversions.
In the above example, we simply multiply the conversion rates of BTC/LTC, LTC/USDT, and USDT/BTC (which is the inverse of BTC/USDT). If the final result is greater than 1, it means we will have more BTC after the conversion.
For our exchange coinut.com, you can use the following sample code to detect such opportunities. The code also considers the trading commission fees. Because different account levels have different fees (https://help.coinut.com/hc/en-us/articles/360001416133-Fee-schedule), you can change
FIAT_FEE according to your account level. You can also directly run it by clicking on the play button.
Run the above code, and we indeed find some opportunities!
If you need more information on our API, please check https://github.com/coinut/api/wiki