Grid
Introduction
Grid trading is a type of quantitative trading strategy. This trading bot automates buying and selling on spot trading. It is designed to place orders in the market at preset intervals within a configured price range. Grid trading is suitable for use in volatile market, not suitable for unilateral rise and unilateral fall.
ChainUp provides the spot grid trading function, which is a positive grid. When the strategy is activated, a buy order will be placed from top to bottom. After each buy order is completed, a sell order will be placed at the price above it.
Glossary:
Lower Price: Bottom of the grid trading price range. The system will no longer execute orders when the market price is lower than the Lower Price.When the price returns above the range minimum price, the order will continue to be placed. If the user sets Stop price, when the stop price is triggered, the grid strategy is terminated.
Upper Price: Top of the grid trading price range. The system will no longer execute orders when the market price is higher than the Upper Price.When the price returns below the range highest price, the order will continue to be placed. If the user sets Take profit price. When the take profit price is triggered, the grid strategy is terminated. The highest price cannot be lower than 102% of the lowest price.
Grid Quantity: Divide the price range into corresponding “N-1” parts. The larger the number (the denser the grid), the more capital you need to invest. The number of grids must be between 2-100 (inclusive).
Grid type: Arithmetic grid & Geometric grid
Investment assets: the total amount of denominated currency planned to be invested. According to the total investment, the amount of funds to be used in each grid can be calculated. The specific logic is shown below.
Take Profit: should be higher than the upper price, last price and trigger price; when the latest market price reaches Take Profit price, the grid will stop working.
Stop Loss: should be less than the lower price, last price and trigger price; when the latest market price reaches the Stop Loss price, the grid will stop working.
Use the original BTC: The BTC here refers to the base currency of the coin pair. You can choose to invest in single or dual crypto.Different strategies require different funds for each grid. For example, if you chose to invest by USDT, the strategy will only use USDT from your Spot Wallet. If you choose to invest by USDT+BTC, the strategy will use both USDT and BTC from your Spot Wallet.
Profit per grid:
The profit per grid of the equal difference grid is an interval range:
Max = ((the highest price - the lowest price) / (the number of grids - 1) / the lowest price) - maker handling fee * 2;
Min =((Highest Price-Lowest Price)/(Grid Quantity-1))/(Highest Price-((Highest Price-Lowest Price)/(Grid Quantity-1))) - maker handling fee * 2;
Profit per grid of proportional grid =((highest price/lowest price) ^(1/ (grid number - 1) ) - maker handling fee * 2 - 1, which is fixed;
The profit of each grid is the net profit after deducting the handling fee. The minimum profit rate of each grid must be greater than 0. Otherwise, it will prompt: the profit of each grid is too small, please reset it.
Transaction logic
Transaction Mode
Arithmetic Grid
The arithmetic grid divides the price range from Lower Price to Upper Price into the number of grids by equal price difference.
The price difference of each grid is:
Spread = (Upper Price - Lower Price) / Number of grids
The price distribution will be as follows:
Price_1 = Lower Price
Price_2 = Lower Price + Spread
Price_3 = Lower Price + Spread * 2
…
Price_n = Lower Price + Spread * (n-1)
The highest price is Upper Price, where n = the number of grids.
Example: Arithmetic Grid = 100: 1000, 1100, 1200, 1300, 1400,... (the next price is 100 higher than the previous one)
Geometric Grid
Geometric mode: Each grid has an equal price difference ratio. Price range of each cell of the geometric grid is proportional (e.g. 1, 2, 4, 8...). The profits are fixed between each grid.
The price ratio of each grid is:
Ratio = (Upper Price / Lower Price) ^ (1/(n -1)) * 100%
n = the number of girds
The price distribution will be as follows:
Price_1 = Lower Price
Price_2 = Lower Price * Ratio
Price_3 = Lower Price * Ratio ^ 2
…
Price_n = Lower Price* Ratio ^ (n-1)
The highest price is the Upper Price, where n = the number of grids.
Order Mode
Custom strategy
Users can set parameters such as the highest price in the range, the lowest price in the range, the number of grids, and the investment amount. After the settings are complete, click Generate Strategy, and the system will automatically place an order and trade for you.
AI strategy
The system will select the optimal strategy parameters to fill in based on the historical backtest data, and the user only needs to set the investment amount.
Note: The 7-day grid annualized backtest, single grid profit rate and other data are backtested through historical data and do not represent your future income.
How to set up a Grid Trading strategy?
You can use Grid Trading strategy to buy low and sell high. Let’s use BTC/USDT as an example. Suppose your strategy parameters are set as below:
Upper price: 60,000 USDT
Lower price: 40,000 USDT
Number of grids: 6
Mode: Arithmetic
Amount invested: 10,000 USDT
Current price of BTC/BUSD: 50,000 USDT
The price structure of this strategy will be placed at 60,000 USDT, 56,000 USDT, 52,000 USDT, 48,000 USDT, 44,000 USDT, and 40,000 USDT according to the parameters you set.
When the grid is started: as the upper price is set at 60,000 USDT, the grid strategy will begin by placing a buy order at 56,000 USDT. This buy order price is higher than the current price (50,000 USDT), so in theory it will be immediately filled. After the 56,000 order is filled, a new sell order will be placed at 60,000 USDT. When the buy order at 52,000 USDT is filled, a sell order of 56,000 USDT will be placed accordingly and reaches the 48,000 USDT grid. As the current price is 50,000 USDT, the buy order at 48,000 cannot be filled, therefore no orders will be placed at 52,000 USDT. Similarly, the buy orders at 44,000 and 40,000 USDT will not be filled, the order placement will be as follows:
60000
Sell
56000
Sell
52000
No orders will be placed
48000
Buy
44000
Buy
40000
Buy
After the grid starts: when the current price drops to 48,000 USDT, the buy order will be filled and a sell order will be placed at 52,000 USDT. When the market price pulls back to 52,000 USDT, the sell order will be filled and a buy order will be placed at 48,000 USDT to buy low and sell high.
When the BTC price rises above 60,000 USDT or falls below 40,000 USDT, the strategy will be suspended. When the price returns to the price range you set, the strategy will resume.The logic is shown in the figure below:
When the grid is actually started, it will calculate the actual amount of the base currency and the reserved handling fee amount that need to be sold by the pending order according to the above principles, and then buy the base currency through the market order and place the pending order.
Background config
Master Switch
Path: System Config → Basic Config → KV Config, search for "grid_trade_switch", and turn on the grid trade switch, as shown in the figure below.
Coin Pair Switch
On the currency pair configuration page, select the currency pair that you want to support grid trading, and enable the grid switch, as shown in the figure below.
Users can select supported currency pairs on the transaction page to conduct grid transactions, as shown in the figure below.
Users can view the grid strategy being executed and the completed strategy at the bottom of the trading page, as shown in the figure below.
Click [Details] to view the running time, yield, executed and executing orders data of the current grid strategy.
Click [Stop Grid], the user will cancel the grid trading order by himself. When you do this, your earnings will be settled at the current market price.
Last updated