Bots

This section describes the work with the tab "Bots". A bot is a defined trading pair and its allocated funds (finances), intended for trading by placing orders on the exchange. Each bot is characterized by the following main parameters (measurements):

  • Name
  • Account, through which is trading
  • Trading pair (symbol)
  • Size of exchange commission
  • Step size of the trading grid (in %)
  • Range of the trading grid (in %)
  • Starting point (symbol price)
  • Trading grid (array of the grid lines)

Bot statistics are measured in:

  • Orders
  • Deals
  • Informational messages

Trading grid

The key parameter of the bot is the trading grid. The grid consists of rows. Each row of the grid is defined by the following parameters:

  • Line number
  • Sign of activity
  • Buy price
  • Selling price
  • Start order type (SELL or BUY)
  • Start date of trades on the line (required for calculation of profitability percentage)
  • Amount on start of sell orders (SELL)
  • Amount at the start of orders to buy (BUY)
In essence, a trading grid is a trading plan for the bot, determining at what price to buy and sell on each line and how much money.

Algorithm of work

For the bot to work, the trading grid must be set, funds must be allocated to the grid and start orders must be placed.

The bot works on the following algorithm:

  1. Cyclically with a pause the verification procedure is performed. In each cycle of checking the last trades and open orders from the exchange are requested
  2. The trades are analyzed and orders are placed in the opposite direction according to the prices specified in the grid line. For example, if a trade is of BUY type, an order of SELL type is created at the selling price, set in the grid line, with which the trade is matched. The order amount is calculated from the trade amount including the exchange commission. This way the earned money is capitalized after each trade.
  3. For user convenience, the orders are rolled out, if it is possible.
The trades are analyzed, and if they are paired, the profit is calculated. A paired trade - is a trade which completes the cycle of SELL-BUY or BUY-SELL trades. Pair of deals determines profit taking (committing) and depends on the type of the starting order.

A review of the "Bots" tab

In the "Bots" tab, the window consists of two parts:

  • The upper part - the list of bots
  • Bottom part - details on the bot selected in the upper part. The selection is displayed as an orange line.

The following columns are displayed at the top:

  • «ID» - the bot's unique code in the database
  • «Name» - the bot's user representation
  • «Account» - the name of the account through which the bot connects to the exchange
  • «Symbol» - currency pair in the exchange, at which the bot trades
  • «Status» - the current status of the bot. Status can be:
    • means that the bot is running. Complemented by the text «Executing».
    • means that the bot is stopped. Complemented by the text «Stopped».
    • means that the current rate of the symbol is in the active trading grid
    • means that the current rate of the symbol is above the upper range of the active trading grid. In this status the bot actually does not work.
    • means that the current rate of the symbol is below the lower range of the active trading grid. In this status the bot actually does not work.
  • «Current price» - the current rate of the currency pair
  • «At start USDT» - the sum of all start orders at the rate at the moment of start. Calculated on each line of the trading grid and summed up.
  • «Now USDT» - the sum of all currently placed orders at the exchange rate at the moment. Calculated on each line of the trading grid and summed up.
  • «Profit(+)/Loss(-) in USDT» - the difference between the columns «Now USDT» and «At start USDT». If the amount is positive, it means that the bot is currently in profit, if it is negative, it means a loss. This column accumulates the trading profit and exchange rate changes. This column shows - if to cancel all orders and sell the balance at the current rate the following profit or loss will be obtained.
  • «Max profit in USDT» - hypothetical profit, if the rate of a trading symbol will go above the upper active grid line. It is necessary for estimation of the chosen profit and making a decision on closing the bot.
  • «Profit % total / in year». - Profit expressed as a percentage total for the whole period and given for the year. The percentage is calculated in the moment by the column "Profit(+)/Loss(-) in USDT" to the amount at the start in USDT. It accumulates trading profit and profit/loss from increase/decrease of rates. For correct calculation, it is necessary to fill each grid line with the coin rates of the trading pair to BTC and to USDT.
  • «Message counts Err/Warn/Inf/Trade/Total» - the current number of accumulated messages by bot and by type:
    • Err- errors
    • Warn - warnings
    • Inf - informational messages
    • Trade - Trade messages
    • Total - total amount

