- Spot grid
- Time-weighted average price (TWAP)
All strategies in the current document are temporarily not supported under portfolio accounts
I. Grid trading
1. What is spot grid trading?
Spot grid trading is an automated strategy to buy and sell assets in a specific price range. It creates a grid of gradual orders, placing them above and below a base price you set. Spot grid trading can help you benefit from price volatility.
2. Use cases of spot grid trading
The core of spot grid trading is “buy low and sell high”, which works best in fluctuated and rising markets. Beware that a bearish market may also cause losses.
3. How do I set up a spot grid trading bot?
（1) Enter OKEx on your PC or mobile and navigate to Trade, select Trading bot mode (at the top left corner on the web and top right corner on the mobile app), and click Spot grid.
（2) Enter parameters or choose to use backtested parameters on the trading interface and confirm the initial amount to create a grid trading bot（After you create a bot, the initial funds will be isolated from your trading account and used for grid trading only).
（3) You can view and manage your bots on Bot page.
（4) After the bot runs, you can withdraw your earnings or stop the bot anytime.
3.2. Terms and parameters:
Set myself: Set parameters based on your own analysis of the market.
AI strategy: Use the parameters recommended by backtested strategy (These parameters are based on a weekly backtest of this pair).
Grid trading parameters:
Lowest price： The bot will stop placing orders when the market price is lower than the lowest price.
Highest price：The bot will stop placing orders when the market price is higher than the highest price.
Number of grids: The number of grids represents the number of pending orders divided in the price range. For example, if the price range is 100-400, the mode is arithmetic, and the number of grids is 3, it is divided into three grids: 100-200, 200-300, and 300-400.
Asset：Users can choose to invest in either the trading currency or the quote currency or invest in both.
The investment: It refers to the amount of each currency invested in the Trading bot. The maximum available amount of each currency equals the current maximum transferable amount of the currency in the Trading account.
Arithmetic grid: It keeps the same common difference between each grid. (For example: 1, 2, 3, 4.)
Geometric grid: It keeps the same common ratio between each grid. (For example: 1, 2, 4, 8.)
Take-profit price: The Bot will stop working when prices increase to this price level, and the base assets purchased will be sold.
Stop-loss price: The Bot will stop working when prices fall to this price level, and the base assets purchased will be sold.
3.3. Take BTC/USDT as an example:
The lower price: 50,000 USDT
The upper price: 100,000 USDT
The grid number: 50
The mode: Arithmetic
The investment: 5,000 USDT
BTC price at the time of creation: 60,100 USDT
Run the Bot
Stage 1-Initial order placement: The system will calculate the price of each grid, which are 50,000 USDT, 51,000 USDT, 52,000 USDT...98,000 USDT, 99,000 USDT, 100,000 USDT, and then place buy orders in each grid. If the market depth is great, the sell order will be opened in the nearest grid above upon the completion of the buy order, and the buy order will be opened in the nearest grid below. That is, after the Bot starts, there is a buy order at each grid from 50,000 USDT to 60,000 USDT and a sell order at each grid from 62,000 USDT to 100,000 USDT.
Stage 2-Bot operation: A buy order will be executed when prices drop below 60,000 USDT, and in the meanwhile, a sell order will be opened in the nearest grid above (61, 000 USDT). If prices rise, a sell order will be executed, and in the meanwhile, a buy order will be opened in the nearest grid below.
In this way, the Trading bot helps you make profits by buying and selling orders at predefined price intervals. It allows you to take advantage of fluctuating market prices.
Risk reminder and notes:
- If the price falls below the lowest price in the range, our system will not continue to place the order. If the price continues to fall and does not return to your range, the trading currency held at this time will suffer losses. Therefore, it is recommended to set a stop-loss price at a proper point below the lowest price of your range to stop this loss in time.
- The funds invested in the grid will be isolated from your Trading account and used independently in the Trading bot. Therefore, users need to pay attention to the risk of overall positions in your Trading account after transferring funds.
- Our system will sell your assets at market price when the Bot is stopped manually or when the stop-loss price is triggered. If the risk management system judges that it will bring risks to the market, it may fail to sell your assets, but you can determine whether to sell them manually.
- During the operation of the grid trading, if the asset encounters unpredictable circumstances such as suspension or delisting, the grid trading will be automatically suspended.
II. Iceberg strategy
1. What is the Iceberg strategy?
Iceberg strategy automatically splits your order into several smaller ones.
An iceberg strategy is an algorithmic order type allowing users to avoid place a large order while avoiding slippage. An iceberg order automatically breaks up a user´s large order into multiple smaller orders. These orders will be placed on the market according to the latest best bid and ask price as well as the parameters set by the user. When one of the smaller orders has completely filled, or the latest market price has deviated significantly from the price of the current order, a new order will be placed automatically.
A user would like to buy BTC at a price below 20,000 USDT and does not want to increase the cost. He can set an iceberg order:
Price variance: 0.1%
Price limit: 20,000 USDT
Average amount: 2 BTC
Total amount: 100 BTC
Run the Bot
The system will automatically place an iceberg order. The order price will be the latest buy price* (1-Price variance 0.1%), and the amount of each order will be 50% to 100% of the single average amount (2). Once the order completely filled, a new order will be placed.
When the last market price exceeds the highest buy price of 20,000 USDT, the iceberg order would be temporarily halted. After the price falls down to 20,000 USDT, the iceberg order would be recommenced.
When the last market price exceeds 2*(Price variance), the previous order would be canceled, and a new one will be placed.
When the total trading volume equals its total amount, the Bot will stop the order and end its operation.
III. Time-weighted average price (TWAP)
1. What is the Time-weighted average price?
Time-weighted average price (TWAP) strategy splits your order and places smaller orders at regular time intervals.
It is a strategy that will attempt to execute an order which trades in slices of order quantity at regular intervals of time as specified by users. The purpose of TWAP is to minimize the market impact on basket orders. This bot triggers the order based on the predefined time intervals. It calculates the order price based on the current best bid/offer price，then splits the order into smaller ones and places them on the market(If the order is not fully filled, it will be canceled directly according to the IOC order rules).
Assume that user A wants to buy BTC contracts below 10,500 USDT as soon as possible without increasing the purchase cost on the current market, so user A sets up a TWAP bot as follows:
Price variance: 1%
Price limit：10,500 USDT
Average amount：500 contracts
Total amount：10,000 contracts
Run the bot
After the order is placed，the system will place orders at regular time intervals. Assuming the order book as below:
According to the predefined price range, the highest buy price equals the BBO, which is 10029.99*(1+price range 1.0%) = 10130.29 USDT. The total amount of sell orders below 10130.29 USDT is 570+1+200+1+1+1+1=775，and multiply the random number between 0.5 to 1 to get the order amount=（0.5~1）=775*63%=488.25 contracts. The order amount is less than the predefined average amount of 500 contracts, so the bot buys 488 contracts of sliced order at 10130.29 USDT. If the order is not fully filled, it will be canceled directly, which means the sliced order is an IOC order.
The bot will place orders constantly based on the predefined time intervals*random ratio（0.5~1）until the total filled amount reaches the predefined total order amount.
The bot will place the order at the limit price if the order price is higher than the predefined limit price.
If the order amount is more than the predefined average amount, the bot will place the order based on the average amount* random ratio（0.5~1).
The order will be suspended when the last price (20,500 USDT) is higher than the limit price and resumed when the last price is below 10,500 USDT again.
The bot will stop when the total filled amount equals the total order amount.