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.

Real funds

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.

Place an order, sign the payloads, execute
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.

Your codeTrue Markets
Sign inwith your API key
Sign {key_id}.{timestamp}POST /v1/auth/api-key/token
Access and refresh tokensrefresh without signing again
Place the orderwith your token
Create the orderPOST /v1/gateway/orders
Unsigned payloadsone wallet transaction each
Sign and executewith the same API key
Stamp each payloadstays on your machine
Execute with the signaturesPOST /v1/gateway/orders/{id}/execute
Order statuscomplete, or pending until final

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

Was this page helpful?YesNo