> 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/part-1-one-time-on-chain-setup/create-the-sub-account.md).

# Create the sub-account

**Why.** You trade as a sub-account that your EOA owns, not as the EOA itself. The sub-account is what holds collateral, what gets bound to a PartyB, and what shows up as `signerAccount.addr` in the EIP-712 messages you sign to open positions. Your EOA is the *authority*; the sub-account is the *trader*.

**Signed by.** Owner EOA, on-chain, against the `AccountLayer` diamond.

**Function.** [`createSubAccounts(affiliate, accountsData[])`](https://intent.symmscan.com/inspector/hyperevm/account-layer?method=0x817ed7f6), where each entry has `name`, `metadata` (bytes), `symmioCore` (the diamond address), `isolationType` (uint8), and `singleVAMode` (bool).

**Isolation type** decides how virtual accounts get spawned when you trade. `2 = MARKET_DIRECTION` is the right answer for almost everyone: it gives one VA per `(symbol, direction)`, for example: all your SYMM longs share a VA, all your SYMM shorts share another, and BTC trades are kept separate from SYMM. The other modes are for specialized use cases (per-trade isolation, per-symbol pooled, fully manual).

**`singleVAMode = true` is mandatory if you want TP/SL to work.** With single mode off, every `sendQuote` call creates a fresh VA, even on the same `(symbol, direction)` key. The conditional-orders service that handles TP/SL validates that your already-open position's VA equals `predictNextVirtualAccountAddress(sub, isolationType, symbolId)`. With single mode off, the predicted "next VA" is by definition a *different* VA from the one your position lives on, so the check fails forever. Turn single mode on at creation; it can only be flipped while no VAs are active, so changing your mind later means making a new sub-account.

After this transaction lands, read the new sub-account address from either the tx receipt or [`getUserSubAccountsAddresses(owner, 0, limit)`](https://intent.symmscan.com/inspector/hyperevm/account-layer?method=0x83a08b8f). Save it; you'll need it for everything else.


---

# 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://docs.symm.io/trader-documentation/building-a-trading-bot/part-1-one-time-on-chain-setup/create-the-sub-account.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.
