The MoonCMD protocol

The moonbot can receive remote control commands on the UDP port, send responses, and send regular updates.

commands are accepted in the format:

hash command

where hash = HMAC-SHA256(command, password); port and password are set in “Settings - Special - Remote”:

Fields: UDP Commands Port\pass

Enter the port on which the Moonbot will listen to commands, and the password that will be used to sign the commands.

General response format:

they respond in json format using gzip:

{"cmd":"<string type of command>","bot":"string name of the bot","N": int,"data":"string"}

Commands (except the standard ones described in “hi” in the cart)

GetStrategiesFull send all strategies

GetStrategiesActive send only active strategies

Output format:

{"cmd":"strats","bot":"BotName","N":number,"data":"string"}

N: package number (all strata may not fit, then split into N packages)

Data: a list of strategies (the usual format as when copying a stratum to a buffer):

##Begin_Strategy

##End_Strategy

There can be several strata in a row in one package.

Regular updates from the bot to the port where the command came from:

Ордера

{"cmd":"заказ","bot":"Имя бота","oid":число,"sql":"строка"}

Oid: The ID of the order in the Moonbot database. It should be used for correct updating of records in the database when new sql arrives after price changes, partial or full execution of the order.

Balances: (sends every 5 seconds)

{"cmd":"acc","bot":"BotName", "data":{ "A":”double”,"T":"double", "S":bool,"V":int}}

A: Available available balance

T: Total - total balance

S: Is the bot running

V: version number (without dot, in 756 format)