GaiaExGaiaEx
API

Leverage & Margin Mode

Set leverage (1x–100x) and margin mode (cross or isolated) for perpetual futures positions on GaiaEx via API.

Set Leverage

POST https://openapi.gaiaex.com/v1/trade/leverage

Set the leverage and margin mode for a symbol. Must be called before placing orders if you want a specific leverage level.

Request Body:

FieldTypeRequiredDescription
user_addressstringYesYour wallet address
symbolstringYesTrading symbol
leverageintYesDesired leverage (1 to maxLeverage)
is_crossbooleanNotrue for cross margin (default), false for isolated

Example Request:

{
  "user_address": "0xYourAddress",
  "symbol": "ETH",
  "leverage": 10,
  "is_cross": true
}

Response:

{
  "success": true,
  "symbol": "ETH",
  "leverage": 10,
  "marginType": "CROSSED",
  "timestamp": 1743508800000
}

INFO

Some symbols only support isolated margin. If you send is_cross: true for an isolated-only symbol, the backend will automatically correct it to isolated margin. You do not need to maintain a list of which symbols support which margin mode — the backend handles this transparently.

Maximum Leverage

Maximum leverage varies by symbol and asset class:

Leverage limits are set per symbol and may change. Fetch GET /symbols/list for the authoritative, current values. Representative values:

Asset ClassTypical Max LeverageExamples
Crypto major25x–40xBTC 40x, ETH 25x
Crypto mid-cap10x–20xSOL 20x, DOGE 10x, ARB 10x
Crypto small-cap3x–5xvaries per symbol
Forex (xyz:)50xxyz:EUR, xyz:JPY
Commodities (xyz:)10x–20xxyz:GOLD 20x, xyz:NATGAS 10x
Equities (xyz:)10xxyz:AAPL, xyz:TSLA, xyz:NVDA
Index (cash:)20x–25xcash:USA500 20x, xyz:XYZ100 25x
Pre-IPO ventures (vntl: / xyz:)3x–5xvntl:OPENAI, vntl:ANTHROPIC, xyz:SPCX

ALWAYS CHECK /symbols/list

Leverage limits are dynamic. Always call GET /symbols/list to get the current maxLeverage for each symbol before setting leverage.

Code Examples

The gaiaex_post and gaiaexPost helpers include HMAC signing. See the Quick Start page for their implementation.

Python

body = json.dumps({
    "user_address": "0xYourAddress",
    "symbol": "ETH",
    "leverage": 10,
    "is_cross": True
})
resp = gaiaex_post("/leverage", body)
print(resp.json())

JavaScript

const body = JSON.stringify({
  user_address: '0xYourAddress',
  symbol: 'ETH',
  leverage: 10,
  is_cross: true,
});
const resp = await gaiaexPost('/leverage', body);
console.log(await resp.json());

curl

BODY='{"user_address":"0xYourAddress","symbol":"ETH","leverage":10,"is_cross":true}'
curl -X POST https://openapi.gaiaex.com/v1/trade/leverage \
  -H "Content-Type: application/json" \
  -H "X-GAIAEX-APIKEY: your_api_key" \
  -H "X-GAIAEX-TIMESTAMP: ${TIMESTAMP}" \
  -H "X-GAIAEX-SIGNATURE: ${SIGNATURE}" \
  -d "${BODY}"