# Grid trading bot: how grid strategies work and fail

URL: https://fincodelabs.com/en/blog/grid-trading-bot · Publisher: Fincode (Fincode Yazılım ve Teknoloji A.Ş.), Istanbul, Turkey · Category: Trading bots · Published: 2026-11-03 · Updated: 2026-11-05

Grid trading bot mechanics: arithmetic and geometric spacing, fee drag, inventory risk, a tested Python simulation and the failure modes of grid strategies.

**Short answer:** A **grid trading bot** keeps buy and sell limit orders at preset levels inside a price range and, each time one fills, places the opposite order one level away. It collects the spacing minus fees while the price oscillates, and it accumulates the asset as the price falls, so a break below the range leaves a full position at a loss. A grid can lose money, and no setting removes that risk.

A grid bot can look market neutral, yet a spot grid buys more of the asset each time the price falls and sells it as the price rises. That makes it an inventory position with a rule attached.

Every number in the examples is hypothetical, and no range, spacing or grid count here is a recommendation. Binance's global documentation is cited as of November 2026 only as a reference for how such features are defined, not as a recommendation; for readers in Turkey, Article 99/A of Capital Markets Law No. 6362 treats activity by foreign platforms directed at Turkish residents as unauthorized.

## How does a grid bot work? The order cycle

A grid bot divides a price range into levels and keeps one resting order at each level, with buys below the current price and sells above it.

1. The user sets a lower limit, an upper limit and a grid count, which together fix the levels.
2. At the start, the bot buys enough of the asset to back the sell orders above the current price.
3. When a buy fills, the bot places a sell one level higher. When a sell fills, it places a buy one level lower.
4. Each matched buy and sell is one round trip and books the spacing minus fees.

Binance's help pages for its own Spot Grid product, updated on 7 January and 13 August 2026, define Grid Profit as the realized result of matched orders and Total Profit as that plus the unrealized gain or loss. They also say the system stops executing while the price is outside the range and resumes if it returns. A bot can therefore show rising grid profit while the account as a whole is losing.

## Arithmetic vs geometric grid: the spacing math

An arithmetic grid keeps a fixed price gap between levels, while a geometric grid keeps a fixed percentage gap.

For a lower limit `L`, an upper limit `U` and `n` grids, the arithmetic step is `d = (U - L) / n` and the geometric ratio is `r = (U / L) ^ (1 / n)`. With a fee `c` per fill, the net gain per round trip on a geometric grid is `(1 - c) * r - 1 - c`.

> **Hypothetical example:** a range of 80 to 120 with 8 grids and a fee of 0.1% per fill. That fee is the regular-user spot rate on Binance's fee page as of November 2026; other platforms and tiers differ.
>
> | Aspect | Arithmetic | Geometric |
> | --- | --- | --- |
> | Spacing | Step of 5 | Ratio of 1.05199 |
> | Levels | 80, 85, 90, 95, 100, 105, 110, 115, 120 | 80, 84.16, 88.53, 93.14, 97.98, 103.07, 108.43, 114.07, 120 |
> | Gross per round trip | 6.25% at the bottom, 4.35% at the top | 5.20% at every level |
> | Net after two fees | 6.04% at the bottom, 4.14% at the top | 4.99% at every level |

These formulas follow Binance's Spot Grid parameters page, and its 400 to 450 example recomputes to the percentages it prints, the highest after truncation. An arithmetic grid's percentage gain shrinks as the price rises, while a geometric grid equalizes it. Neither is safer: the choice changes where the orders sit, not the direction risk.

## Grid fee drag: what a denser grid does

Every round trip pays two fees, so a spacing below about twice the fee per fill loses money even when every order fills exactly as planned.

The break-even ratio is `(1 + c) / (1 - c)`. At 0.1% per fill that is a spacing of 0.2002%.

**Hypothetical 80 to 120 range at 0.1% per fill: net gain per round trip**

| Grids | Arithmetic step | Arithmetic, top level | Geometric, every level |
| ---: | ---: | ---: | ---: |
| 8 | 5.00 | 4.14% | 4.99% |
| 50 | 0.80 | 0.47% | 0.61% |
| 200 | 0.20 | -0.03% | 0.003% |
| 400 | 0.10 | -0.12% | -0.10% |

More levels mean each round trip earns less. Whether more round trips make up for that depends on how the price moves, so the table shows a boundary rather than a preferred value. Limit orders fill at their level when they fill at all, so the table has no slippage term, and a different fee tier moves the boundary.

