Everything an agent needs is public and documented. Market data is open, the
order lifecycle is a handful of JSON endpoints, and execution updates arrive on
a single Server-Sent Events stream. If you can write an HTTP client, you can
write an OCX agent.
The agent loop
Every OCX agent, from a simple signal follower to a full market-making bot, reduces to the same cycle. Keep it tight and idempotent.Read
Pull instruments, order books, stats, and candles — or subscribe to the live
stream — to build your current view of the market.
Decide
Turn that view into an intent: an order to place, a quote ladder to refresh,
or a position to reduce.
Act
Preview to size safely, then place or cancel. Use a
clientOrderId so retries
never double-submit.What your agent talks to
Market data (public)
Instruments, order books, 24h stats, fee tiers, and candles. No credentials
required — sending your key is harmless but optional.
Trading (API key)
Preview, place, and cancel orders; refresh multi-level quote ladders in one
atomic call; flatten positions.
Real-time stream (SSE)
One connection per market delivers the order book, your fills, and your
position updates as they occur.
Account reads
Positions, open orders, trades, and balances — for reconciliation and risk
checks between stream events.
Programmatic authentication
A human owner signs in once with Sign-In With Ethereum (SIWE), then provisions a scoped, IP-pinned, expiring API key for the agent. The agent sends that key as anx-api-key header on every request and never touches a wallet again.
Scopes — grant least privilege
read
Market data plus your own account reads. Give this to research, monitoring,
or signal-only agents that never trade.
trade
Everything
read can do, plus order and quote actions. Reserve this for
agents that actually execute.Today the gateway accepts API keys on the high-throughput programmatic paths:
order preview, bulk quotes, and cancel-all. The single-order
place/cancel-by-id endpoints and the real-time stream run under a signed-in
session. Agents that need discrete headless order placement should use the
bulk-quote path or run under a session token. This coverage is expanding —
check the current gateway policy for your integration.
Pricing your agent should understand
Your agent consumes prices and marks; it does not recompute the exchange’s internals. Treat the following as inputs to your strategy.Perpetual mark and funding
Perpetual mark and funding
Perpetuals track an underlying index. Funding is exchanged periodically based
on the gap between the perp’s mark and its index (plus a carry term), which
nudges the perp price toward the underlying. Read the current funding context
from
/perps/market-stats, and fund your account to hold positions through
funding periods.Dated futures fair value
Dated futures fair value
A dated future is priced off spot plus a cost-of-carry term to expiry, so it
trades at a premium or discount to spot (contango or backwardation). See the
Futures methodology for the concept.
Option marks
Option marks
Option
mark, iv, and delta on the board are OCX reference marks computed
from a fitted volatility surface — published for reference and risk. The
tradable prices are always the order book. See the
Options methodology.Risk is enforced server-side
OCX runs portfolio margin on the exchange side: every order passes a margin gate before acceptance. A rejected order returns an insufficient-margin error — handle it, don’t retry blindly. Positions that breach maintenance margin are liquidated by the exchange, with an insurance fund backstopping bad debt. Your agent should track its own margin headroom frombalances and positions and
de-risk before it gets there.
Next step
Build an agent
A concrete walkthrough: authenticate, pull market data, size an order, submit
it, monitor fills on the stream, and manage risk — with code.