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:

  • 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.