By this field it is obvious what is happening with the bot. Whether it works or not, whether there are errors or warnings, whether there are trading events.

  • «Days total» - the total number of days of bot trading. The start of trading is calculated as the minimum date on all lines of the bot grid. Number of days - the difference between the current date and the trade start date expressed in days.
  • «Buy trades 24h/7d/30d/365d/total» - Buy trades counter broken down by periods:
    • 24h - for the last 24 hours (sliding window) in units
    • 7d - for the last week (sliding window) in units
    • 30d - for the last month (sliding window) in units
    • 365d - for the last year (sliding window) in units
    • total - total quantity in units

In fact, by this field it is possible to estimate the intensity of trades in buy trades

  • «Sales transactions 24h/7d/30d/365d/total» - Sales trades counter broken down by periods:
    • 24h - for the last 24 hours (sliding window) in units
    • 7d - for the last week (sliding window) in units
    • 30d - for the last month (sliding window) in units
    • 365d - for the last year (sliding window) in units
    • total - total quantity in units

In fact, according to this field it is possible to estimate the intensity of trading in sales trades

  • «BASE current profit 24h/7d/30d/365d/total/% year» - profit in base currency in the symbol of the selected bot by periods:
    • 24h - for the last 24 hours (sliding window) in the amount of base currency
    • 7d - for the last week (sliding window) in the amount of base currency
    • 30d - for the last month (sliding window) in the amount of base currency
    • 365d - for the last year (sliding window) in the amount of base currency
    • Total - total amount of base currency
    • % year - the given estimated percentage of annual profit. Calculated for the period «Total days» from the starting amount of orders and the current amount of orders in the base currency. The obtained value is converted to the annual equivalent.
  • «QUOTE current profit 24h/7d/30d/365d/total/% year» - profit in the second (Quote) currency in the symbol of the selected bot by periods:
    • 24h - for the last 24 hours (sliding window) in the amount of quote currency
    • 7d - for the last week (sliding window) in the amount of quote currency
    • 30d - for the last month (sliding window) in the amount of quote currency
    • 365d - for the last year (sliding window) in the amount of quote currency
    • Total - total amount of quote currency
    • % year - the given estimated percentage of annual profit. Calculated for the period «Total days» from the starting amount of orders and the current amount of orders in the quote currency. The obtained value is converted to the annual equivalent.
  • «Converted to BTC current profit 24h/7d/30d/365d/total/% year» - total profit in base (Base) and second (Quote) currency, converted to BTC at the rate at the moment of trade of the selected bot by periods:
    • 24h - last 24 hours (sliding window) in BTC
    • 7d - for the last week (sliding window) in BTC
    • 30d - the last month (the sliding window) in BTC
    • 365d - for the last year (sliding window) in BTC
    • Total - total amount without period in BTC
    • % year - the calculated percentage of annual profit. Calculated for the period "Total days" from the initial sum of orders at the rate at the moment of start and the current sum of orders at the rate at the moment of trade in BTC. The obtained value is converted to the annual equivalent
  • «Converted to USDT current profit 24h/7d/30d/365d/total/% year» - total profit in base (Base) and second (Quote) currency, converted to USDT at the rate at the moment of trade of the selected bot by periods:
    • 24h - last 24 hours (sliding window) in USDT
    • 7d - for the last week (sliding window) in USDT
    • 30d - the last month (the sliding window) in USDT
    • 365d - for the last year (sliding window) in USDT
    • Total - total amount without period in USDT
    • % year - the calculated percentage of annual profit. Calculated for the period "Total days" from the initial sum of orders at the rate at the moment of start and the current sum of orders at the rate at the moment of trade in USDT. The obtained value is converted to the annual equivalent.
  • «All the time profit BASE/QUOTE/BTC/USDT» - profit for all periods of bot's work, expressed in base currency, second currency, BTC and USDT. This column is needed to track the total amounts of bot earnings, if, for example, the bot's grid was completely or partially removed and a new one was formed

 
