13 · Trade with your AI agent
Trade with your AI agent
Everything you can do on screen, your agent can do through the public routes. Your wallet signs every act; the agent never holds a venue key. Never paste a private key into a chat: the agent reads it from an environment variable.
What an agent needs#
- The base URL:
https://protect.temporal.exchange/api/venue - A wallet it can sign with (from an environment variable), with testnet USDC on HyperCore testnet. No gas coin needed.
- Node 22 to run the toolkit scripts on this page.
The rule for every act#
Read → dry-run (POST /chain/dryrun) → tell the person what will happen and what it costs → wait for a yes → send. A refusal is a named reason and changes nothing: quote it, do not retry with other numbers unless asked.
How v11 matches (what the agent must tell the person)#
- An order (or each piece, default $1,000 of premium; set
pieceUSD) is sent to every maker's quoting program; the single best firm quote that can take the whole size fills it. NoSingleMaker(qty, maxRoom)means no single maker can take that size: offermaxRoom, or smaller pieces.- Slippage is measured from the oracle venue's side (ask for buys, bid for sells); the quote carries that reference.
- Positions are valued (marked) at the oracle venue's closeable side; a close gets the best maker's price, which can be lower.
The reads (public, no key)#
/health, /chain/health, /chain/quote, /chain/state, /chain/fills, /chain/deposits, /chain/withdrawals, /chain/nonce, /hypercore/balance, and the previews POST /perp/plan, POST /option/optimise, POST /chain/dryrun, POST /chain/snapshot, POST /earn/plan. Full list with parameters: `/llms.txt`.
The acts (signed)#
POST /hypercore/relay (fund), POST /chain/intent (connect, mintAccount, deposit, withdraw, openLegAtFront, closeLegAtFront, closeAccountAtFront, openPerpWithLegs, requestClosePerp; EIP-712 VenueIntent), POST /chain/withdraw, POST /chain/withdraw/cancel. Makers: sign in with the wallet for a session (/auth/nonce, /auth/verify), then /account/quoting. A Custom maker's quoting program receives requests and answers with signed firm quotes (ruling 960). Sign in with your wallet (POST /auth/nonce, sign the message, POST /auth/verify), then POST /rfq/maker/register with { url, accounts, signer? } (your webhook URL, the maker accounts you own, and optionally the bot key you set on the front with setQuoteSigner); GET /rfq/makers lists your connections, POST /rfq/maker/unregister { id } removes one. Each request is one option at one size; answer { quote, sig } or null within the window (500 ms). A Protect swap slice arrives as { kind: "package", legs } and must be answered for every leg or not at all. Example program: scripts/rfq_maker_example.mjs; the full protocol: docs/design/maker_api_v11.md.
The toolkit#
The scripts on these pages (setup.mjs, fund.mjs, open_option.mjs, protect.mjs, close.mjs, withdraw.mjs, lp.mjs, audit.mjs; the Custom quoting-program example is scripts/rfq_maker_example.mjs) each read, dry-run and stop until rerun with CONFIRM=yes.
The ready prompt#
When the venue says no#
Common refusals: NoSingleMaker (size too big for any one maker — use pieces), NoMakerForOpen (nobody quotes that side), LegTooSmall (under $1 of premium), slippage over your limit, stale prices (asset frozen), margin short (the reply names both numbers). Nothing moves on a refusal.
Then check the numbers#
Verify it yourself turns the testing protocol into checks you can run on your own trades.
Kept in lockstep with the code: a check fails if this page drifts.