# Trading Bots

Trading Bots support automated trading in the Sorin Desktop App. A bot is a named, policy-bound agent that Sorin uses to place trades on your behalf with sized against limits you set, routed through venues you authorize, and recorded in an audit trail you can review at any time.

You can run multiple bots in parallel, each with its own mandate, policy, and custody setup. Bots don't replace your judgment — they encode it, so that when Sorin acts, it acts the way you told it to.

<figure><img src="/files/N5qNTSM2cTNNKISUBz8z" alt=""><figcaption></figcaption></figure>

### What a Bot Is

Every Trading Bot has four parts:

| Part                     | What It Defines                                                                  |
| ------------------------ | -------------------------------------------------------------------------------- |
| **Template and Mandate** | What the bot is for — its strategy, scope, and operating rules.                  |
| **Custody & Security**   | How the bot holds and accesses assets — paper, hot wallet, or connected account. |
| **Trading Limits**       | The hard limits on what the bot can do — size, slippage, frequency.              |

Sorin enforces all four every time a bot acts. If a proposed trade violates the policy, the bot doesn't execute — it flags the issue and, depending on your settings, pauses.

### Bot States

A bot is always in one of these states:

| State      | Meaning                                                  |
| ---------- | -------------------------------------------------------- |
| **Ready**  | Live-capable and configured, but not actively executing. |
| **Armed**  | Live and executing against its mandate.                  |
| **Paused** | Temporarily halted. Won't execute until you resume it.   |

You can toggle between states at any time. Moving from Paper to Armed requires explicit confirmation and a live custody connection.

### Creating a Bot

Open **Trading Bots** and click **+** to create a new bot. You'll configure:

#### 1. Strategy

Select a strategy template and write a clear, human-readable description of what this bot does. A good mandate is specific enough that you could hand it to someone else and they'd know what the bot is for.

**Good mandate examples:**

* "Dollar-cost average into BTC and ETH on a disciplined schedule, using market weakness to improve entry while keeping risk within predefined limits."
* "React to market-moving events and high-conviction crypto price moves across major assets, acting only when signal confidence exceeds the configured threshold."

**Weak mandate examples:**

* "Trade crypto."
* "Make money."

The mandate is shown alongside the bot's actions in the audit log, so future-you can always understand why past-you set it up this way.

#### 2. Trading Policy

Policy is the guardrail layer. Every field here is a hard limit Sorin will not cross.

| Field                  | What It Controls                                                                          |
| ---------------------- | ----------------------------------------------------------------------------------------- |
| **Allowed tokens**     | Which assets the bot can trade (e.g., BTC, ETH). Any trade outside this list is rejected. |
| **Max order size**     | The largest single order the bot can place, in USD.                                       |
| **Daily notional cap** | Total USD notional the bot can trade across all orders in a 24-hour window.               |
| **Max slippage**       | Maximum acceptable slippage per trade, in basis points.                                   |
| **Reroute attempts**   | How many times the bot can retry on a different venue if the primary route fails.         |
| **Auto-pause after**   | Number of consecutive execution failures before the bot pauses itself.                    |

#### 3. Custody & Security

Choose how the bot holds and accesses assets:

| Custody Type             | What It Means                                                                                             |
| ------------------------ | --------------------------------------------------------------------------------------------------------- |
| **None (paper trading)** | Bot runs in simulation. No real address, no real funds.                                                   |
| **Connected account**    | A CEX account you've linked via read + trade API keys, scoped to this bot.                                |
| **New Wallet**           | A bot-specific wallet Sorin manages under your policies. Funds you move to it are under that bot's scope. |

**Session status** shows whether the bot's credentials are currently live and usable. "Simulated" means paper mode; "Active" means the bot can transact.

#### 4. Execution Routes

Where the bot can execute. Each route has a health indicator:

* **On-chain (DEX)** — for on-chain pairs and DeFi execution
* **CEX** — for centralized exchange spot and perps

