For AI agents: the documentation index is at /llms.txt, and this page is available as Markdown at /trading-api.md.
About Trading API
The Trading API lets you trade your own True Markets account from code: place orders, move funds, and read your balances and history. One API key, created in the trading app, authenticates your requests and signs your orders. To offer trading to your own customers, use Gateway.
Limit orders rest on the True Markets order book. Market orders go to the better price after fees, on the book or onchain.
Every trade moves real funds. A first trade costs a few dollars of USDC, and we pay the network fees.
How a trade works
Your code mints a token from your key file and sends it on every call. Placing an order or transfer returns unsigned wallet transactions, called payloads. You sign each one with the same key and post the signatures to execute. Nothing moves until you do.
const order = await post("/v1/gateway/orders", {
asset_id: assetId,
qty: "2",
qty_unit: "quote",
side: "buy",
type: "market",
});
const signatures = await Promise.all(
order.payloads.map((p) => stamp(p.payload)),
);
await post(`/v1/gateway/orders/${orderId}/execute`, {
signatures,
auth_type: "api_key",
});post() sends your token. stamp() signs a payload with your key. Getting started defines both.
Trading API use cases
- Algorithmic and systematic trading
- AI agents trading your account
- Businesses trading their own account
How it differs from Gateway
The Trading API and Gateway share the same endpoints, documented in the Trading REST reference. What changes is whose account a request acts on.
- Your token acts as you. With Gateway, you add a header to name which of your users a request is for. With the Trading API, you never send it.
- Your account already exists. You sign up at app.truemarkets.co, and the app creates your wallet when you set up a passkey, so there are no users to create.
- One key does both jobs. The same key mints your tokens and signs your orders. Gateway uses two keys for those two jobs.
- You can refresh tokens. Minting a token also returns a refresh token, so you can get a new access token without signing again.
Get started
Trade
Before you raise your amounts, work through the Go live checklist.
Reference
- Need help? Ask us on Discord, or email [email protected].
- See what changed in the changelog