The following user actions are available at the top:
  • - Adding a new bot. A window opens for editing the parameters of a new bot.
  • - Editing an existing bot. A window opens for editing the parameters of the selected bot.
  • - Deleting a bot.
  • - Forced recalculation of bot statistics.
  • - Deleting all messages of the selected bot.
  • - Running the selected bot.
  • - Stopping the selected bot.
  • -Archiving the selected bot

 

Adding a new bot and editing an existing bot

After pressing the button a window will open to define the basic parameters of the new bot:

The following fields must be set:

  • «Name» - user representation of the bot
  • «Exchange account» - drop-down list of created accounts. If the list is empty, go to "Accounts" and create an account first
  • «Symbol» - the drop-down list with the list of trading pairs. It is loaded dynamically every time you access it.
  • On the "Trading grid" tab
    • «Exchange trade fee (%)» - the size of the exchange fee. It is used to calculate the order amount and profit on a paired trades. The size of the fee can be different. It is recommended not to take into account in the fee size the cashback from the referral program or other cashbacks, since they are charged later, than the trade is made, therefore the reduced % can lead to an error of insufficient funds when placing orders. By default 0.1%.
    • «Capitalize profit» - if the flag is set, then after a pair of trades SELL-BUY or BUY-SELL the profit gained is added to the working amount in the orders, if not, it is released into free funds in the exchange.
    • «Trade grid step (%)» - the value of the trading grid step in percents. It is used for grid generation and re-generation. Do not change it, so that the rows of the new and old grid are matched at repeated generation.
    • «Trade grid range (% up and down from starting point)» - the size of half of the grid range, expressed as a percentage of the change in the starting rate. It is used during grid generation and re-generation.
    • «Trading grid start point (symbol price)» - the rate of the trading symbol at which the trading grid is calculated. Do not change it, so that at repeated generation the lines of the new and old grid are matched.

 

  • On the "Rates" tab
    • «Currency rates BTC/USDT at start (global trend)" - exchange rate that is used to plot the global coverage chart. The "Set current price BTC/USDT" button will set the current rate
  • On the "Triggers" tab
    • "Triggers on" - flag enabling/disabling the mechanism of using triggers by this bot in general
    • In the "On rate rise" tab
      • "The rate rise trigger is on" - the sign of activation of the trigger for rate rise of a trading pair. If it is switched off, the analysis at growth of a rate is not carried out.
      • "How to determine the trigger price" - the following methods are possible:
        • "Fixed price" - manually indicate the price, at crossing of which the trigger will be triggered from bottom to top (growth of the rate)
        • "% top line" - the price is calculated as follows: the uppermost active (included) line of the trading grid is taken, the selling price is taken from this line, the specified percentage is added to this price. At crossing of this price from bottom to top the trigger will be triggered. The shift is set by the percentage - if the percentage is negative, the price shift is negative.
        • "Profit %" - The trigger is activate when the current profit percentage in USDT is exceeded. As the current value, the column "Current profit % total/year" in the list of bots is taken, if it's more or equal than specified, the trigger is triggered.
      • "Actions when trigger is activated" - the following options are possible:
        • "Stop bot" - the bot will stop and the automatic start of the bot will be disabled. In fact, this action only stops the trade on the bot, while the orders currently placed will not be canceled and may be executed by the exchange in the future.
        • "Archive the bot" - the bot will be sent to archive: all orders will be cancelled, the amounts of orders placed, profit/loss values, all statistics on the grid will be fixed at the moment of archiving, trading will stop, and the bot will be moved to archive.
      • "Place a market order for "BASE CURRENCY" after completion" - an indication of the need to place a market order for conversion after the completion of the action in the base currency when cancelling orders. This will only work if the "Archive bot" action is selected, since only during archiving the orders are cancelled and the amounts are released. Select the type of market order and trade pair in the fields below. The amount will always be equal to the amount of released coins.
      • "Place a market order for "SECOND CURRENCY" after completion" - an indication of the need to place a market order to convert the released amounts in the second currency upon order cancellation. This will only work if the "Archive bot" action is selected since only during archiving the orders are cancelled and amounts are released. Select the type of market order and trade pair in the fields below. The amount will always be equal to the amount of released coins.
    • In the "On rate fall" tab
      • "The rate fall trigger is on" - sign of activation of the trigger on exchange rate fall of a trading pair. If it is switched off, the analysis is not carried out when the rate falls.
      • "How to determine the trigger price " - the following methods are possible:
        • "Fixed price" - manually specify the price, at which the trigger will be triggered at top-down crossing (falling of the rate)
        • "Bottom line %" - the price is calculated as follows: the lowest active row in the trading grid is taken, the purchase price is taken from this row, the specified percentage is added to this price. At crossing the price from top to bottom (price drop) the trigger will be triggered. The shift is set by percentage - if the % is negative, the price shift is negative.
        • "Loss %" - The trigger is activated when the current loss percentage in USDT is exceeded. The loss is set as a negative percentage. As the current value, the column "Current % total/year" in the list of bots is taken
      • "Actions when the trigger is activated" - the following options are possible:
        • "Stop bot" - the bot will stop and the automatic start of the bot will be disabled. In fact, this action only stops the trade on the bot, while the orders currently placed will not be canceled and can be executed by the exchange in the future.
        • "Archive the bot" - the bot will be sent to archive: all orders will be cancelled, the amounts of orders placed, profit/loss values, all statistics on the grid will be fixed at the moment of archiving, trading will stop, and the bot will be moved to archive.
      • Place market order for "BASE CURRENCY" after completion - an indication of the need to place a market order for conversion after the completion of the action in the base currency when cancelling orders. This will only work if the "Archive bot" action is selected, since only during archiving the orders are cancelled and the amounts are released. Select the type of market order and trade pair in the fields below. The amount will always be equal to the amount of released coins.
      • Place a market order for "SECOND CURRENCY" upon completion - an indication of the need to place a market order to convert the released amounts in the second currency upon order cancellation. This will only work if the "Archive bot" action is selected since only during archiving the orders are cancelled and amounts are released. Select the type of market order and trade pair in the fields below. The amount will always be equal to the amount of released coins.
    • On the "Execution options" tab
      • «Auto start» - flag which, if set, will automatically launch this bot at program startup.
      • «Pause between iterations (seconds)» - the bot work cyclic (see description of algorithm), this parameter defines pauses between iterations of cycles. It directly affects the number of requests to the server per minute. A too small parameter will lead to an accumulation of queues of requests to the server, too large reduces the reaction time of the bot to the transactions made on the exchange. By default, the recommended parameter is 30 seconds.
      • «Log» - a flag that, if set, records all messages in a text file in the directory with the GridBot2.exe file. The file name is automatically generated according to the program start time (Year, month, day, hour, minute, second), for example: 2021_4_29_15_5_6_log.txt. If the flag is not set, no messages will be written to the log file for this bot.
A similar window, but with the values filled in earlier will open on the button .

Starting and stopping the bot

Trading is understood as placing orders on the exchange and receiving completed trades from the exchange. These actions are performed only during the operation of the bot. All actions on setting up, creation of starting orders are carried out within the base and create only tasks on placing or cancellation of orders. A running bot performs such actions in a cycle. When the bot is stopped, these procedures stop their cyclic execution.

 

Bot details

At the bottom of the "Bots" tabbed window for the selected bot, the following tabbed data is displayed:
  • - The trading grid of the bot. For more information about the trading grid, see the appropriate section
  • - Statistics of the bot grid. Detailed statistics on each row of the grid by number of trades and profitability.
  • - Statistics by day. Bot stats collapsed by day.
  • - Trades. List of all trades on the selected bot.
  • - Current open orders. Orders currently open on the exchange.
  • - History of Orders. All historical information on the orders of this bot.
  • - List of bot errors in the current session.
  • - List of bot warnings in the current session.
  • - List of information messages of the bot in the current session.
  • - List of trade messages of the bot in the current session.
  • - - Full log of bot messages in the current session.