A swarm runs several bots together with oneDocumentation Index
Fetch the complete documentation index at: https://docs.trepa.io/llms.txt
Use this file to discover all available pages before exploring further.
trepa.bots.run call. Each bot has its own Trepa login and wallet, but they share one script and stop together when you exit the process. The Writing bots page explains predict and ctx for a single account; here we wire up multiple accounts and per-bot behaviour.
Typical reasons to use a swarm:
- Several accounts, same pool: One prediction per wallet per pool; run many wallets from one program so they can all enter the same pool.
- Outcome band: Different forecast per account around a band you choose (Different behaviour per bot, liquidity-bot).
- Per-user levers: Separate stakes, streaks, near-close timing, or a canary account, coordinated in one run.
Load several credential pairs
bots.run consumes one { apiKey, privateKey } object per bot. The usual pattern is numbered variables in .env, read by credentialsFromEnv():
_1, _2, _3, … until it hits a gap. A half pair (key without matching private key) throws at startup so you catch typos early.
You can also build the array in code:
trepa object (outside predict) use only the first credential in the list. Inside predict, use ctx.trepa when you need the client for that bot.
Different behaviour per bot
Pass a function intobots.run instead of a plain options object. The function receives index (which bot, starting at zero) and count (how many bots total). The snippet below assumes trepa already exists from the previous block.
index shifts the forecast along that ladder around fair.
When every bot should behave the same, pass a normal options object instead of a function.
Inside predict, ctx.slot repeats index and count if you prefer reading from ctx.
Per-bot Trepa client inside predict
The second argument ctx includes ctx.trepa scoped to that bot. Use it when a strategy needs that user’s prediction history, portfolio, or any other API call without mixing wallets.