The MoonCMD remote-control 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)

buy ... - the standard rules for buy signals apply

short ... - standard rules apply for short signals (futures)

sell token - Enable a Panic Sell on the coin. Example: sell NEO

SellALL - Enable a Panic Sell ON ALL active orders and stop the bot

list ("lst" for short format) - A list of active sell orders

silent - Disable bot notifications in the chat about closed transactions

talk - Enable bot notifications in the chat about closed transactions

STOP - Click Stop in the bot (Do not buy new signals)

CancelBuy - Cancel all outstanding BUY orders

START - Click Start in the bot, launch strategies

BL - Show a blacklist of coins

BL + coin - Add coin coin to emergency

BL - coin - Remove coin coin from emergency

TempBL +N coin1 coin2 - Temporary emergency for N hours

setParam Strategy Param Value - Change the parameter in the strategy ("empty" for an empty string)

SetBL+ Strategy coin - Add a coin to emergency strategies or folders

SetBL- Strategy coin - Remove coin from emergency strategy or folder

SetWL+, SetWL- Strategy coin - similar for BS

sgStart Strategy, sgStop Strategy <time, minutes>) - start or stop strategies for a given time

ResetSession coin | ALL - reset sessions on a coin (coin) or on all markets (all)

ResetLoss - reset the profit counter

Leverage X [coin,coin] - change the leverage on coins to X

Margin [coin,coin \ ALL] ISO\Cross - change the margin on the markets

ConvertBNB - Dust to BNB

report [N days \ weeks] [coin] [hide] - send a report. By default for today

SellPiece [coin\ALL] - sell a piece from each order (if the parameter in the SellPiece strategy is not 0)

DoUpdate - update the version

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)