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

# Trading Bot

Doppi has three trading bots. They all automate trading, but they use different strategies:

| Bot                                                                                                  | Strategy                                                                                                      | Main contracts used                                 |
| ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
| [DoppiSimpleTrader](https://doppi-finance.gitbook.io/docs/readme/trading-bot/doppi-simple-trader.md) | Places one buy or sell when a price trigger is reached, then unwinds it at its configured profit threshold    | DoppiLiquidity                                      |
| [DoppiGridTrader](https://doppi-finance.gitbook.io/docs/readme/trading-bot/doppi-grid-trader.md)     | Places a weighted grid of buy and sell opportunities around an anchor price, then refreshes the grid by epoch | DoppiLiquidity                                      |
| [DoppiTrader](https://doppi-finance.gitbook.io/docs/readme/trading-bot/doppi-trader.md)              | Places weighted Buy-Low/Sell-High positions, then unwinds them after Core settlement                          | DoppiCore, DoppiLiquidity, and DoppiLiquidityRouter |

## How automated execution works

Each bot exposes `checkUpkeep` and `performUpkeep`. An off-chain runner checks whether the bot has work; an authorized forwarder or `PrivateAutomationHub` then calls it to execute that work. The bots do not run by themselves.

```mermaid
flowchart LR
    User[Trader starts bot and supplies assets]
    Runner[Off-chain automation runner]
    Check[Bot checks price and strategy state]
    Execute[Authorized forwarder executes bot]
    LP[DoppiLiquidity swaps]
    Core[DoppiCore positions and settlement]

    User --> Check
    Runner --> Check
    Check --> Execute
    Execute --> LP
    Execute -. DoppiTrader only .-> Core
    Core -->|settlement can create trader unwind records| Execute
```

The private Grid and Simple bots are created by their respective private factories. When configured, those factories register each bot with `PrivateAutomationHub`. DoppiTrader is created by `DoppiTraderFactory` and can also be registered with the hub; it trades using the shared Core and liquidity pool. See [Doppi Automation](https://doppi-finance.gitbook.io/docs/readme/automation.md) for the automation dispatcher and billing details.