A route marked **Healthy** is available for routing. A route marked **Degraded** or **Unavailable** means Sorin detected an issue (API outage, rate limiting, credential problem) and will avoid or reroute around it.

#### 5. Approval Mode

Controls what Sorin does before a trade fires:

| Mode                       | Behavior                                                                                                      |
| -------------------------- | ------------------------------------------------------------------------------------------------------------- |
| **Auto approve**           | Trades within policy execute without per-trade confirmation. Suitable for well-tested bots with tight policy. |
| **Confirm first**          | Every trade generates a preview that requires your explicit approval before executing.                        |
| **Confirm over threshold** | Trades above a specified size require approval; smaller trades auto-execute.                                  |

You can change this at any time. Starting a new bot with **Confirm first** is the safest default.

### The Bot Detail View

When you select a bot, the detail view has four tabs:

#### Overview

A snapshot of everything that defines the bot: Identity & Mandate, Trading Policy, Custody & Security, Execution Routes, and the bot's most recent execution. If something is wrong — an exceeded limit, a degraded route, a credential issue — it shows here.

#### Assets

The bot's current holdings and positions. For a paper bot, this is simulated. For a live bot, it reflects real balances available to the bot under its custody setup.

#### Automation

Schedules, triggers, and rules the bot runs on. For example:

* A DCA bot's schedule (daily/weekly cadence, buy sizes, assets)
* An event-driven bot's trigger conditions (price thresholds, narrative signals, external events)
* Conditional rules tied to portfolio state

#### Audit

A full, append-only log of everything the bot has done — proposed trades, executed trades, rejected trades, policy hits, pauses, and configuration changes. Every entry is timestamped and includes the specific policy value that applied at the time.

### Example: A DCA Bot

<figure><img src="/files/5N2RO4Ko6euJ7EJkR3mH" alt=""><figcaption></figcaption></figure>

**Mandate:** "Dollar-cost average into BTC and ETH on a disciplined schedule, using market weakness to improve entry while keeping risk within predefined limits."

**Policy:**

| Field              | Value      |
| ------------------ | ---------- |
| Allowed tokens     | BTC, ETH   |
| Max order size     | $1,000     |
| Daily notional cap | $5,000     |
| Max slippage       | 50 bps     |
| Reroute attempts   | 1          |
| Auto-pause after   | 2 failures |

**Custody:** Paper trading (until validated) **Approval mode:** Auto approve **Execution routes:** On-chain (DEX) and CEX, both healthy

**What happens when a scheduled buy fires:**

1. Bot checks current BTC and ETH prices across authorized venues
2. Chooses best route based on quoted price and current route health
3. Verifies order size is within policy ($1,000 max, $5,000 daily cap not yet hit)
4. Verifies slippage estimate is within 50 bps
5. Executes the trade on the chosen route
6. Logs the action in the audit tab with full context

If any check fails — say, slippage comes back at 85 bps — the bot **does not execute**. It logs the reason and, depending on your settings, either retries on a different route or pauses.

### Managing Multiple Bots

You can run multiple bots simultaneously, each with its own mandate and policy. Common patterns:

| Setup                            | What It's For                                                              |
| -------------------------------- | -------------------------------------------------------------------------- |
| **DCA bot + event-driven bot**   | Disciplined accumulation + opportunistic trades around signals.            |
| **One bot per strategy**         | Each strategy is isolated — a failure in one doesn't affect others.        |
| **Paper bot alongside live bot** | Validate a new mandate against live market data before committing capital. |

### Pausing and Stopping

You can **Pause** a bot at any time from the detail view. Pausing halts new executions immediately but preserves the bot's configuration and history.

Bots can also **auto-pause** if they hit the failure threshold you've set. When that happens, the Audit tab will show exactly which failures triggered the pause.

Deleting a bot (trash icon) removes the bot and its configuration. The audit history is preserved in your account history.


---

# Agent Instructions: 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:

```
GET https://docs.saharaai.com/sorin/core-features/trading-bots.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
