
In this article, we will discuss the issues you may encounter if you decide to trade currency arbitrage. This is HFT as it is. Due to this, the code will need to apply some simplifications for speed, and there may be completely different problems.
1. Insufficient volumes due to rounding in sequences.
Taking volumes available in currency from the exchange portfolio during currency arbitrage is often impossible. Therefore, a way to calculate volumes that would initially pass through is needed. Therefore, during the calculation of the sequence and its profitability, volume rounding occurs at the last moment. At this moment, various problems can arise due to rounding in the wrong direction, and the pair will not close.
Solution: Always specify the commission in the general settings and forcibly deduct it from the volumes that will be placed in the sequence on the second and third steps:

These settings, even if you pay a commission in the currency of the exchange or there is none, will help to cut off a small part of the volumes on the second and third steps. They will remain in your account, but there will be no problems with the number of executed volumes.
2. Insufficient speed to make a profit.
The biggest problem that will arise almost everywhere, except for third-tier cryptocurrency exchanges. Most likely, on any exchange from the TOP 10, there are several robots written in C++, which take all the profit. It is not possible to use the currency arbitrage strategy directly.
Solution: Use strategies aimed at providing liquidity significantly below or above the market for robots making mistakes, trading slowly, or placing market orders. You can read about this here.
3. Your robot's logic cannot be implemented using BotTabPolygon and PolygonToTrade.
It may be that you only need one profitability signal for currency arbitrage, but its standard trading logic does not suit you. In this case, you need to take a profitability signal for the sequence in BotTabPolygon, and trade in screeners, implementing your trading logic inside your bot. Conceptually, the architecture of such a solution may look like this:

4. During the execution of orders in the sequence, one of the orders did not open.
This can be due to completely different reasons. The main one is described in chapter one of this article.
Here's what you can do:
1) Send a signal to the sequence to make a deal.
2) The first trade opened.
3) The second trade failed and did not go through.
4) What to do?
First, open the general log:

Then:

1) Open the list of open positions, and then the closed ones one by one.
2) And remove all records from them.
Then you will have to go to the web terminal of the exchange and close all positions if they opened manually.
Os Engine supports terminal assistance: https://t.me/osengine_support_english