Perpetual Futures Trading
Place and manage perpetual futures orders on GaiaEx via API: market, limit, stop-loss, and take-profit order types.
SKILL.mdDrop-in Claude Code skill with HMAC-SHA256 signing, /fapi/v1 & /fapi/v2 schemas, and secret-redaction guardrails.
AGENTS.mdDrop-in repository AGENTS.md for OpenAI Codex CLI — tick-size rules, rate-limit budgets, and self-custody boundaries.
AGY.mdGoogle Antigravity (agy) & Gemini agent spec with verified async Python WebSocket + REST execution templates.
llms.txtSingle-URL machine-readable index of all GaiaEx documentation pages, OpenAPI 3.0 schema, and Postman collection.
Overview
GaiaEx provides GaiaEx Unified Futures order execution endpoints under https://openapi.gaiaex.com/fapi/v1/*.
- Authentication: Send your API key in the
X-MBX-APIKEYheader and attachtimestamp+signature(HMAC-SHA256(api_secret, query_or_form_string)) as query or form parameters. - Automatic Wallet Resolution: Your wallet account is automatically resolved from
X-MBX-APIKEYon the server side — no wallet address parameter is needed. - Content-Type: Parameters may be sent as URL query strings,
application/x-www-form-urlencoded, orapplication/json.
https://openapi.gaiaex.com/fapi/v1/orderHMACNew Order (TRADE)
Send in a new perpetual futures order.
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
symbol | STRING | YES | Trading symbol (e.g., BTCUSDC, ETHUSDC, BTCUSDT, ETHUSDT) |
side | ENUM | YES | BUY or SELL |
positionSide | ENUM | NO | Default BOTH for One-way Mode; LONG or SHORT for Hedge Mode |
type | ENUM | YES | LIMIT, MARKET, STOP_MARKET, TAKE_PROFIT_MARKET, STOP, TAKE_PROFIT |
timeInForce | ENUM | NO | GTC (Good Till Cancel), IOC (Immediate or Cancel), GTX (Post-Only) |
quantity | DECIMAL | YES | Order quantity in base asset contracts |
reduceOnly | STRING | NO | "true" or "false" (default "false"). Cannot be sent in Hedge Mode or with closePosition=true. |
price | DECIMAL | NO | Order price (required for LIMIT, STOP, and TAKE_PROFIT orders) |
newClientOrderId | STRING | NO | A unique ID among open orders for idempotency. Automatically generated if not sent. |
stopPrice | DECIMAL | NO | Used with STOP, STOP_MARKET, TAKE_PROFIT, or TAKE_PROFIT_MARKET orders |
closePosition | STRING | NO | "true" or "false" — Close-All with STOP_MARKET or TAKE_PROFIT_MARKET |
recvWindow | LONG | NO | Timestamp validity window in ms (default 5000) |
timestamp | LONG | YES | Current Unix timestamp in milliseconds |
Additional Mandatory Parameters by Order Type:
| Order Type | Additional Mandatory Parameters |
|---|---|
LIMIT | timeInForce, quantity, price |
MARKET | quantity |
STOP / TAKE_PROFIT | quantity, price, stopPrice |
STOP_MARKET / TAKE_PROFIT_MARKET | stopPrice, plus quantity (or closePosition="true") |
Example Request (Query / Form):
POST https://openapi.gaiaex.com/fapi/v1/order?symbol=ETHUSDC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=0.1&price=3500.00×tamp=1743508800000&signature=c3e85abeacfbb9ef64cfb7163b31d622e1a9744c128be6249e8347479c899158
X-MBX-APIKEY: your_api_key_hereResponse:
{
"orderId": 987654321,
"symbol": "ETHUSDC",
"status": "NEW",
"clientOrderId": "my_order_id_1",
"price": "3500.00",
"avgPrice": "0.00000",
"origQty": "0.1",
"executedQty": "0",
"cumQty": "0",
"cumQuote": "0",
"timeInForce": "GTC",
"type": "LIMIT",
"reduceOnly": false,
"closePosition": false,
"side": "BUY",
"positionSide": "BOTH",
"stopPrice": "0",
"workingType": "CONTRACT_PRICE",
"priceProtect": false,
"origType": "LIMIT",
"time": 1743508800000,
"updateTime": 1743508800000
}Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | Trading symbol (e.g. ETHUSDC, BTCUSDT, GOLDUSDC) |
| side | string | Yes | BUY or SELL |
| type | string | Yes | LIMIT, MARKET, STOP_MARKET, TAKE_PROFIT_MARKET |
| quantity | string | Yes | Order quantity |
| price | string | No | Limit price (required for LIMIT orders) |
| stopPrice | string | No | Trigger price (for STOP_MARKET / TAKE_PROFIT_MARKET) |
| timeInForce | string | No | GTC, IOC, or GTX (Post-Only) |
| reduceOnly | boolean | No | true or false (default false) |
| newClientOrderId | string | No | Unique client order ID |
| timestamp | int | Yes | Request timestamp in ms |
| signature | string | Yes | HMAC-SHA256 signature |
symbolTrading symbol (e.g. ETHUSDC, BTCUSDT, GOLDUSDC)
sideBUY or SELL
typeLIMIT, MARKET, STOP_MARKET, TAKE_PROFIT_MARKET
quantityOrder quantity
priceLimit price (required for LIMIT orders)
stopPriceTrigger price (for STOP_MARKET / TAKE_PROFIT_MARKET)
timeInForceGTC, IOC, or GTX (Post-Only)
reduceOnlytrue or false (default false)
newClientOrderIdUnique client order ID
timestampRequest timestamp in ms
signatureHMAC-SHA256 signature
https://openapi.gaiaex.com/fapi/v1/orderHMACCancel Order (TRADE)
Cancel an active order. Either orderId or origClientOrderId must be sent.
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
symbol | STRING | YES | Trading symbol (e.g., ETHUSDC, BTCUSDT) |
orderId | LONG | NO | System order ID to cancel |
origClientOrderId | STRING | NO | Client order ID to cancel |
recvWindow | LONG | NO | Timestamp validity window in ms (default 5000) |
timestamp | LONG | YES | Current Unix timestamp in milliseconds |
Example Request:
DELETE https://openapi.gaiaex.com/fapi/v1/order?symbol=ETHUSDC&orderId=987654321×tamp=1743508800000&signature=8bb72b649cea0ef7e170cf82d7e7e902279cf8b4fbf73b7248c1eb00a62ddc42
X-MBX-APIKEY: your_api_key_hereResponse:
{
"orderId": 987654321,
"symbol": "ETHUSDC",
"status": "CANCELED",
"clientOrderId": "my_order_id_1",
"price": "3500.00",
"avgPrice": "0.00000",
"origQty": "0.1",
"executedQty": "0",
"cumQty": "0",
"cumQuote": "0",
"timeInForce": "GTC",
"type": "LIMIT",
"reduceOnly": false,
"closePosition": false,
"side": "BUY",
"positionSide": "BOTH",
"stopPrice": "0",
"workingType": "CONTRACT_PRICE",
"priceProtect": false,
"origType": "LIMIT",
"time": 1743508800000,
"updateTime": 1743508805000
}Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | Trading symbol (e.g. ETHUSDC) |
| orderId | int | No | Order ID to cancel |
| origClientOrderId | string | No | Client order ID to cancel |
| timestamp | int | Yes | Request timestamp in ms |
| signature | string | Yes | HMAC-SHA256 signature |
symbolTrading symbol (e.g. ETHUSDC)
orderIdOrder ID to cancel
origClientOrderIdClient order ID to cancel
timestampRequest timestamp in ms
signatureHMAC-SHA256 signature
https://openapi.gaiaex.com/fapi/v1/orderHMACModify Order (TRADE)
Order modify function — modifies an existing open limit order's price and quantity in place.
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
orderId | LONG | NO | System order ID (either orderId or origClientOrderId must be sent) |
origClientOrderId | STRING | NO | Client order ID |
symbol | STRING | YES | Trading symbol (e.g., ETHUSDC, BTCUSDT) |
side | ENUM | YES | BUY or SELL |
quantity | DECIMAL | YES | New order quantity |
price | DECIMAL | YES | New limit price |
recvWindow | LONG | NO | Timestamp validity window in ms (default 5000) |
timestamp | LONG | YES | Current Unix timestamp in milliseconds |
Example Request:
PUT https://openapi.gaiaex.com/fapi/v1/order?symbol=ETHUSDC&orderId=987654321&side=BUY&quantity=0.2&price=3480.00×tamp=1743508800000&signature=a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2
X-MBX-APIKEY: your_api_key_hereResponse:
{
"orderId": 987654322,
"symbol": "ETHUSDC",
"status": "NEW",
"clientOrderId": "987654322",
"price": "3480.00",
"avgPrice": "0.00000",
"origQty": "0.2",
"executedQty": "0",
"cumQty": "0",
"cumQuote": "0",
"timeInForce": "GTC",
"type": "LIMIT",
"reduceOnly": false,
"closePosition": false,
"side": "BUY",
"positionSide": "BOTH",
"stopPrice": "0",
"workingType": "CONTRACT_PRICE",
"priceProtect": false,
"origType": "LIMIT",
"time": 1743508805000,
"updateTime": 1743508805000
}Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | Trading symbol (e.g. ETHUSDC) |
| orderId | int | Yes | Order ID to modify |
| side | string | Yes | BUY or SELL |
| quantity | string | Yes | New order quantity |
| price | string | Yes | New limit price |
| timestamp | int | Yes | Request timestamp in ms |
| signature | string | Yes | HMAC-SHA256 signature |
symbolTrading symbol (e.g. ETHUSDC)
orderIdOrder ID to modify
sideBUY or SELL
quantityNew order quantity
priceNew limit price
timestampRequest timestamp in ms
signatureHMAC-SHA256 signature
https://openapi.gaiaex.com/fapi/v1/orderHMACQuery Order (USER_DATA)
Check an order's status. Either orderId or origClientOrderId must be sent.
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
symbol | STRING | YES | Trading symbol (e.g., ETHUSDC, BTCUSDT) |
orderId | LONG | NO | System order ID |
origClientOrderId | STRING | NO | Client order ID |
recvWindow | LONG | NO | Timestamp validity window in ms (default 5000) |
timestamp | LONG | YES | Current Unix timestamp in milliseconds |
Response:
{
"orderId": 987654321,
"symbol": "ETHUSDC",
"status": "NEW",
"clientOrderId": "my_order_id_1",
"price": "3500.00",
"avgPrice": "0.00000",
"origQty": "0.1",
"executedQty": "0",
"cumQty": "0",
"cumQuote": "0",
"timeInForce": "GTC",
"type": "LIMIT",
"reduceOnly": false,
"closePosition": false,
"side": "BUY",
"positionSide": "BOTH",
"stopPrice": "0",
"workingType": "CONTRACT_PRICE",
"priceProtect": false,
"origType": "LIMIT",
"time": 1743508800000,
"updateTime": 1743508800000
}Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | Trading symbol (e.g. ETHUSDC) |
| orderId | int | No | Order ID |
| origClientOrderId | string | No | Client order ID |
| timestamp | int | Yes | Request timestamp in ms |
| signature | string | Yes | HMAC-SHA256 signature |
symbolTrading symbol (e.g. ETHUSDC)
orderIdOrder ID
origClientOrderIdClient order ID
timestampRequest timestamp in ms
signatureHMAC-SHA256 signature
https://openapi.gaiaex.com/fapi/v1/allOpenOrdersHMACCancel All Open Orders (TRADE)
Cancel all open orders for a specified symbol.
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
symbol | STRING | YES | Trading symbol (e.g., ETHUSDC, BTCUSDT) |
recvWindow | LONG | NO | Timestamp validity window in ms (default 5000) |
timestamp | LONG | YES | Current Unix timestamp in milliseconds |
Response:
{
"code": 200,
"msg": "The operation of cancel all open order is done."
}Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | Trading symbol (e.g. ETHUSDC) |
| timestamp | int | Yes | Request timestamp in ms |
| signature | string | Yes | HMAC-SHA256 signature |
symbolTrading symbol (e.g. ETHUSDC)
timestampRequest timestamp in ms
signatureHMAC-SHA256 signature
https://openapi.gaiaex.com/fapi/v1/batchOrdersHMACPlace Multiple Orders (TRADE)
Place up to 5 orders in a single batch request.
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
batchOrders | LIST<JSON> | YES | JSON-encoded list of up to 5 order objects (each containing symbol, side, type, quantity, price, timeInForce, etc.) |
recvWindow | LONG | NO | Timestamp validity window in ms (default 5000) |
timestamp | LONG | YES | Current Unix timestamp in milliseconds |
Response:
[
{
"orderId": 987654321,
"symbol": "ETHUSDC",
"status": "NEW",
"clientOrderId": "batch_order_1",
"price": "3500.00",
"avgPrice": "0.00000",
"origQty": "0.1",
"executedQty": "0",
"cumQty": "0",
"cumQuote": "0",
"timeInForce": "GTC",
"type": "LIMIT",
"reduceOnly": false,
"closePosition": false,
"side": "BUY",
"positionSide": "BOTH",
"stopPrice": "0",
"workingType": "CONTRACT_PRICE",
"priceProtect": false,
"origType": "LIMIT",
"time": 1743508800000,
"updateTime": 1743508800000
}
]Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| batchOrders | string | Yes | JSON array of up to 5 order objects |
| timestamp | int | Yes | Request timestamp in ms |
| signature | string | Yes | HMAC-SHA256 signature |
batchOrdersJSON array of up to 5 order objects
timestampRequest timestamp in ms
signatureHMAC-SHA256 signature
https://openapi.gaiaex.com/fapi/v1/batchOrdersHMACCancel Multiple Orders (TRADE)
Cancel up to 10 orders in a single batch request. Either orderIdList or origClientOrderIdList must be provided.
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
symbol | STRING | YES | Trading symbol (e.g., ETHUSDC, BTCUSDT) |
orderIdList | LIST<LONG> | NO | JSON array of up to 10 order IDs (e.g., [987654321,987654322]) |
origClientOrderIdList | LIST<STRING> | NO | JSON array of up to 10 client order IDs (e.g., ["order_1","order_2"]) |
recvWindow | LONG | NO | Timestamp validity window in ms (default 5000) |
timestamp | LONG | YES | Current Unix timestamp in milliseconds |
Response:
[
{
"orderId": 987654321,
"symbol": "ETHUSDC",
"status": "CANCELED",
"clientOrderId": "batch_order_1",
"price": "3500.00",
"avgPrice": "0.00000",
"origQty": "0.1",
"executedQty": "0",
"cumQty": "0",
"cumQuote": "0",
"timeInForce": "GTC",
"type": "LIMIT",
"reduceOnly": false,
"closePosition": false,
"side": "BUY",
"positionSide": "BOTH",
"stopPrice": "0",
"workingType": "CONTRACT_PRICE",
"priceProtect": false,
"origType": "LIMIT",
"time": 1743508800000,
"updateTime": 1743508805000
}
]Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | Trading symbol (e.g. ETHUSDC) |
| orderIdList | string | No | JSON array of up to 10 order IDs |
| origClientOrderIdList | string | No | JSON array of up to 10 client order IDs |
| timestamp | int | Yes | Request timestamp in ms |
| signature | string | Yes | HMAC-SHA256 signature |
symbolTrading symbol (e.g. ETHUSDC)
orderIdListJSON array of up to 10 order IDs
origClientOrderIdListJSON array of up to 10 client order IDs
timestampRequest timestamp in ms
signatureHMAC-SHA256 signature
https://openapi.gaiaex.com/fapi/v1/countdownCancelAllHMACAuto-Cancel All Open Orders (TRADE)
Cancel all open orders of the specified symbol at the end of the specified countdown timer (Dead Man's Switch). Call repeatedly before the timer expires to reset the countdown, or pass countdownTime=0 to disarm the timer.
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
symbol | STRING | YES | Trading symbol (e.g., ETHUSDC, BTCUSDT) |
countdownTime | LONG | YES | Countdown duration in milliseconds (e.g. 60000 for 60s; 0 to cancel the timer) |
recvWindow | LONG | NO | Timestamp validity window in ms (default 5000) |
timestamp | LONG | YES | Current Unix timestamp in milliseconds |
Response:
{
"symbol": "ETHUSDC",
"countdownTime": "60000"
}Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | Trading symbol (e.g. ETHUSDC) |
| countdownTime | int | Yes | Countdown time in ms (0 to cancel timer) |
| timestamp | int | Yes | Request timestamp in ms |
| signature | string | Yes | HMAC-SHA256 signature |
symbolTrading symbol (e.g. ETHUSDC)
countdownTimeCountdown time in ms (0 to cancel timer)
timestampRequest timestamp in ms
signatureHMAC-SHA256 signature