Trusted Management High-Frequency trading via UDP port

Taking this into account we developed the new extra fast protocol for trust management. (Available only in PRO version). Test results show that delays can be as small as 100ms and even less! In some cases, slave bots can be even faster than the master bot, if they use fast VPS close to exchange’s servers location (i.e. Tokyo for Binance) Factors to achieve high speed:
  1. The UDP protocol is connectionless, hence to send a signal means to send only one 1-way datagram. It’s much faster than to establish a connection first then to send a signal and wait for confirmation. There is a drawback – very small chance that a command won’t be received, in case of trust management tasks it doesn’t really matter and means that one trade from let’s say 1000 others will be missed.
  2. Some commands are “composite”, consists of atomic sub-commands, For example, to replace an order consists of 3 operations:  to cancel an existing order, to wait for exchange’s confirmation, to set new order. If the command: “replace an order” is sent to a fast VPS, it is executed by the VPS alone, and hence may be executed much faster than by master bot.
The list of all available commands and basic description of how trust management works you will find here. Please read this article first before proceeding to the next chapter.

How to setup slave bots to work with udp signals:

1) First of all, slave bots must have static IP and open UDP port. The IP address and the port you tell your manager so that he adds you to send list. 1A) How to open an UDP port: Each bot should use a unique port number, which you specify in the “Settings – Advanced” tab. The default is port 1999. Here are steps to open a port on Windows Server 2016: open Windows Firewall Trusted Management via UDP Trusted Management via UDP Open Advanced Settings Trusted Management via UDP Create a new rule to allow UDP packets on the desired port: Trusted Management via UDP After you have created the rule, you may open its properties and allow inbound connections from determinate IPs (belonging to your managers).(Properties – Scope – Remote IPs). 1B) How to setup the bot: Create a new strategy with SignalType = “UDP”. Set AcceptCommands = YES. Leave ChannelKey empty. Master bot may send encrypted command (see below), in this case, set OnlyEncrypted = YES and ask your manager to give you key files to decrypt signals. 3) How to setup master bot Right-click to the Share button: Crypto Trading: Trust Management
  • Tick the “I’d like to post Trust Management UDP signals”.
  • Push the “Send List” button, fill the send list with IPs and ports of your slave bots.
  • Optionally fill the “Max. Order” value: Master bot specify max. order size, and when it uses less order, slave bots use proportionally smaller orders too
  • Optionally fill the ChannelKey: your slave bots must specify the same ChannelKey in their strategies.
You can send encrypted signals (preferred):
  • Push the “Keys” button 1 time. this will create key files: a private key (data\UDPKeys.key) and a public key data\PubKey*****.pub (where **** is the Moonbot ID digits of the Master. ex. PubKey10020.pub)
  • The private key must be kept safe on your PC only in the “data” folder. Do not move it and do not give anyone.
  • Give the public key to your subscribers, it’s needed to decrypt your signals.
  • NOTE! If you push the “Keys” button once more, it will overwrite key files, and you will have to give the public key to your subscribers again.
Also note:
  • To use multi-orders, you must turn encryption on (with that, the order identifier will be transmitted that will allow managed bots distinguish between orders on the same coin)! Open commands (unencrypted) do not transmit the order identifier.
  • When using multi-orders with Trusted Management, unifying sell orders is not possible. The manager should not use the order unification function!
  • Only orders can be split when using Trusted Management. In this case the order will be split into 3 parts both on the manager’s side and on the managed side while keeping control over all 3 orders. Splitting a position while using Trusted Management is not possible because the position on the managed account can be created by more than one single manager account or by the managed account manually on their own or using strategies etc.
  • On Amazon and Google vps you should open the desired port in admin panel. For google the manual is here https://cloud.google.com/vpc/docs/using-firewalls
  • With encryption turned on the signals also contains base currency, which is verified by slave bots (so that ETH slave won’t accept USDT master’s commands)..
  • Old format signals from the “export” chapter can be used in a similar way to manage remote bot.
  • If there is an open port on the server and the manager has specified the correct IP address, the strategies with enabled encryption should receive signals and write to the log, even if these cannot be processed. That said, if the log was left empty this is an indication of the port or IP address being set wrong.
  • Any bot will take up one port (even if it has no strategies and isn’t set up for Trusted Management). If you are running several bots, you should assign them different ports (Settings —> special)