Trading Bot Guide

Grid trading is a strategical tool of quantitative trading that allows users to place a series of buy and sell orders within a set price range in a ranging market. By automatically executing buy low and sell high, it guarantees the selling price is higher than the buying price each time, so as to make profits from sideways trends. Simply put, grid trading refers to that users determine the lowest and highest grid price, and the number of grids. Once the grid is created, the system will place buy and sell orders at certain regular intervals. Sell orders will be placed at grids above the latest price, and buy orders will be placed at grids below the latest price. If one of the grid orders is filled as the grid strategy is running, the system will help automatically place another order in the opposite direction. Repeatedly, the system will automatically buy low and sell high until the termination condition is triggered.

 

Risk reminder:

When users activate a grid trading for the first time, the “risk reminder” will automatically pop up. It is recommended that users should read, understand and accept the agreement before trading.

 As a strategic tool, grid trading does not guarantee any profits. After the trend is broken in a volatile market, it may cause losses or liquidation. It is recommended that users should rationally judge their capability against risks and make decisions prudently.

 

I. Life Cycle and Status of Grid Trading

Life Cycle: Order placing =》To be triggered (optional) =》Being initialized =》Running Grid=》Grid Termination

Status:

  • To be effective: only if the trigger price parameter has been set while creating the grid trading and has not been reached, the grid will be in this status;
  • Being generated: the process of being initialized after being effective, in which the system configures all the grid prices and order amount based on the preset parameters, then place buy and sell orders accordingly;
  • Running: once initialized, the strategy will come into force.
  • Being terminated: when the termination condition is triggered, the system will determine whether to cancel orders and close positions based on the parameters set by users;
  • Terminated: After the system cancels all orders and closes all positions according to the parameters set by users, the grid trading is terminated.

 

II. Operation Procedures

1. Log in to huobi.com and click “Trading Bot” on the trading page;

2. Choose Manual, set strategical parameters and click “Create”, then click “Confirm” after checking all parameters;


Required: Contract, Leverage, Grid Price (the lowest and highest grid price), Price Mode (Arithmetic or Geometric), Grid Number, Amount Mode (Equivalent Quantity/Amount), Deposit Margin;

Optional: Trigger Price, Conditions of Termination, Effective Duration, Termination Operation.

3. A grid in running is available to “Terminate”, “Share” and view “Details”.

Click “Details” to view details; Please note that users are able to revise the trigger price before a grid trading is triggered and can revise the “Conditions of Termination”, “Open Orders” and “Order History” are available to view.

 

Click “Close” to terminate the grid.

 

4. The “Closed” grids, you can view their termination reasons, and you are available to view “Details” and “Execute”.

Click “Details” to view grid details, but the settings cannot be modified then. 

Click “Share” to share you P/L of the grid;

Click “Execute” to set another grid strategy by directly using parameters of this grid.

 

III. Example  

Assume the latest price of BTC/USDT swaps is 14,800USDT, Tom executes a grid trading strategy with the following parameters (Maker fee = 0.02%, Contract face value = 0.001 BTC, Usable coefficient = 1.1):

The highest grid price: 20,000USDT;

The lowest grid price: 10,000USDT;

Grid number: 10

Leverage: 10;

Price mode: Arithmetic

Amount mode: Equivalent Quantity;

Deposit margin: 30 USDT

Condition of termination: 9,000USDT;

Termination operation: Cancel and Close All;

 

To calculate based on the parameters above:

·  Spread of arithmetic grid= (The highest grid price – The lowest grid price) / (Grid number) = (20,000 – 10,000) / 10 = 1,000 USDT;

·  Place an order every 1000USDT between 10,000 USDT and 20,000 USDT. When the grid is in initialization, no order will be placed at the grid price of 15,000 USDT because it is the nearest to the latest price 14,800USDT. Meanwhile, the sum of open price of all orders = 20,000 + 19,000 +.... 11,000 + 10,000 = 150,000 USDT;

·  Equal quantity: Quantity of a single order = (Deposit margin / Usable coefficient) * Leverage / [Face value * sum (Open price of all orders) * (1 + Leverage * Maker fee] = (30 / 1.1 * 10) / [0.001 * 150,000 * (1 + 10 * 0.02%)] = 1.8145, which will be rounded down to 1 cont.

After the grid is initialized, grid orders are placed as below:

If the market price rises from 14,800USDT to 16,500USDT, the sell order of 16,000USDT is filled and grid orders are updated as follows:

(Note: at this time, the ID of the position-closing order of 15000USDT will be recorded in the position-opening order of 16,000USDT. These two orders are regarded as a pair.)

Meanwhile, the latest price declines from 16,500USDT to 13,500USDT, the buy orders of 15,000USDT and 14,000USDT are filled, and grid orders are updated as follows:

Furthermore, the latest price slumps to 9,000USDT and reaches the termination condition, the strategy will be terminated and the system will close all positions with all orders cancelled according to the previous setting. The grid orders are updated as below before the termination of the strategy

 

Besides, when the latest price exceeds the lowest/highest grid price and the grid is initialized, the grid orders are placed as below:

·  When the latest price is lower than the lowest grid price:

·  When the latest price is higher than the highest grid price:

 

IV. Conditions of Termination

1. Orders fail to be placed (due to insufficient available margin, liquidation caused by closing positions, Insufficient available close amount or exceeding price limit);

2. There occurs order operation triggered by non-grid trading (Placing/cancelling an order actively, closing a position, delivery of Futures or liquidation);

3. The preset termination price is reached;

4. Users take the initiative to terminate the grid trading;

5. The strategy running time exceeds the preset effective duration.

 

V. Parameters of Grid Trading

 

Notes:

1. The grid trading and ordinary trading are mutually exclusive. If there are open orders (including limit order, trigger order, sl/tp order and trailing stop order) or existing positions for the current contract, the grid strategy will not be supported;

2. Please note that when the grid trading is initialized, no order will be placed at the nearest grid price to the latest price; Sell orders will be placed at grids above the latest price, and buy orders will be placed below the latest price;

3. If users do not set the termination operation, the remained open order will be transferred to ordinary orders after the grid is terminated. Once filled, it will not trigger an order placed in an opposite direction;

4. Partial fulfillment will not trigger an order to be placed in the opposite direction, therefore long and short positions may be held at the same time;

5. When users set “Cancel and Close All”, the system cannot guarantee the position-closing order to be placed successfully or the positions to be closed successfully. It wholly depends on the market conditions and position risks at the time.

6. No more than 10 grid tradings are allowed to run in a user account.