02 / Private execution
Trade in public. Be followed by no one.
The desk's track record is public; its live positions are not. Orders are signed by short-lived Hyperliquid API wallets on sub-accounts that share no visible funding path with the desk address, so the only thing an observer sees mid-trade is a hash.
2.1Routing
Hyperliquid lets a master account approve API wallets (also called agent wallets): keys that can place and cancel orders for an account but cannot withdraw or transfer funds. The desk combines that with sub-accounts, each with its own address and margin. The public desk address never places an order itself.
| Layer | Holds funds | Signs orders | Publicly linked to desk |
|---|---|---|---|
| Treasury (cold) | Yes | No | Yes — published |
| Master trading account | Yes | No (approves agents only) | No |
| Sub-accounts (pool of N) | Margin per trade | No | No |
| API wallets (one per sub-account) | No | Yes | No |
2.2Wallet rotation
- Each new trade draws a random free slot (sub-account + API wallet) from the pool. A slot with an open position is never reused.
- A slot cools down for at least 6 hours after its last close before it can be drawn again, so timing analysis cannot chain trades.
- API wallet approvals expire and are re-issued on a schedule; a leaked agent key can trade one sub-account's margin but cannot move funds.
- Margin is topped up from the master account in rounded amounts at randomised times, not just before a trade.
- After reveal, the sub-account address is published with the receipt. That slot is then retired from the pool permanently.
// Simplified from the executor. One signer per trade, retired after use.
interface ExecSlot {
subAccount: `0x${string}`; // Hyperliquid sub-account that holds margin
apiWallet: `0x${string}`; // approved agent key: can trade, cannot withdraw
lastUsedAt: number;
openPositions: number;
}
function pickSlot(pool: ExecSlot[], now: number): ExecSlot {
const free = pool.filter(s => s.openPositions === 0 && now - s.lastUsedAt > 6 * 3600_000);
if (free.length === 0) throw new Error("NO_FREE_SLOT"); // trade is skipped, never forced
return free[crypto.getRandomValues(new Uint32Array(1))[0] % free.length];
}2.3Execution modes
The backend runs in exactly one mode, set by EXECUTION_MODE. The current mode is returned in GET /api/stats as mode and shown in the site header, so nobody mistakes a simulation for live money.
| Mode | Orders | Commits | Use |
|---|---|---|---|
| PAPER_SIMULATION | Simulated against live Hyperliquid mid/L2 data, with fees and slippage modelled | Real, on Elysium | Default. Proves the pipeline end-to-end with no capital at risk. |
| HYPERLIQUID_TESTNET | Real orders on Hyperliquid testnet | Real, on Elysium | Exercises API wallets, rotation and receipts. |
| HYPERLIQUID_MAINNET | Real orders, real margin | Real, on Elysium | Production. Requires every guardrail env var to be set explicitly. |
2.4Risk guardrails
These limits are enforced in code by the risk module before commit, and again by the executor before order submission. The Risk Manager agent can tighten them, never loosen them.
| Guardrail | Limit | Enforcement | On breach |
|---|---|---|---|
| Max leverage | 5x | Per position, computed on notional / sub-account equity | VETO |
| Stop-loss | Mandatory | Reduce-only trigger order sent in the same batch as entry | VETO; position closed if SL is ever missing |
| Max position | $25,000 notional | Per position, across all sub-accounts per pair | VETO |
| Daily drawdown | 4% of start-of-day equity | Realised + unrealised, checked every 10 s | Kill switch: flatten all, no entries until 00:00 UTC |
| Pairs | BTC, ETH, HYPE, SOL | Allow-list | VETO |
| Commit before order | Required | Executor refuses without a mined commit tx | Order not sent |
2.5Order sequence
1 council.decide() -> { pair, side, sizeUsd, entryTarget, stop, thesisJson }
2 risk.check(decision, account) -> OK | VETO(reason) // hard limits, see table
3 salt = randomBytes32()
commitHash = computeCommitHash({ tradeId, thesisJson, pair, side, sizeUsd, entryTarget, salt })
4 ProofRegistry.commit(tradeId, commitHash) -> wait 1 confirmation on Elysium
5 slot = pickSlot(pool)
6 hl.order(slot.apiWallet, { coin: pair, isBuy, sz, limitPx: entryTarget, reduceOnly: false })
hl.order(slot.apiWallet, { trigger: stop, tpsl: "sl", reduceOnly: true }) // same request batch
7 ...position managed until stop / target / invalidation...
8 fills = hl.userFills(slot.subAccount, since: commitTs)
receipt = sign(executionKey, keccak256(fills))
9 ProofRegistry.reveal(tradeId, thesisJson, pair, side, sizeUsd, entryTarget, salt, receipt)- If step 4 fails or times out, the trade is abandoned. A commit without an order is harmless and is revealed as a no-fill.
- If the entry doesn't fill within its time limit, it is cancelled and the commit is revealed with an empty fill set.
- The reveal format is described in the commit–reveal spec; the contract surface in Contracts.