> For the complete documentation index, see [llms.txt](https://docs.origami.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.origami.tech/bots/simulation.md). Agents can also search and read this documentation through its [MCP server](https://docs.origami.tech/~gitbook/mcp).

# Grid simulation

Preview the orders a grid would place right now — the Grid Simulation panel, its columns, the Calculation details dump and how to read errors.

**Simulate** evaluates a grid with live market data and shows the orders it would place at this moment, without sending anything to the exchange. Use it after every change to an argument and before the first **Run**.

![Grids page with the Grid Simulation panel open: Details, Refresh and the Side, Pos., Price, Amount, Error columns](https://602593284-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDjboTEEPFNxFhKJ6msZi%2Fuploads%2F1GapZ5L8QhZqVNRLo5m9%2Fbots-simulation-01.png?alt=media)

## Run a simulation

1. On the grids page select the grid and click **Simulate** in its toolbar. The **Grid Simulation** panel opens next to the arguments.
2. Click **Refresh**. The current values of the arguments are sent to the server, which resolves every formula — `ticker()`, `orderbook()`, `balance()`, your own arguments and `globals.*` — and returns the resulting levels.
3. Change an argument and click **Refresh** again. The simulation does not update by itself.
4. **Hide Simulation** closes the panel.

The grid must have been saved at least once (**Save**) — a brand-new **New Grid n** has nothing to simulate until then. The bot itself does not need to be running.

## Reading the table

| Column     | Meaning                                                                                                                                 |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| **Side**   | **Buy** / **Sell** on spot and One-Way futures. On Hedge-mode accounts: **Open Long**, **Close Long**, **Open Short**, **Close Short**. |
| **Pos.**   | Level index — the `order_pos` value the formulas saw for that order (`1` is nearest to the price).                                      |
| **Price**  | Resolved order price.                                                                                                                   |
| **Amount** | Resolved order size in the base asset.                                                                                                  |
| **Error**  | Why this level would not be placed. Long messages are cut; expand the row to read them.                                                 |

The number of rows equals `buy_orders_count` + `sell_orders_count` after evaluation. If both are `0` the table is empty: *Check your configuration and click "Refresh" to generate grid levels.*

## Details

**Details** opens **Calculation** — the raw JSON of the evaluation: every argument, its resolved value per level and the market data used. **Copy** puts it in the clipboard, **Download** saves `calculation.json`, **Open in new tab** shows it full-screen. Attach this file when you ask support about a grid.

![Calculation window with the calculation details JSON and Copy, Download, Open in new tab](https://602593284-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDjboTEEPFNxFhKJ6msZi%2Fuploads%2FBVyXRV7GUEBE4Vel9Znw%2Fbots-simulation-02.png?alt=media)

## Errors

* A message in the **Error** column of one level — that level fails, the others are fine. Typical: size below the exchange minimum, price not a multiple of the tick, formula returned `NaN` for that `order_pos`.
* *Simulation could not be loaded. Fix the issue above and click "Refresh".* — the whole grid failed: a syntax error in a formula, an unknown function, an argument referenced before it is defined, or a missing global variable. The message above the table names the argument.

Levels that pass the simulation can still be rejected by the exchange at run time (balance changes, rate limits). Those rejections appear in the bot's **Error Log**; see [Bots overview](https://docs.origami.tech/bots/overview.md#error-log).

## Related

* [Create a grid](https://docs.origami.tech/grids/create-grid.md)
* [How a grid executes](https://docs.origami.tech/grids/how-a-grid-executes.md) — what happens every cycle after the levels are calculated
* [Grid language reference](https://docs.origami.tech/reference/grid-language.md)
