> For the complete documentation index, see [llms.txt](https://docs.symm.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.symm.io/trader-documentation/building-a-trading-bot.md).

# Building a Trading Bot

## Building a trading bot

A trading bot on SYMMIO's HyperEVM deployment runs an automated strategy that opens, monitors, and closes positions with no human in the loop. The deployment runs SYMMIO contract core v0.8.5, and you build against it with the [Trading SDK](https://doc.trading-sdk.symm.io) rather than assembling raw contract transactions and hand-rolled solver calls.

Pick your entry point based on what the bot looks like. If it's headless (Node/TypeScript), `@symmio/trading-core` gives you typed contract calls, solver REST clients, subgraph reads, and price and notification WebSockets. If it has a dashboard or UI, `@symmio/trading-react` layers hooks and a provider on top of wagmi and TanStack Query. Either way, a throwaway *session key* from `@symmio/session-key` signs the trading hot path, so your main wallet key is used once during setup and never touches the loop.

> Scope: the Trading SDK currently supports HyperEVM (chain 999) only. On HyperEVM your solver counterparty is Enigma (`0x76bc5889c0cfcC20960b0D81F541595d81a95122`). If you're building for another SYMMIO chain (Base, Arbitrum, Mantle, BNB, and others), the SDK does not apply yet; use the manual implementation guide instead.

### The account model

Every bot works with three actors. The *Owner EOA* is your wallet; it signs the one-time setup in Part 1 and nothing else. A *SubAccount* is an isolated on-chain account under your EOA that holds collateral and is used to open positions. When you trade, the protocol spins up *Virtual Accounts* (VAs) according to the SubAccount's isolation type: one per position, per market, or per market and direction, depending on the `SubAccountIsolationType` you chose at creation. The VA, not the SubAccount, is the on-chain owner of a position, so closes and TP/SL are signed against the VA. Passing the SubAccount where a VA belongs is an easy authorization mistake to make.

### What the SDK collapses

The underlying protocol still does the same handful of things: create a SubAccount, fund it, delegate authority to your session key, then trade against the Enigma solver. The SDK turns each of those from a hand-built transaction into one typed call.

```bash
npm install @symmio/trading-core @symmio/session-key
# add @symmio/trading-react if your bot has a UI
```

### What's in this section

* [Part 1: One-time on-chain setup](/trader-documentation/building-a-trading-bot/part-1-one-time-on-chain-setup.md) covers creating and funding a SubAccount, then delegating to a session key.
* [Part 2: Trading](/trader-documentation/building-a-trading-bot/part-2-trading.md) covers opening, monitoring, closing, and attaching TP/SL, all signed by the session key.
* Code examples has a complete runnable bot and links to the SDK's reference app.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.symm.io/trader-documentation/building-a-trading-bot.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
