Skip to main content
The Trading API is the programmatic way to trade on gTrade. It is the foundation for bots, terminals, copy-trading tools, the Claude MCP server and the TradingView broker integration. The API is non-custodial: you trade with an agent key the trader authorised on-chain once, Gains never holds funds or keys, and every transaction is prepared by the API but signed, paid for and broadcast by you. No gas is sponsored.

Two surfaces, one core

Both surfaces share the agent model and the order lifecycle. Native agents broadcast their own transactions; the Hyperliquid facade relays them through a Gains relayer, the one place gas is sponsored, because Hyperliquid SDKs can only sign typed data. On mainnet that relayer is not enabled yet: the facade serves POST /info and the stream, and POST /exchange answers CHAIN_READ_ONLY until it is.

Environments

chain is arbitrum on mainnet today (base, polygon and megaeth follow on the same paths) and arbitrum-sepolia on testnet. Every resource is scoped to one chain; positions on Base will not be visible through /v1/arbitrum. GET /v1/{chain} returns the chain id, the Diamond address and the signing domain.

What “simple” means here

Order lifecycle in one paragraph

gTrade fills market orders through its oracle network rather than a matching engine. POST /orders answers prepared with the id you will keep for the rest of the lifecycle and the transaction to sign and broadcast; once it is mined (report the hash with POST /orders/{id}/submit, or let the chain watcher see it) the order is pending. Within seconds the status becomes filled (with price, size and fees), rejected (with the reason) or, if the oracle never answers, timed_out, in which case DELETE /orders/{id} prepares the reclaim of the collateral. Limit and stop orders rest as open until triggered or canceled. Track any order with GET /orders/{id}, the orders WebSocket channel, or order.waitForFill() in the SDK. Details in Orders.

Where to start

Quickstart

Authorise an agent and fill a first test order on testnet in under 15 minutes.

Authentication

Agents, scopes, the EIP-712 request signature, read-only API keys.

Orders and positions

Sizes, prices, leverage, the lifecycle and every error you can get.

API reference

Every endpoint, generated from the OpenAPI contract.

SDKs and examples

The TypeScript SDK, generated clients, and five worked example projects.

Status

The API is live on Arbitrum mainnet, with the Sepolia testnet for trying the flow without funds. Isolated margin only (onlyIsolated: true on every market); cross margin, TWAP and trailing stops follow their own tickets and will land as new fields on the same resources. Breaking changes ship under a new /v2 prefix, never under /v1.