Spot Grid

Published on Jun 17, 2022Updated on Nov 15, 20249 min read

Introduction to OKX Spot Grid Bot

Spot Grid Bot uses a grid bot that’s designed to buy low and sell high automatically to maximize profits in a volatile 24/7 crypto market.Grid bots are automated trading strategies designed to place buy and sell orders at predetermined intervals within a predefined price range. They’re designed to capitalize on price fluctuations and perform best in volatile markets.

How does OKX Spot Grid Bot work?

Spot grid mode splits your starting capital between the two assets of your chosen trading pair. It then creates a grid of price points between the upper and lower bounds, and divides your starting funds equally between the number of grids used.Each time the price reaches the upper grid line, the bot automatically sells a portion of the asset. The bot automatically buys the traded asset when the price reaches the lower grid line. The trader profits from the difference between the buys and sells executed as the price swings.

How to get started

Web: Navigate to Trade, select Trading bots - Marketplace, and click Spot grid.

spot grid 1
spot grid 2

App: Navigate to Trade, select Trading bots, and press Spot grid.

spot grid 3

Enter parameters manually, copy lead traders' bots, or use backtested AI parameters, and confirm the total investment amount to create a Spot grid bot (After you create a bot, the initial funds will be isolated from your Trading account and used for grid trading only).

Setup Options

futures grid 3
  • Set myself: Set parameters based on your own analysis of the market.

  • Set myself - Auto fill: Automatically fill in parameters recommended by the trading bot, based on backtested strategy.

  • AI strategy: Use the parameters recommended by backtested strategy (These parameters are based on a weekly backtest of this pair).

  • Lead bots: Copy lead traders' winning bots on the Marketplace in one-click

Grid Trading Parameters

spot grid 4
  1. Lower limit: The bot will stop placing orders when the market price is lower than the lowest price.

  2. Upper limit: The bot will stop placing orders when the market price is higher than the highest price.

  3. Grid quantity: The number of grids represents the corresponding shares divided within 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.

  4. Grid - Arithmetic grid: It keeps the same common difference between each grid. (For example: 1, 2, 3, 4.)

  5. Grid - Geometric grid: It keeps the same common ratio between each grid. (For example: 1, 2, 4, 8.)

  6. Asset: Users can choose to invest either in the base currency or the quote currency or invest in both.

  7. Amount: It refers to the amount of chosen currency invested in the Trading bot. The maximum available amount of the chosen currency equals the current maximum transferable amount of that currency in the Trading account.

  8. Take-profit (TP) price: The Bot will stop working when the price reaches TP price, and the bot will sell all base assets at corresponding market price.

  9. Stop-loss (SL) price: The Bot will stop working when the price falls to the SL price, and the bot will sell all base assets at corresponding market price.

  10. Trailing Grid (Up/Down): The bot can automatically adjust the grid to enhance the flexibility of the strategy, improve capital utilisation, grasp the investment opportunities of market fluctuations, to avoid missing such market opportunities.

    In a scenario where the market is bullish - the lowest grid pending order is cancelled and a pending order is placed one grid above the highest grid, leaving the overall range size unchanged and moving up. For example, if there are 5 grids between 25,000 - 30,000 USDT, each with a spread of 1,000 USDT, and the price of BTC/USDT breaks above 30,000 USDT in a bullish market, the lowest pending order of 25,000 USDT will be cancelled and a new order at 31,000 USDT will be placed.

    In a scenario where the market is bearish - a new order is placed only under the lowest grid, expanding downwards and making the range larger. For example, if you set up 5 grids between 25,000 - 30,000 USDT, each with a spread of 1,000 USDT, and the price of BTC/USDT falls below 25,000 USDT in a declining market, you will place a pending order at 24,000 USDT, one grid below 25,000 USDT. The number of grids will be expanded to 6 grids.

Managing your Spot Grid bot

Web: Head to OKX Trading Bots homepage, and select 'My bots'. You will be brought to a Bot Dashboard where you can manage your running bots.

bot management 1
spot grid 6

App: Head to OKX Trading Bots homepage, and select 'My bots'. You will be brought to the "My bots" page where you can manage your running bots.

bot management 2

Grid bot management features

spot grid 7
  1. Modify Parameters: You can now adjust your grid bot parameters even after the bot is created. Editing predefined price range and the number of grids is now supported for greater flexibility.

  2. Stop your bot: When you stop this bot, the system will cancel all pending orders and sell your crypto at market price. Funds from the sale will be returned to your trading account.

  3. Details: View more details about your running bot by accessing the Bot Details page.

  4. Replicate parameters: One-click set-up to recreate your running bot with the same parameters

  5. Withdraw profits: The total withdrawable grid profit. The profits will be transferred to your trading account.

Case Example

  • Trading Pair: BTC/USDT

  • Lower price: 50,000 USDT

  • Upper price: 100,000 USDT

  • Grid quantity: 50

  • Grid mode: Arithmetic

  • Investment Amount: 5,000 USDT

  • BTC price when strategy is activated: 60,100 USDT


Running the Bot

  1. Stage 1 - Initial order placement: The system will calculate the price of each grid level, which will be 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. Once a buy order in a grid gets filled, the corresponding sell order will be opened one level above. Upon bot initialisation, 50 buy orders will be placed all the way from 50,000 USDT, 51,000 USDT, 52,000 USDT...99,000 USDT. With the market price at 60,100, all the buy orders from 61,000 USDT and upwards will be filled immediately, and corresponding sell orders will be raised for each of the filled buy orders. Finally, the bot will have a buy order at each grid level from 50,000 USDT to 60,000 USDT and a sell order at each grid level from 62,000 USDT to 100,000 USDT.

  2. Stage 2 - Bot operation: A buy order will be filled when the price drops below 60,000 USDT, and in the meantime, a sell order will be opened at the nearest grid level above (61,000 USDT). Alternatively, if price rises above 62,000 USDT, the sell order at 62,000 USDT will be filled, and in the meantime, a buy order (61,000 USDT) will be opened at the nearest grid level below.

  3. Scenario - Bot out of range: If the market price falls outside the price range, you can choose either to edit the preset price range, terminate the strategy, or wait for the price to return to the range you’ve set. If you have chosen to terminate your bot, all your pending orders will be canceled and your positions will be closed at the current market price. Your assets will be credited automatically to your Trading account.

In this way, the Trading bot helps you make profits by buying and selling orders at a predefined price range. It allows you to take advantage of fluctuating market prices.

Risk reminder and notes

  1. If the price falls below the lower price of the defined price range, the bot will not continue to place additional orders. If the price continues to fall and does not return back to the pre-defined range, the crypto asset held at this time will suffer losses. Therefore, it is recommended to set a stop-loss price below the lower price to avoid taking excessive risk on your position.

  2. The fund invested in the grid will be isolated from your Trading account and used independently for the Trading bot. Therefore, users need to pay attention to the risk of overall positions in your Trading account after transferring funds.

  3. Your assets will be sold at market prices when the Bot is stopped manually or when the stop-loss price is triggered.

  4. While the spot grid bot is running, if it encounters unpredictable circumstances such as suspension or delisting of the underlying crypto asset, the bot will be automatically stopped.