To test your own inputs, use the [grid bot calculator](https://fincodelabs.com/en/tools/grid-bot-calculator). It shows what they imply, not what they will earn.

## Inventory risk: what happens when price breaks the range

A spot grid is long the asset and its position grows as the price falls, so its main risk is a trend rather than any single order.

- **Break below the lower limit.** Every buy has filled, the capital now sits in the asset, and the bot has nothing left to do while the position loses value. In the hypothetical grid above, starting at 100, four levels are bought at 100 and four at 95, 90, 85 and 80, for an average cost of 93.75; at a price of 60 that inventory is down 36% before fees.
- **Break above the upper limit.** Every sell has filled and the bot holds only the quote currency. There is no loss on that inventory, but it takes no part in any further rise.
- **A gap through several levels.** Several orders fill in a burst, so the position changes far faster than one level at a time.

Binance's Spot Grid page, updated on 13 August 2026, warns that bots keep executing at their set intervals during a rapid fall or rise, and suggests setting stop-trigger orders in advance. A stop realizes the loss so far, and it can fill below its trigger in a fast market.

## Grid trading bot Python simulation on synthetic prices

This simulation runs one hypothetical 8-level grid over four constructed price paths; it tests the mechanics and says nothing about what any market will do.

```python
import math

def run_grid(prices, low=80.0, high=120.0, n=8, capital=10_000.0, fee=0.001):
    step = (high - low) / n
    grid = [(low + i * step, low + (i + 1) * step) for i in range(n)]
    p0 = prices[0]
    holding = [lo >= p0 for lo, hi in grid]     # above price: hold the asset
    cost = sum((p0 if h else lo) * (1 + fee) for (lo, hi), h in zip(grid, holding))
    qty = capital / cost                        # same quantity per grid
    cash = capital - qty * p0 * (1 + fee) * sum(holding)
    asset = qty * sum(holding)
    sells = 0
    for p in prices[1:]:
        for i, (lo, hi) in enumerate(grid):
            if holding[i] and p >= hi:          # sell at the upper level
                cash += qty * hi * (1 - fee)
                asset -= qty
                holding[i], sells = False, sells + 1
            elif not holding[i] and p <= lo:    # buy at the lower level
                cash -= qty * lo * (1 + fee)
                asset += qty
                holding[i] = True
    return cash + asset * prices[-1] - capital, sells

wave = lambda t, amp, period: amp * math.sin(2 * math.pi * t / period)
swing = [100 + wave(t, 18, 150) for t in range(601)]
paths = {
    "range":      swing,
    "breakout":   [100 + 50 * t / 600 + wave(t, 6, 40) for t in range(601)],
    "breakdown":  [100 - 40 * t / 600 + wave(t, 6, 40) for t in range(601)],
    "range+drop": swing + [100 - 40 * t / 100 for t in range(1, 101)],
}
for name, px in paths.items():
    pnl, sells = run_grid(px)
    hold = 10_000 * (0.999 * px[-1] / px[0] - 1)
    print(f"{name:10} last {px[-1]:5.1f}  sells {sells:2}  grid {pnl:+6.0f}  hold {hold:+6.0f}")
```

Hypothetical output, in units of the quote currency on a hypothetical capital of 10,000, where `hold` means buying the asset at the start of the same path:

```
range      last 100.0  sells 23  grid  +1530  hold    -10
breakout   last 150.0  sells 12  grid  +1164  hold  +4985
breakdown  last  60.0  sells  9  grid  -3029  hold  -4006
range+drop last  60.0  sells 23  grid  -2136  hold  -4006
```

Read each line against how the path was built:

- **range** was constructed to swing between 82 and 118 for four full cycles. Its gain comes from that construction and is not an estimate of anything.
- **breakout** sells out on the way past 120, gaining 1,164 where holding gains 4,985.
- **breakdown** ends with a full position and a loss of 3,029.
- **range+drop** repeats the four cycles and then falls to 60; the earlier round trips do not cover the inventory loss.

The code assumes each order fills exactly at its level and ignores partial fills, rejections and outages. Real candles also hide the order of prices inside a bar; see [backtesting pitfalls](https://fincodelabs.com/en/blog/backtesting-trading-strategy-pitfalls). A live version would place orders through an exchange client, as in the [CCXT Python guide](https://fincodelabs.com/en/blog/ccxt-python-trading-bot).

## Is grid trading profitable? Grid bot profit vs total result

A grid bot is profitable over a period only if net round-trip gains exceed the loss on the inventory it holds, and nothing guarantees that, so a grid can lose money.

The total result equals net gains on matched round trips, plus the change in value of the asset still held, minus the fees paid to build that position. Grid profit on its own leaves out the second term. For the first term to outweigh the second, the price has to revisit levels often enough, the spacing has to clear the fees, and the price must not stay outside the range in the wrong direction. These are conditions and not predictions, and a backtest that met them does not guarantee future results. The same conditions apply to a spot grid bot on any venue, including Binance's Spot Grid, whose dashboard separates Grid Profit from Total Profit; only Total Profit includes the inventory.

> **Hypothetical dashboard example:** Binance's parameters page defines Annualized Yield as Total Profit divided by Total Investment, times 365 x 24 x 60, divided by the order duration in minutes. A grid up 1% after three days therefore displays about 122% annualized. That figure extrapolates three days into a year; it is not an expected return.

## Grid bot failure modes in production

Beyond market risk, grid bots fail in ways specific to holding many resting orders at once.

**Common grid failures, with values read from Binance's exchangeInfo for BTCUSDT on 3 November 2026**

| Failure | What goes wrong | What the software must do |
| --- | --- | --- |
| Minimum order size | The NOTIONAL filter was 5 USDT, so thin capital across many levels gets rejected | Validate every level before placing the first order |
| Open-order cap | MAX_NUM_ORDERS was 200, so a larger grid cannot rest every level | Cap the levels or keep only the nearest ones live |
| Price band | PERCENT_PRICE_BY_SIDE rejects orders too far from the average price, such as bids under half of it | Add distant levels as the price approaches |
| Partial fills | A counter-order sized on the requested quantity leaves the books wrong | Size counter-orders on the filled quantity |
| Missed fills | A fill during a reconnect gets no counter-order, leaving a hole in the grid | Reconcile orders and fills after every reconnect |
| Duplicate orders | A restart re-places levels that are still live and doubles exposure | Use one client order ID per level and reconcile at startup |

A futures grid adds leverage, [funding payments](https://fincodelabs.com/en/blog/perpetual-futures-funding-rate) and liquidation, which can close a position before the price returns to the range. Position limits, loss limits and a kill switch sit outside the grid logic, as described in [trading bot risk management](https://fincodelabs.com/en/blog/trading-bot-risk-management).

Which platforms and products you may use depends on your jurisdiction and the exchange's terms. In Turkey, Article 14 of Communiqué III-35/B.2 of the Capital Markets Board (SPK, also CMB) also bars leveraged and derivative trading in crypto assets listed on platforms. How rule-based systems get built is outlined on the [custom trading bot development](https://fincodelabs.com/en/services/algorithmic-trading) page; rules and parameters remain the decision of whoever runs the system, and this site does not recommend strategies or settings. The related averaging-down design is in [DCA bot explained](https://fincodelabs.com/en/blog/dca-bot-explained).

## Frequently asked questions

### What is a grid bot?

A grid bot keeps buy and sell limit orders at preset price levels inside a range and replaces each filled order with the opposite order one level away. It can lose money, because it accumulates the asset as the price falls.

### Is a spot grid bot profitable?

Only under conditions, and nothing guarantees them: net gains on matched round trips must exceed any loss on the inventory held. Judge the total result, not the grid profit alone.

### How many grids should a grid bot use?

There is no generally correct number, and this guide does not suggest one. More grids mean a smaller net gain per round trip and more orders to manage, and the count is bounded by fees and exchange filters.

### What happens when the price leaves the grid range?

On Binance's Spot Grid, as of November 2026, the bot stops executing while the price is outside the range and resumes if it returns. Below the range the capital sits in the asset; above it the capital sits in the quote currency.

### What is the difference between a grid bot and a DCA bot?

A grid both buys and sells across a fixed range and closes many small round trips. A DCA bot only adds buys as the price falls and sells the whole position at one target.

### Is a grid trading bot legal?

Many exchanges offer grid tools or APIs, but the rules depend on your jurisdiction and the platform's terms. In Turkey, Article 99/A of Law No. 6362 bars foreign platforms from serving residents.

## Sources

- [Binance: What Is Spot Grid Trading and How Does It Work](https://www.binance.com/en/support/faq/what-is-spot-grid-trading-and-how-does-it-work-d5f441e8ab544a5b98241e00efb3a4ab)
- [Binance: Spot Grid Trading Parameters (Profit/Grid formulas, Annualized Yield)](https://www.binance.com/en/support/faq/binance-spot-grid-trading-parameters-688ff6ff08734848915de76a07b953dd)
- [Binance: Trading Fee Rate (spot, regular user)](https://www.binance.com/en/fee/trading)
- [Binance Spot API documentation: Filters](https://github.com/binance/binance-spot-api-docs/blob/master/filters.md)
- [Binance Spot API: exchangeInfo for BTCUSDT (live filter values)](https://api.binance.com/api/v3/exchangeInfo?symbol=BTCUSDT)
- [Capital Markets Law No. 6362, consolidated text, Article 99/A (Turkish)](https://www.mevzuat.gov.tr/mevzuatmetin/1.5.6362.pdf)
- [Resmî Gazete: SPK Communiqué III-35/B.2, 13 March 2025, no. 32840, Article 14 (Turkish)](https://www.resmigazete.gov.tr/eskiler/2025/03/20250313-6.htm)

> This guide is general information about software and markets, not investment, legal or tax advice. Automated trading can lose money, past or backtested performance does not guarantee future results, and the rules that apply depend on your jurisdiction and your exchange's terms. Sources, checks and corrections: see the [editorial policy](https://fincodelabs.com/en/editorial-policy).

---

Published by Fincode (Fincode Yazılım ve Teknoloji A.Ş.), a software company in Istanbul, Turkey: https://fincodelabs.com/en/blog/grid-trading-bot

Cite as: Fincode, "Grid trading bot: how grid strategies work and fail", updated November 5, 2026, https://fincodelabs.com/en/blog/grid-trading-bot
