> For the complete documentation index, see [llms.txt](https://docs.surgecardano.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.surgecardano.com/strategies/grid.md).

# Grid

A grid buys a token every time its price drops to one of your price lines and sells it again when the price rises to the next line up, over and over, inside a band you choose. It makes money from price *chopping*, not from price *direction*. If the price leaves the band, the grid pauses and waits.

### What it is and when to use it

You pick a token, a lower price, an upper price and a number of grids. Surge slices the band into equal steps. Each step is a **rung**: it buys at its lower line and sells at its upper line. Every completed buy-then-sell (or sell-then-buy) is one **cycle**, and the difference between the two lines minus fees is that cycle's profit. After a cycle closes the rung re-arms and waits to do it again.

Use a grid when you expect a token to oscillate within a range for days or weeks. Do not use it when you expect a sustained trend: in an uptrend the grid sells its inventory early and then sits out of range; in a downtrend it buys all the way down and holds tokens at a loss.

A grid never finishes on its own. It runs until you stop it.

### How it works

**Lines and rungs.** With a lower price L, an upper price U and N grids, Surge places N+1 lines at equal price intervals from L to U. Rung *i* buys at line *i* and sells at line *i+1*. Because the intervals are equal in price, the *percentage* gap is widest at the bottom rung and narrowest at the top — so the top rung is always the least profitable one, and it is the one every feasibility check is measured against.

**Sizing.** Each rung gets the same ADA budget: total investment ÷ number of grids.

**Starting position.** When you create the grid, rungs whose buy line is *above* the current price start armed to **sell** — they expect to be funded with tokens, not ADA. Rungs below the current price start armed to **buy** with ADA. The builder's Required balance panel tells you how many tokens and how much ADA that split needs.

**What triggers a trade.** Surge watches the reference pool (the deepest eligible pool for the pair, on the DEXes you allowed). Each time its price ticks:

* a rung armed to buy fires when the price is **at or below** its buy line;
* a rung armed to sell fires when the price is **at or above** its sell line.

**One order at a time.** Crossed rungs are queued, never fired together. A grid fires **at most one order every two minutes**, nearest-to-current-price first, because two orders from the same wallet in quick succession collide on chain. Each rung also has a two-minute cooldown after it detects a crossing. Just before an order is built, the price is re-checked at current reserves; if the rung is no longer crossed it is re-armed without trading.

**Minimum received.** Every order carries a floor of expected output × (1 − slippage tolerance), with the tolerance clamped to 0.1%–5%. The expected output is quoted when the order is *built*, which can be up to two minutes after the crossing, so a fill can be worse than the line by the price move in that window plus your slippage tolerance.

**After a fill.** A filled buy flips the rung to sell-armed and records the *exact* number of tokens received; the matching sell is sized on exactly that lot, so inventory never drifts. A filled sell flips the rung back to buy-armed. A refund re-arms the same side with the same lot.

**Circuit breaker.** If a single price tick crosses **more than 3 lines** at once, or **more than 5 lines** are crossed within one two-minute window, the grid trips to **Paused — circuit breaker** and drops everything queued. This catches depegs, feed glitches and fat-finger prices. It does **not** clear itself; you resume it from the strategy page.

### Set up a grid

| Field                | What it means                                                                                        | Default                          | Limits and guidance                                                                                                                                                                                                                 |
| -------------------- | ---------------------------------------------------------------------------------------------------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Strategy name        | Label                                                                                                | `<token> Grid`                   | Up to 60 characters                                                                                                                                                                                                                 |
| Trading pair         | The token, always against ADA                                                                        | —                                | Must have a pool of at least 5,000 ADA on an allowed DEX                                                                                                                                                                            |
| DEX                  | Which DEXes the grid may price and trade on                                                          | Deepest pool across all          | Only DEXes hosting the pair are offered                                                                                                                                                                                             |
| Total investment (₳) | The ADA the grid may commit across all rungs                                                         | —                                | Must be at least the preview's **minimum investment** and at most its **depth ceiling** (above it your orders would move the pool too much). **Max** fills in the wallet balance                                                    |
| Price range          | Lower and upper price in ADA per token, or ± % around the current price                              | —                                | Lower > 0, upper > lower, current price must be inside. **Suggest** proposes a band from 7, 30 or 180 days of history (a 3-standard-deviation band, clamped so the current price is inside and each side is at most 50% of the mid) |
| Grid count           | Number of rungs                                                                                      | `[VERIFY: initial slider value]` | 2 up to the preview's maximum (fallback 12). The slider auto-lowers if the preview reduces the cap; the preview shows a recommended count                                                                                           |
| Slippage tolerance   | Worst fill accepted relative to the expected output                                                  | 0.5%                             | 0.1%–5%                                                                                                                                                                                                                             |
| Boundary buffer %    | Widens the out-of-range check on both sides so a brief poke outside the band does not pause the grid | 0                                | 0 or more; the builder warns above 10. It never moves your lines                                                                                                                                                                    |
| Co-sign wallet       | The strategy wallet that holds the ADA and tokens and signs every order                              | —                                | Must be your wallet, on this network, key in this browser, not linked to another strategy                                                                                                                                           |
| Risk acknowledgement | Required checkbox                                                                                    | —                                |                                                                                                                                                                                                                                     |

**Preview.** As you type, Surge runs the geometry against the live pool and reports whether the grid is **launchable**, the **recommended** grid count and why (largest count whose worst rung still nets more than twice the batcher-plus-network fees, or the maximum feasible, or none), the **minimum investment**, the **depth ceiling**, the **net profit per cycle** for the worst rung, and a list of **blocking reasons** if any. Deploy is disabled until nothing is blocking.

**After creation** you can change only the name, description and boundary buffer. Range, grid count, investment, wallet, slippage and DEXes are fixed; make a new grid to change them (clone from the old one).

A second live grid with identical settings on the same wallet is refused.

### While it runs

The status badge shows one of the following (`[VERIFY: exact on-screen wording of each pause reason]`):

| Status                   | Meaning                                                                                                          | What to do                                                                                                                                                           |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Running                  | Watching the price, rungs armed                                                                                  | Nothing                                                                                                                                                              |
| Paused — out of range    | Price is outside your band (plus buffer)                                                                         | Once the price is back inside, reload the strategy page — the grid re-evaluates when your tab reconnects to it, not on its own. Or stop and recreate with a new band |
| Paused — socket down     | Your tab is closed or the live connection dropped. Queued crossings were discarded                               | Reopen the tab; it resumes on reconnect                                                                                                                              |
| Paused — reserve low     | The wallet has less than roughly 10–12 ADA of spare ADA to pay for the next order's deposit, fees and collateral | Fund the wallet, then reload the strategy page so it re-evaluates                                                                                                    |
| Paused — pool shallow    | The reference pool fell below 5,000 ADA, or the price feed is not live                                           | Wait, then reload the strategy page                                                                                                                                  |
| Paused — circuit breaker | Too many lines crossed at once                                                                                   | Check the chart, then click **Resume**                                                                                                                               |
| Stopped                  | You stopped it                                                                                                   | Archive, delete or leave                                                                                                                                             |

On the **Rungs** tab each rung shows its buy/sell lines and its state: armed, pending build, pending sign, submitted, cancelling. The **Overview** tab shows realized profit (sum of closed cycles), unrealized P\&L (tokens held valued at the current mid price minus what they cost), fees paid, the ADA reserve remaining, and how far your ADA/token split has drifted from the launch split. **Trade log** lists every order.

The socket-down pause outranks every other reason, because without a connection Surge cannot even offer you the cancel that reserve or range recovery might need.

A paused grid receives no price ticks, so out-of-range, reserve-low and pool-shallow pauses are only re-checked when your tab (re)joins the strategy or when the queue next fires. If the condition has cleared and the badge has not, reload the strategy page.

### Fees example

A cycle pays two orders' worth of fees. Take a 5,000 ADA grid with 10 rungs (500 ADA per rung) on Minswap, rung lines at 1.000 and 1.030 ADA per token:

|                                                                           | Amount                                                                      |
| ------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| Buy 500 ADA of tokens at \~1.000 → sell them at \~1.030                   | gross ≈ +15.0 ADA (pool fee of 0.3% per leg is already inside these prices) |
| Surge fee: 0.2% × 500 ADA per leg × 2 legs                                | −2.0 ADA                                                                    |
| Batcher fee: 2 ADA × 2                                                    | −4.0 ADA                                                                    |
| Network fee: \~0.2 ADA × 2                                                | −0.4 ADA                                                                    |
| Preview safety buffer: 15% of gross (feasibility check only, not charged) | −2.25 ADA                                                                   |
| **Net profit per cycle shown in the preview**                             | **≈ 6.35 ADA**                                                              |
| **Realized profit recorded when the cycle closes** (no buffer)            | **≈ 8.6 ADA**                                                               |

The order deposit (2 ADA per order) is locked while an order is open and returned on fill; it is not a cost.

Now the same grid with 100 ADA rungs and 2% spacing: gross ≈ 2 ADA, minus 4.4 ADA of batcher and network fees alone — a loss before the Surge fee. The preview would report this rung as infeasible and block the launch. This is why the minimum investment exists: fixed per-order fees must be small relative to each rung.

Note on the Surge fee: on-chain you pay 0.2% with no minimum; the preview and the recorded fee use a floor of 0.978 ADA per order, so for rungs below about 489 ADA the *shown* Surge fee is higher than what actually leaves your wallet. See [The Surge fee and its minimum](/fees-tiers-and-staking/surge-fee-and-minimum.md).

### Wallet interaction

One strategy wallet does everything: it holds the ADA for buy-armed rungs and the tokens for sell-armed rungs, signs every order, receives every fill, and receives every refund. Your browser wallet is only used to fund it. Fund it with the ADA *and* tokens the Required balance panel shows; a grid launched above the current price needs tokens on day one.

Surge keeps an ADA reserve aside (shown as "reserve remaining") to pay deposits and fees. When that falls below the fee floor the grid pauses rather than failing a build.

### Edge cases and failure modes

* **Order refunded (Minswap).** The rung re-arms on the same side with the same lot and clears its cooldown, so the next crossing fires normally.
* **Order parked (SundaeSwap, WingRiders, Splash).** After 5 minutes Surge builds a cancel and pushes a **Cancel ready** prompt to your tab. Sign it to reclaim the funds; the rung then re-arms. While an order is parked the rung occupies the grid's single in-flight slot, so nothing else fires — cancel promptly.
* **Price gaps through several lines.** Circuit breaker (see above).
* **Insufficient ADA.** Paused — reserve low. The check is on fee-paying capacity, so a grid that is fully in tokens is not falsely paused.
* **You close the tab mid-cycle.** Orders already submitted keep waiting for their fill and are picked up on reconnect; rungs that were being built or awaiting signature are reset to armed.
* **Same-wallet conflicts.** Do not run two grids, or a grid and another strategy, from one wallet; they will collide on chain.
* **Late fill of a cancelled order.** If a cancel and a fill race and the fill wins after the cycle was already closed, Surge logs it for review instead of booking it against another cycle.
* **Cancelling / archiving.** Stop the grid first. Archiving is refused while any order is still open or awaiting signature. Delete removes the grid and its history; funds stay in the wallet.

### FAQ

**Why has my grid not traded even though the price crossed a line?** Check the status: out of range, socket down, reserve low or breaker will all hold it. If it says Running, remember one order per two minutes and the two-minute per-rung cooldown; also, the price is re-checked at the moment of building — a brief wick that reverses is skipped.

**Why did a rung fill at a worse price than its line?** Up to your slippage tolerance is allowed, and up to two minutes can pass between the crossing and the build. Tighten slippage if this matters more than fill rate.

**Can I add ADA to a running grid?** Not as investment — rung budgets are fixed at creation. Adding ADA to the wallet does raise the fee reserve; reload the strategy page afterwards so a reserve-low grid re-evaluates.

**What does "recommended grid count" mean?** The largest number of rungs where even the top (narrowest) rung still nets more than twice its batcher and network fees. You can pick more rungs up to the maximum; expect thinner margins.

**Does the grid rebalance if price drifts?** No. It holds whatever the fills leave it with. The Overview shows the drift from your launch split.

**Why can't I edit the range?** Because rungs, lots and open cycles are anchored to it. Clone the grid with a new range instead.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.surgecardano.com/strategies/grid.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
