Detailed Guide: How the Grid Bot Works

Table of Contents

1. Overall Model

The bot utilizes a Grid Trading architecture. Instead of trying to predict the direction of the market, the bot places a "ladder" (grid) of Buy and Sell Limit orders at predetermined price intervals within a specific range. As the price moves up and down naturally (volatility), the bot automatically executes these orders: buying when the price drops to a grid line, and placing a corresponding sell order at the next grid line up. This continuously harvests small profits from market fluctuations.

Each trading pair is managed by its own independent background worker, ensuring rapid order replacement without being delayed by other active pairs.

2. Lifecycle of a Grid Trade

[Wait for Trigger Condition (e.g., EMA Cross)] 
        |
        v
[Initial Allocation] -> Buy required base asset at Market to fund Sell orders
        |
        v
[Grid Constructed] -> Resting LIMIT Buy/Sell orders placed on Exchange
        |
        +-- Price hits Buy order  -> Fills, places new Sell order 1 step higher
        |
        +-- Price hits Sell order -> Fills, places new Buy order 1 step lower
        |
        +-- Price breaks Ceiling  -> [Sliding Grid shifts range UP] or [Wait]
        |
        +-- Price breaks Floor    -> [Trailing Down shifts range DOWN] or [DCA Safety Net triggers]
        |
        v
[Grid Equity TP / SL Hit] -> Market Sell all assets, cancel open orders, stop pair.

Note on Orders: Unlike our DCA bot which uses reactive Taker orders, the Grid Bot actively places Resting LIMIT Orders on the exchange order book. This allows you to capture Maker Fees (which are often lower or even zero on some exchanges/tiers), maximizing the profitability of high-frequency scalping.

3. Grid Construction & Modes

3.1. Auto Range vs Manual Range

3.2. Arithmetic vs Geometric Grid

When the bot divides your range into steps (Grid Count), it uses one of two mathematical models:

Mode How it works Best Used For
Arithmetic Each grid step has the exact same absolute price difference (e.g., $100, $110, $120). Stable, sideways markets operating within a relatively tight and predictable price range.
Geometric Each grid step has the exact same percentage difference (e.g., +1%, +1%, +1%). Price steps widen as price goes up. Highly volatile markets or extremely wide grid ranges (where a $10 move at the bottom is significantly larger in % than a $10 move at the top).

4. Grid Pro Features (Sliding & Trailing)

A traditional grid bot stops generating profit if the price breaks out of the Ceiling or drops below the Floor. Prime Spot Grid Bot solves this with Pro Tracking features.

4.1. Sliding Grid (Infinity Grid)

If the market enters a strong bull run and breaches your Grid Ceiling, a standard grid will have sold all assets and sit idle. By enabling Sliding Grid, the bot automatically cancels lower un-filled buy orders and shifts the entire grid range upward to follow the price. This effectively creates an "Infinity Grid" that never runs out of upper range.

4.2. Trailing Down

Conversely, if the market crashes through your Grid Floor, your grid becomes stuck holding bags at a loss. Trailing Down detects this and dynamically pulls your Grid Ceiling and Floor lower. By shifting the grid down alongside the falling price, the bot can immediately resume capturing volatility at the new lower baseline, rather than waiting weeks for the price to recover to the old range.

5. DCA Safety Net (Loss Recovery)

If you prefer not to use Trailing Down, you can enable the DCA Safety Net. This acts as a hybrid grid-DCA system.

6. Risk Management (Grid Equity TP & SL)

Grid risk management is fundamentally different from single-trade management. Because a grid constantly buys and sells, holding varying amounts of assets and USDT at any given time, traditional Stop Losses do not work well.

Prime Spot Grid Bot uses Total Grid Equity for risk management. Equity is calculated as: (Available USDT in Grid) + (Value of Held Base Asset at Current Price).

7. Minimum Order Size & Dust Handling

8. Reliability & State Recovery

9. Full Configuration Parameter Table

ParameterMeaning
capitalTotal USDT allocated to build the entire grid.
grid_ceiling / grid_floorThe upper and lower bounds of the trading range.
grid_countTotal number of buy/sell steps within the range.
grid_mode"Arithmetic" (fixed price step) or "Geometric" (fixed % step).
use_auto_rangeEnable automatic calculation of Ceiling/Floor on startup.
auto_range_typeMethod for auto range (Recent High/Low, Bollinger, ATR).
trigger_typeWhen to start the grid (Immediate, Fixed Price, EMA Cross).
use_sliding_gridShifts grid up if price breaks the Ceiling.
use_trailing_downShifts grid down if price breaks the Floor.
use_dca_safety_netEnables Martingale recovery below the Grid Floor.
equity_tp_percentTarget % profit based on Total Grid Equity to close the bot.
equity_sl_percentMaximum % loss based on Total Grid Equity to cut losses.

10. Current Limitations to Be Aware Of

  1. API Rate Limits: Setting an extremely high grid_count (e.g., > 150) across multiple pairs simultaneously can trigger Binance's API rate limits when the bot attempts to place or cancel hundreds of orders at once. Keep grid counts reasonable (20 - 80 is optimal for most ranges).
  2. Downtrend Risk: A grid bot is essentially a long-biased strategy. It buys as the price falls. In a sustained, aggressive bear market, if you do not use Stop Loss or Trailing Down, the bot will eventually convert all your allocated USDT into the depreciating asset (bag holding).
  3. Trigger Latency: If using a Fixed Price trigger, the bot checks the price via websocket. Extreme flash wicks lasting less than 500ms might occasionally be missed before the bot can initialize the grid structure.

11. How to Use: Paper Trading, Update, Panic Sell

11.1. Paper Trading (Live Simulation)

When to use it: You want to test a grid strategy on real-time live data without risking real USDT.

Grid Bot v5 includes a built-in Paper Trading engine. By toggling "Paper Trading" on in the GUI, the bot will simulate order fills internally based on the live Binance websocket price feed. It tracks simulated equity and realized profit perfectly, allowing you to validate your Grid ranges safely.

11.2. Update Grid Settings (On-the-fly)

When to use it: You want to change the Grid Bounds or Take Profit settings without cancelling the entire grid and starting over.

Simply select your active pair, adjust the parameters (e.g., expand the Ceiling), and click UPDATE. The bot will intelligently calculate the difference, cancel only the necessary resting orders, and place new ones to match your updated configuration, minimizing trading disruptions.

11.3. Panic Sell: Manual Emergency Exit

When to use it: You want to terminate a grid immediately due to unexpected market news.

Steps:

  1. Select the pair you want to exit.
  2. Click the PANIC SELL button.
  3. The bot will instantly execute a Cancel-All command for your open limit orders.
  4. It then sends a MARKET SELL order for all base assets currently held by the grid.
  5. The pair is automatically switched to a paused state to prevent it from restarting.

This document will be updated whenever the bot's architecture changes.