Crypto Triangular Arbitrage with on Binance Exchange with Python — Videos and Code — Real World Example

--

Introducing Triangular Arbitrage by Blockchain Engineer Joaquin Roibal

Triangular Arbitrage is the process of trading three currencies (or other security) to take advantage of a price difference among the three exchange rates in order to make a profit. The above video describes this process in detail and it is recommended to watch before continuing further.

Introduction to Triangular Arbitrage

This medium post will discuss this approach applied to Cryptocurrencies on the Binance Exchange with a bot I developed using the Python programming language.

Introduction — Example of Triangular Arbitrage

Triangular Arbitrage General Example Explained by Blockchain Engineer Joaquin Roibal

Triangular Arbitrage is different than swing or momentum trading which attempts to take advantage of a price difference among varying time because Triangular Arbitrage takes advantage of current price differentials, involving less risk and allows profits to be realized immediately.

Triangular Arbitrage opportunities exist due to inefficiencies in the current market, and yield a more balanced market where prices are more accurately reflecting of supply and demand.

Triangular Arbitrage brings the market into better alignment and provide a profit to the Arbitrageur for that service, similar to the profit provided to ‘scalpers’ for adding volume to the currency pair and reducing the bid/ask spread.

Example of Triangular Arbitrage Applied to Cryptocurrencies

Cryptocurrency Triangular Arbitrage Explained by Blockchain Engineer Joaquin Roibal

Arbitrage Opportunties exist within the Cryptocurrency Market due to the lack of significant trading volume spread among exchanges and various currencies. Even on the largest exchanges (Binance) and highest-traded currency pairs (Ethereum, Bitcoin, USDT, and Binance Coin) there still exist significant opportunities to execute profitable trades with Triangular Arbitrage.

How To Read Triangular Arbitrage Charts

Triangular Arbitrage Visualization Data from Indodax Exchange with ETH-IDR-BTC Triangular Arbitrage

The above graph demonstrates data visualized (utilizing MatPlotLib) over a ten-minute time period. The X-axis represents time, and three lines (blue, green and black) are drawn for prices with their respective values coordinated along the y-axis (which are color coordinated: the green y-axis indicates values for the green ‘line’. Similarly, blue for blue and black for black). These values are directly collected from the Binance exchange and represent ‘prices’ (or exchange rates) for 3 different cryptocurrency pairings (ETH/IDR or BTC/IDR)

A fourth series of values are displayed as black-crosses. These values (black crosses) are calculated based upon exchanging for two currencies as described in the Chapter 5 Triangular Arbitrage Youtube video. The purpose of this graph is to visualize the Triangular Arbitrage data collection and analysis process. When the Black Crosses are above the black line, that demonstrates a profitable Arbitrage Opportunity, because you will be purchasing the Coin at the price indicated by the black-line and will be selling at the price indicated by the black crosses.

The arbitrage opportunity on the indodax exchange is quite high with profit potentials as high as 11%.

Real World Triangular Arbitrage Case Study on Binance with ETH-BTC-BNB Currency Exchange

The following three graphs demonstrate three Triangular Arbitrage Markets which exist among ETH-BTC-BNB-USDT. These graphs were built using the Binance Arbitrage Bot which I developed and coded myself. Each consist of a 10-minute time period with data taken at 60-second intervals.

10 Minute Triangular Arbitrage Data Visualized — BNB-ETH-BTC Triangular Arbitrage
10 Minute Triangular Arbitrage Data Visualized — BNB-USDT-BTC Triangular Arbitrage
10 Minute Triangular Arbitrage Data Visualized — BNB-ETH-USDT Triangular Arbitrage

Additional Triangular Arbitrage Visualizations

60 Minute Indodax Triangular Arbitrage Data Visualization — IRD-BTC-ETH

The above graph of Indodax exchange for a 60-minute data collection window demonstrates the effect of changing prices on the Triangular Arbitrage opportunities, and multiple instances when Triangular Arbitrage would be unprofitable (when the black crosses are below the black line).

60 Minute (10 Hour) Crypto Triangular Arbitrage Data Collection on Binance

The above graph demonstrates the visualized data collected during a 600 minute (10 hour) time period for the Binance Currency Exchange. This graph demonstrates how the change in BTB/ETH price and BNB/BTC price effects the exchange rates and opportunities for Triangular Arbitrage (while maintaining relatively close values).

Triangular Arbitrage with Cryptocurrency Conclusion

In conclusion, Triangular Arbitrage is a process to profit from the discrepancy is prices among three varying securities or currencies. Triangular Arbitrage is a widely-utilized trading strategy due to its effectiveness, low-risk, and ability to profit from (while improving) inefficiencies within the marketplace (such as a cryptocurrency exchange). You can find the code used in this post available through my Github here under ‘Binance_Arbitrage_Bot.py’.

--

--

Blockchain Engineer - Crypto Trading Bots

@BlockchainEng on Twitter. Crypto Trading Bots Programmer. Blockchain Engineer. Crypto Investor - Trader. ICO Advisor. realestateblockchain1@gmail.com