
In this post, we will talk about such a type of trading as Currency Arbitrage. The topic is complex and not for everyone. It is very resource-intensive and problematic in programming. However, in OsEngine, everything is already set up for this. For you, 7 thousand lines of wrapper code and helpers have been written, and now the logic of robots can be developed in just a few dozen lines of code. It remains to understand the essence of this type of trading.
Names of this type of arbitrage.
There are several, but all of them are synonyms.
1. «Currency Arbitrage» - the oldest term from the Forex market from the 90s.
2. «Triangular Arbitrage».
3. «Multi-angled arbitrage».
4. «Triple arbitrage».
5. «Profit transfer».
On the internet, you can find different names for this phenomenon. The main thing to remember is that it is the same thing.
Definitions.
Currency arbitrage - consecutive operations on currency exchange rates within the same account to profit from the difference in the valuation of a particular currency in different currency exchange rates.
Currency arbitrage - an operation combining the purchase or sale of currency with the corresponding counter deal to profit from the difference in currency exchange rates.
The essence. By way of example.

Example.
We have 100 dollars (USDT) in our account. A hard currency. We want it to remain in our possession.
The robot quickly examines hundreds of possible options for triangular arbitrage and finds one in which, as a result of three operations, there will be 102 dollars in the account.
Operations:
1. We buy Ethereum for USDT. Instead of dollars, we now have Ethereums in our account. For this operation, we trade in the ETHUSDT contract.
2. We sell Ethereums for Bitcoins. Now we have Bitcoins instead of Ethereum in our account. For this operation, we conduct the sale in the ETHBTC contract.
3. We sell Bitcoins for USDT. And we have dollars in our account again. For this operation, we conduct the sale in the BTCUSDT contract.
Example on order books.
And now let's take a look at what this might look like in a robot. In the picture, the standard interface for viewing the sequence of instruments for currency arbitrage in OsEngine.

On the left, we can see the order books for the instruments, and it is indicated which operation will be performed on each.
In the center, we see a table that calculates the conversion volumes at current prices. The result of this table can be seen in the Profit ABS, Profit % rows.
What causes these inefficiencies to arise?
Primarily, due to people trading in illiquid pairs. For example, in the GNSBTC pair. From the example above, it is evident at a glance that the order book is half empty. But someone needed to buy GNS for bitcoins for some reason and placed an order at a price of 0.0001155. That one:

It is this human-placed order in a half-empty order book that guarantees us profit in this particular arbitrage.
Important!
This type of arbitrage can only be done «head-on» if:
1) There are no competitors on the exchange where you are going to trade it.
2) You have the fastest software of all possible options. And you are closest to the exchange core platform.