> For the complete documentation index, see [llms.txt](https://support.backpack.exchange/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.backpack.exchange/exchange/trading/trading-bots/spot-grid.md).

# Spot Grid

### **Why two assets are required**

A spot grid requires both:

* **Quote asset** (e.g., USDC) → for buy orders
* **Base asset** (e.g., BTC) → for sell orders

Orders are pre-calculated based on:

* Price range
* Grid count
* Total investment

### **What is a Deficit?**

A deficit is the missing base asset required to place all sell orders.

**Example:**

* Grid: BTC/USDC, range $90–$110
* Current price: $100
* Required BTC for sell orders: 0.5 BTC
* Available: 0.2 BTC

→ Deficit = **0.3 BTC**

**Deficit Status**

* **Deficit = 0** → No action needed
* **Deficit > 0** → You must choose a funding method

### **Funding Options: Borrow Mode vs Buy Mode**

|              | Borrow Mode       | Buy Mode                  |
| ------------ | ----------------- | ------------------------- |
| How it works | Borrow base asset | Buy base asset using USDC |
| Upfront cost | None              | Reduces USDC immediately  |
| Ongoing cost | Interest accrues  | None                      |

{% hint style="info" %}
**Note:**\
Buy Mode uses M`ax Entry Price` to cap purchase price (default ≈ 1% above current price).
{% endhint %}

**Auto Selection Logic**

The system selects the funding mode automatically:

* Enough base asset → No funding
* Only one mode available → Uses that mode
* Both available → Defaults to **Borrow Mode** (can switch manually)


---

# 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://support.backpack.exchange/exchange/trading/trading-bots/spot-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.
