When dozens of instruments are actively traded in real time, it is not uncommon for the positions of the robot and the exchange to diverge. This can happen during internet outages, lags from the exchange, or even errors in the robots and the OsEngine itself. It is important to be prepared for this and know how to compare positions between the robots and the exchange. The module responsible for comparing positions in OsEngine is called the "Position Comparison Module," and this is what we will discuss.
1. Opening.
Position comparison is available in live trading under the portfolio tab by clicking on the "Compare position" button.
2. Settings.
1. Enable auto-checking for position conformity between robots and the exchange. If discrepancies are found, an entry will be generated in the emergency log of the connector. Accordingly, you can set up the delivery of this information to Telegram.
2. The frequency at which the checks will occur if auto-checking is enabled.
3. There are two statuses: Normal and Error.
3. Error logging.
If auto-checking is enabled and discrepancies in positions are detected, an error message will be generated. This occurs in the following format:
The actual error is logged on the server here:
4. Why are longs, shorts, and total position separated?
Unlike Moscow Exchange, some other venues have so-called "Hedge Modes," which allow for opening positions in different directions. Therefore, in our position comparison module, they are additionally separated into longs and shorts so that the module can operate not only on MOEX but also on other exchanges.
Wishing you successful algorithms!