Building a Trading Bot (Legacy Guide)
This is the original Python walkthrough built on raw contract calls. It predates the Trading SDK, which is now the supported way to build bots on SYMMIO's HyperEVM deployment. If you're starting today, follow Building a Trading Bot instead.
This page is kept for two audiences: developers on a non-JavaScript stack who need the raw-call reference (the SDK is TypeScript-only), and builders on SYMMIO chains other than HyperEVM, which the SDK does not yet support. The flow below is not maintained in lockstep with the SDK and may drift from current best practice. There are two parts.
Part 1: one-time on-chain setup is everything the wallet has to do once before any trading happens: create the sub-account, fund it, hand a session key the right authorities, and bind the sub-account to a PartyB. After Part 1 you should never see a wallet popup again on the trade path.
Part 2: trading is the actual trading: opening a position, closing it, and attaching a TP/SL. This is the part the session key handles end-to-end.
Three addresses, three jobs
Three addresses do different jobs, and builders often mix them up.
Owner EOA is your real wallet. It signs all the on-chain setup transactions in Part 1, and never signs an EIP-712 trading message.
SubAccount is a deterministic address derived from your EOA plus affiliate. It holds collateral. It's a virtual address with no bytecode: you reference it as the "account" in the calldata for opens, and as the
signerAccount.addrfield of the EIP-712 messages you sign to open positions.Virtual Account (VA) is a deterministic address spawned the first time a
(symbol, direction)pair is traded under a sub-account. It holds margin and the active quotes. You sign closes against the VA, not the sub-account. That's the single most common authorization mistake.
Whenever you build calldata for an EIP-712 op, ask yourself: whose account is this for? The session key always signs, but signerAccount.addr flips between the sub-account (opens) and the VA (closes and TPSL).
Every contract address and service endpoint this guide refers to is deployment-specific; gather the ones for your deployment from Reference: Solver Addresses & Endpoints.
Last updated

