What the grid trading calculator shows
A grid bot places buy orders on price lines below the market and sell orders on the lines above. Each time price falls to a line and rises back to the next one, a buy and a sell fill and the bot pockets the gap between them, minus two fees. That's a completed grid.
The calculator lays out the lines for your range, the amount of coin each grid trades, and the net profit of one completed grid after fees. It also shows the part grid bot screens tend to leave out: what you're left with if price walks out of the range, compared with simply holding the coin.
How to use it
- Enter the lower and upper price of the range, and the price now.
- Enter the number of grids. A grid is the gap between two lines, so 20 grids use 21 lines.
- Choose the spacing. Arithmetic keeps the same price gap between lines; geometric keeps the same percentage gap.
- Enter the investment in the quote currency and the fee per fill. 0.1% is the standard spot fee for a regular account on Binance, for example; check your own exchange and tier.
The model and the formulas
Every grid trades the same amount of coin, q. Grids above the price now start with the coin (bought at market when the bot starts) and a sell order one line up. Grids below start with cash and a buy order on their lower line. The grid that contains the price starts with a buy order.
arithmetic lines p_k = lower + k × (upper − lower) ÷ grids
geometric lines p_k = lower × (upper ÷ lower)^(k ÷ grids)
coin per grid q = investment ÷ (sell grids × price now + sum of the buy lines)
completed grid q × (p_k+1 − p_k) − fee × q × (p_k + p_k+1)
fee break-even gap > (1 + fee) ÷ (1 − fee) − 1 (about 2 × fee)
In an arithmetic grid the gap in dollars is fixed, so the percentage profit is largest on the lowest grid. In a geometric grid the percentage is the same on every grid.
Worked example
A Bitcoin grid from 60,000 to 70,000 with 20 arithmetic grids, $10,000, a 0.1% fee per fill, started at 65,000:
- Lines every $500: 10 sell orders above the price and 10 buy orders below.
- Each grid trades 0.00786 BTC; the bot buys 0.0786 BTC at the start to stock the sell orders.
- A completed grid nets $2.83 to $2.98, which is 0.52% to 0.63% of the money in that grid.
- If price falls straight to 60,000, every buy fills and the position is worth $579.74 less than you put in. Holding BTC from 65,000 would be down $769.23.
- If price rises straight to 70,000, every sell fills: +$205.68, against +$769.23 for holding.
- Making up the loss at the lower bound takes about 199 completed grids.
So a grid loses less than holding on the way down and earns much less on the way up. It makes money from back-and-forth movement inside the range, and every completed grid is small.
More grids is not always better
Same range, investment and fee, with a different number of arithmetic grids:
| Grids | Net per completed grid | Result at the lower bound | Completed grids to make it up |
|---|---|---|---|
| 10 | 1.25% to 1.47% | −$561.18 | 41 |
| 20 | 0.52% to 0.63% | −$579.74 | 199 |
| 50 | 0.09% to 0.13% | −$590.85 | about 2,690 |
| 100 | −0.06% to −0.03% | −$594.54 | never |
More lines fill more often, but each fill earns less. At 100 grids the $100 gap is 0.14% to 0.17% of the price, less than the 0.2% two fees cost, so every completed grid loses money. The calculator warns you when that happens.
What the calculator can't tell you
How often price crosses your lines decides whether a grid pays, and that depends on the market, not on the settings. We tested this on real data in a Bitcoin grid bot backtest, month by month. A grid in a falling market is a way of buying all the way down; if you'd be unhappy holding the coin at the lower price, the range is too wide or the coin is wrong.
To write your own grid bot in Python, start with a Python crypto trading bot with ccxt. For the cost side of frequent small trades, see the trading fee calculator.