Skip to main content
An AI agent trades on OCX exactly the way a human client does: it reads market data, forms a view, places and cancels orders, watches its fills, and manages risk. There is no separate “agent API” — your agent speaks the same public REST and streaming surface and authenticates with a session token it obtains by signing in with its own wallet.
Market data is public, the order lifecycle is a handful of JSON endpoints, and futures executions arrive on a Server-Sent Events stream. If you can write an HTTP client and sign a message with a wallet key, you can write an OCX agent.

The agent loop

Every OCX agent, from a simple signal follower to a market-making bot, reduces to the same cycle. Keep it tight and idempotent.
1

Read

Pull markets, order books, stats, candles, and the option board — or subscribe to the streams — to build your current view.
2

Decide

Turn that view into an intent: an order to place, a quote ladder to refresh, or a position to reduce.
3

Act

Preview to size safely, then place or cancel. Use a clientOrderId so retries never double-submit.
4

Monitor

Consume the futures account stream and poll option fills to detect executions and position changes.
5

Manage risk

Track NLV and margin headroom, de-risk proactively, and wire both cancel-alls to your kill switch.

What your agent talks to

Market data (public)

Futures markets, order books, 24h stats, candles, fee schedules, and the option board. No credentials required.

Trading (session)

Preview, place, amend, and cancel futures and option orders; replace option quote ladders in one call; flatten futures positions.

Real-time streams (SSE)

Futures books, your futures fills and positions, the option board, and your balances.

Account reads

Positions, open orders, fills, balances, NLV, and margin — for reconciliation between stream events.

Programmatic authentication

The agent signs in with Sign-In With Ethereum using a wallet key it controls, then sends the resulting session token as Authorization: Bearer <token> on every request. The session lasts 7 days; the agent re-signs before it expires.
The SIWE message must use domain testnet.ocx.global, uri https://testnet.ocx.global, chainId 84532, the nonce, and an expiry no more than 10 minutes out. A complete Node example is in Authentication.
The wallet the agent signs with is the account it trades. Give the agent a dedicated wallet funded only with what it may risk, and keep both the wallet key and the session token in a secret manager — never in source, prompts, or logs. If the token leaks, revoke it with POST {API_BASE}/auth/logout.
API keys created in the app are not yet accepted by the public API, so agents authenticate with a session token.

Pricing your agent should understand

Your agent consumes prices and marks; it does not recompute the exchange’s internals.
Each dated future is marked to the live price of the matching contract on the reference market; trades on OCX do not move the mark. Futures have a fixed expiry and cash-settle — there is no funding. See Futures methodology.
Option mark on the board follows the reference option market; iv and delta are computed by OCX with Black-76 against each expiry’s forward. They are reference values — the tradable prices are always the order book. See Options methodology.
Quantities are whole contracts. A futures notional is quantity × contractSize × price; an option premium is price × quantity × multiplier (50 for SPX, 20 for NDX). Read terms from /fut/markets and /markets/products.

Risk is enforced server-side

OCX runs portfolio margin across options and futures: every order passes a margin check before acceptance, and a rejected order returns INSUFFICIENT_MARGIN — handle it, don’t retry blindly. Accounts whose margin requirement exceeds their net liquidation value are reduced, and accounts at the liquidation floor are liquidated, with an insurance fund absorbing bad debt. Your agent should track its own headroom from GET /portfolio/balances and de-risk before it gets there.
Build three safety reflexes into every agent from day one: use reduceOnly for exit-only orders, wire both cancel-alls (/fut/orders/cancel-all and /orders/cancel-all) to a single kill switch, and back off on 429 and RATE_LIMITED.

Next step

Build an agent

A concrete walkthrough: sign in, pull market data, size an order, submit it, monitor fills on the stream, and manage risk — with code.