# CrossEx
CrossEx is a cross-exchange trading platform that allows users to trade across multiple exchanges (Binance, OKX, Gate, Bybit, Kraken, Hyperliquid, Deribit, and Lighter) through a unified account. The CrossEx API provides account management, asset transfers, order placement, and position management across exchanges.
- REST API production base URL:
https://api.gateio.ws/api/v4 - Help Center (opens new window)
- Cross-exchange trading (opens new window)
# Query symbol information
Code samples
# coding: utf-8
import requests
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/rule/symbols'
query_param = ''
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
curl -X GET https://api.gateio.ws/api/v4/crossex/rule/symbols \
-H 'Accept: application/json'
GET /crossex/rule/symbols
Query symbol information
Query Trading Pair Information
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| symbols | query | string | false | List of trading pairs, comma-separated. Example: BINANCE_FUTURE_ADA_USDT,OKX_FUTURE_ADA_USDT |
# Detailed descriptions
symbols: List of trading pairs, comma-separated.
Example:
BINANCE_FUTURE_ADA_USDT,OKX_FUTURE_ADA_USDT
Example responses
200 Response
[
{
"symbol": "BINANCE_FUTURE_ADA_USDT",
"exchange_type": "BINANCE",
"business_type": "FUTURE",
"state": "live",
"min_size": "1",
"min_notional": "5",
"lot_size": "1",
"tick_size": "0.00010",
"max_num_orders": "200",
"max_market_size": "300000",
"max_limit_size": "2000000",
"contract_size": "1",
"liquidation_fee": "0.012500",
"support_rpi": "false",
"support_cross": "true",
"delist_time": "0"
},
{
"symbol": "OKX_FUTURE_ADA_USDT",
"exchange_type": "OKX",
"business_type": "FUTURE",
"state": "suspend",
"min_size": "10",
"min_notional": "0",
"lot_size": "10",
"tick_size": "0.0001",
"max_num_orders": "10",
"max_market_size": "1000000",
"max_limit_size": "10000000000",
"contract_size": "100",
"liquidation_fee": "0",
"delist_time": "1762163297615",
"support_rpi": "false",
"support_cross": "true"
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | [Symbol] |
Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
| None | array | none |
| » symbol | string | Unique trading pair identifier in the form ExchangeType_BusinessType_Base_Counter. |
| » exchange_type | string | Venue bucket (BINANCE / OKX / GATE / BYBIT / KRAKEN / HYPERLIQUID / DERIBIT / LIGHTER). |
| » business_type | string | Business type (SPOT Spot / FUTURE Futures / MARGIN Margin). |
| » state | string | Status (live running / suspend paused). |
| » min_size | string | Minimum order quantity |
| » min_notional | string | Minimum Order Value |
| » lot_size | string | Quantity Step |
| » tick_size | string | Price Step |
| » max_num_orders | string | maximumopen orderamount |
| » max_market_size | string | Maximum Market Order Quantity |
| » max_limit_size | string | Maximum order quantity for limit orders. |
| » contract_size | string | Contract multiplier (deprecated; quantity is used uniformly) |
| » liquidation_fee | string | Liquidation Fee Rate |
| » delist_time | string | Millisecond timestamp; 0 means not delisted. |
| » support_rpi | string | Whether RPI order placement is supported (true if supported; false otherwise) |
| » support_cross | string | Whether cross-margin order placement is supported (true if supported; false otherwise) |
# Query risk limit information
Code samples
# coding: utf-8
import requests
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/rule/risk_limits'
query_param = 'symbols=BINANCE_FUTURE_AAVE_USDT'
r = requests.request('GET', host + prefix + url + "?" + query_param, headers=headers)
print(r.json())
curl -X GET https://api.gateio.ws/api/v4/crossex/rule/risk_limits?symbols=BINANCE_FUTURE_AAVE_USDT \
-H 'Accept: application/json'
GET /crossex/rule/risk_limits
Query risk limit information
Query risk limit information for futures/margin trading pairs
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| symbols | query | string | true | Trading Pair List, multiple separated by commas Example values: BINANCE_FUTURE_ADA_USDT,GATE_MARGIN_ADA_USDT |
# Detailed descriptions
symbols: Trading Pair List, multiple separated by commas
Example values:
BINANCE_FUTURE_ADA_USDT,GATE_MARGIN_ADA_USDT
Example responses
200 Response
[
{
"symbol": "BINANCE_FUTURE_BTC_USDT",
"tiers": [
{
"min_risk_limit_value": "0",
"max_risk_limit_value": "50000",
"quick_cal_amount": "0",
"leverage_max": "20",
"maintenance_rate": "0.004",
"tier": "1"
},
{
"min_risk_limit_value": "50000",
"max_risk_limit_value": "100000",
"quick_cal_amount": "50",
"leverage_max": "18",
"maintenance_rate": "0.005",
"tier": "2"
}
]
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | [Inline] |
Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
| » CrossexRiskLimit | object | none |
| »» symbol | string | none |
| »» tiers | array | none |
| »»» CrossexRiskLimitTier | object | none |
| »»»» min_risk_limit_value | string | Minimum risk limit value |
| »»»» max_risk_limit_value | string | Maximum risk limit value |
| »»»» quick_cal_amount | string | Quick-calculation amount |
| »»»» leverage_max | string | Maximum leverage |
| »»»» maintenance_rate | string | Maintenance margin rate |
| »»»» tier | string | Tier |
# Query supported transfer currencies
Code samples
# coding: utf-8
import requests
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/transfers/coin'
query_param = ''
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
curl -X GET https://api.gateio.ws/api/v4/crossex/transfers/coin \
-H 'Accept: application/json'
GET /crossex/transfers/coin
Query supported transfer currencies
est_fee: Estimated fee. When a fund transfer involves an on-chain withdrawal, the exchange charges this fee. This value is for reference only; the actual fee charged by the exchange applies
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| coin | query | string | false | Query by specified currency name |
Example responses
200 Response
[
{
"coin": "string",
"min_trans_amount": 0,
"est_fee": 0,
"precision": 0,
"is_disabled": 0
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | [Inline] |
Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
| » CrossexTransferCoin | object | none |
| »» coin | string | Currency |
| »» min_trans_amount | number | Minimum transfer amount (estimated fee included) |
| »» est_fee | number | Estimated Fee |
| »» precision | integer | Precision |
| »» is_disabled | integer | If it is disabled. 0 means NOT being disabled |
# Query Fund Transfer History
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/transfers'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/transfers"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/transfers
Query Fund Transfer History
Rate Limit: 200 requests per 10 seconds
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| coin | query | string | false | Query by specified currency name |
| order_id | query | string | false | Supports querying by the order ID returned when creating an order (tx_id), as well as a user-defined custom ID specified at creation (text) |
| from | query | integer | false | Start timestamp for the query |
| to | query | integer | false | End timestamp for the query, defaults to current time if not specified |
| page | query | integer | false | Page number |
| limit | query | integer | false | Maximum number returned by list, max 1000 |
Example responses
200 Response
[
{
"id": "33829017692939266",
"text": "33829017692939266",
"from_account_type": "CROSSEX_BINANCE",
"to_account_type": "CROSSEX_OKX",
"coin": "BTC",
"amount": "1.1234567",
"actual_receive": "1.123",
"status": "SUCCESS",
"fail_reason": null,
"create_time": 1750681141933,
"update_time": 1750681141933
},
{
"id": "38083797492939266",
"text": "38083797492939266",
"from_account_type": "CROSSEX",
"to_account_type": "SPOT",
"coin": "USDT",
"amount": "100",
"actual_receive": null,
"status": "FAIL",
"fail_reason": "Insufficient transferAvailable",
"create_time": 1750681141933,
"update_time": 1750681141933
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | [Inline] |
Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
| » CrossexTransferRecord | object | none |
| »» id | string | Order ID |
| »» text | string | Client Custom ID |
| »» from_account_type | string | Source account for this operation (from) (CROSSEX_BINANCE, CROSSEX_OKX, CROSSEX_GATE, CROSSEX_BYBIT, CROSSEX_KRAKEN, CROSSEX_HYPERLIQUID, CROSSEX_DERIBIT, CROSSEX_LIGHTER, CROSSEX, SPOT). |
| »» to_account_type | string | Destination account for this operation (to) (CROSSEX_BINANCE, CROSSEX_OKX, CROSSEX_GATE, CROSSEX_BYBIT, CROSSEX_KRAKEN, CROSSEX_HYPERLIQUID, CROSSEX_DERIBIT, CROSSEX_LIGHTER, CROSSEX, SPOT). |
| »» coin | string | Currency |
| »» amount | string | Transfer amount, the amount requested for the transfer |
| »» actual_receive | string | Actual credited amount (has a value when status = SUCCESS; empty for other statuses) |
| »» status | string | Transfer Status - FAIL: Failed- SUCCESS: Successful- PENDING: Transfer in Progress |
| »» fail_reason | string | Failure reason (has a value when status = FAIL; empty for other statuses) |
| »» create_time | integer | Creation time of order |
| »» update_time | integer | OrderUpdateTime |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Fund Transfer
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/transfers'
query_param = ''
body='{"coin":"USDT","amount":"242.45","from":"SPOT","to":"CROSSEX"}'
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('POST', prefix + url, query_param, body)
headers.update(sign_headers)
r = requests.request('POST', host + prefix + url, headers=headers, data=body)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="POST"
url="/crossex/transfers"
query_param=""
body_param='{"coin":"USDT","amount":"242.45","from":"SPOT","to":"CROSSEX"}'
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url -d "$body_param" -H "Content-Type: application/json" \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
POST /crossex/transfers
Fund Transfer
Rate limit: 10 requests per 10 seconds
Body parameter
{
"coin": "USDT",
"amount": "242.45",
"from": "SPOT",
"to": "CROSSEX"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | CrossexTransferRequest | false | none |
| » coin | body | string | true | Currency |
| » amount | body | string | true | Transfer amount |
| » from | body | string | true | from debit account (funds withdrawn from): CROSSEX_BINANCE, CROSSEX_OKX, CROSSEX_GATE, CROSSEX_BYBIT, CROSSEX_KRAKEN, CROSSEX_HYPERLIQUID, CROSSEX_DERIBIT, CROSSEX_LIGHTER, CROSSEX, SPOT |
| » to | body | string | true | to receiving account (CROSSEX_BINANCE, CROSSEX_OKX, CROSSEX_GATE, CROSSEX_BYBIT, CROSSEX_KRAKEN, CROSSEX_HYPERLIQUID, CROSSEX_DERIBIT, CROSSEX_LIGHTER, CROSSEX, SPOT). |
| » text | body | string | false | User-defined ID |
Example responses
200 Response
{
"tx_id": "23453",
"text": "23453"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | CrossexTransferResponse |
Response Schema
Status Code 200
CrossexTransferResponse
| Name | Type | Description |
|---|---|---|
| » tx_id | string | Order ID |
| » text | string | User-defined Order ID |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Create order
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/orders'
query_param = ''
body='{"symbol":"BINANCE_SPOT_ADA_USDT","side":"BUY","type":"MARKET","quote_qty":"10"}'
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('POST', prefix + url, query_param, body)
headers.update(sign_headers)
r = requests.request('POST', host + prefix + url, headers=headers, data=body)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="POST"
url="/crossex/orders"
query_param=""
body_param='{"symbol":"BINANCE_SPOT_ADA_USDT","side":"BUY","type":"MARKET","quote_qty":"10"}'
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url -d "$body_param" -H "Content-Type: application/json" \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
POST /crossex/orders
Create order
Rate Limit: 100 requests per 10 seconds, maximum 1,000 open orders per user
Body parameter
{
"symbol": "BINANCE_SPOT_ADA_USDT",
"side": "BUY",
"type": "MARKET",
"quote_qty": "10"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | CrossexOrderRequest | false | none |
| » text | body | string | false | Client-defined Order ID, supports letters (a-z), numbers (0-9), symbols (-, _) only |
| » symbol | body | string | true | Unique identifier {Exchange}_{Business}_{Base}_{Counter}Examples: To send a Binance spot order on ADA/USDT, use BINANCE_SPOT_ADA_USDT;For an ADA/USDT-margined USDT perpetual futures order on OKX, use OKX_FUTURE_ADA_USDT;For ADA/USDT margin trading on Gate, use GATE_MARGIN_ADA_USDT;For ADA/USDT spot trading on Bybit, use BYBIT_SPOT_ADA_USDT;For an ADA/USD futures order on Kraken, use KRAKEN_FUTURE_ADA_USD;For an ADA/USDC futures order on Hyperliquid, use HYPERLIQUID_FUTURE_ADA_USDC;For an ADA/USDC futures order on Deribit, use DERIBIT_FUTURE_ADA_USDC;For an ADA/USDC futures order on Lighter, use LIGHTER_FUTURE_ADA_USDC;Supports spot trades, USDT-margined perpetual futures, and spot margin templates. BYBIT and DERIBIT omit spot margin for now; Kraken, Hyperliquid, and Lighter omit dedicated spot/margin legs inside CrossEx. |
| » side | body | string | true | BUY, SELL |
| » type | body | string | false | Order type (default: LIMIT; supported types: LIMIT, MARKET) |
| » time_in_force | body | string | false | Defaults to GTC. Supported values: GTC, IOC, FOK, POC, and RPIGTC: GoodTillCancelledIOC: ImmediateOrCancelledFOK: FillOrKillPOC: PendingOrCancelled or PostOnlyRPI: Retail Price Improvement |
| » qty | body | string | false | Order quantity (required unless spot or margin market buy) |
| » price | body | string | false | Limit Order Price (Required for Limit Orders) |
| » quote_qty | body | string | false | Order quote quantity; required for spot and margin market buy orders |
| » reduce_only | body | string | false | Reduce-only: true or false |
| » position_side | body | string | false | Position side: NONE, LONG, SHORTDefaults to NONE (single position mode) if not specified |
# Detailed descriptions
» symbol: Unique identifier {Exchange}_{Business}_{Base}_{Counter}
Examples:
To send a Binance spot order on ADA/USDT, use BINANCE_SPOT_ADA_USDT;
For an ADA/USDT-margined USDT perpetual futures order on OKX, use OKX_FUTURE_ADA_USDT;
For ADA/USDT margin trading on Gate, use GATE_MARGIN_ADA_USDT;
For ADA/USDT spot trading on Bybit, use BYBIT_SPOT_ADA_USDT;
For an ADA/USD futures order on Kraken, use KRAKEN_FUTURE_ADA_USD;
For an ADA/USDC futures order on Hyperliquid, use HYPERLIQUID_FUTURE_ADA_USDC;
For an ADA/USDC futures order on Deribit, use DERIBIT_FUTURE_ADA_USDC;
For an ADA/USDC futures order on Lighter, use LIGHTER_FUTURE_ADA_USDC;
Supports spot trades, USDT-margined perpetual futures, and spot margin templates. BYBIT and DERIBIT omit spot margin for now; Kraken, Hyperliquid, and Lighter omit dedicated spot/margin legs inside CrossEx.
» time_in_force: Defaults to GTC. Supported values: GTC, IOC, FOK, POC, and RPIGTC: GoodTillCancelledIOC: ImmediateOrCancelledFOK: FillOrKillPOC: PendingOrCancelled or PostOnlyRPI: Retail Price Improvement
» position_side: Position side: NONE, LONG, SHORT
Defaults to NONE (single position mode) if not specified
# Enumerated Values
| Parameter | Value |
|---|---|
| » side | BUY |
| » side | SELL |
| » type | LIMIT |
| » type | MARKET |
| » time_in_force | GTC |
| » time_in_force | IOC |
| » time_in_force | FOK |
| » time_in_force | POC |
| » time_in_force | RPI |
| » reduce_only | true |
| » reduce_only | false |
| » position_side | LONG |
| » position_side | SHORT |
| » position_side | NONE |
Example responses
200 Response
{
"order_id": "123456",
"text": "cross-test-1"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | CrossexOrderActionResponse |
Response Schema
Status Code 200
CrossexOrderActionResponse
| Name | Type | Description |
|---|---|---|
| » order_id | string | Order ID |
| » text | string | User-defined Order ID |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Batch cancel orders
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/batch_cancel_orders'
query_param = ''
body='[{"order_id":"123456"},{"text":"crossex-test-1"}]'
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('POST', prefix + url, query_param, body)
headers.update(sign_headers)
r = requests.request('POST', host + prefix + url, headers=headers, data=body)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="POST"
url="/crossex/batch_cancel_orders"
query_param=""
body_param='[{"order_id":"123456"},{"text":"crossex-test-1"}]'
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url -d "$body_param" -H "Content-Type: application/json" \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
POST /crossex/batch_cancel_orders
Batch cancel orders
Cancel multiple specified orders. Either order_id or text is required; if both are provided, order_id takes precedence. Rate limit: 100 requests per 10 seconds
Body parameter
[
{
"order_id": "123456"
},
{
"text": "crossex-test-1"
}
]
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | array[CrossexBatchCancelOrderRequest] | true | none |
Example responses
200 Response
[
{
"order_id": "123456",
"text": "",
"accepted": "true",
"label": "",
"message": ""
},
{
"order_id": "",
"text": "crossex-test-1",
"accepted": "false",
"label": "TRADE_ORDER_NOT_FOUND_ERROR",
"message": "The order was not found"
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | Batch order cancellation request results | [CrossexBatchCancelOrderResponse] |
Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
| None | array | [Batch order cancellation request results] |
| » CrossexBatchCancelOrderResponse | CrossexBatchCancelOrderResponse | Batch order cancellation request results |
| »» order_id | string | Order ID |
| »» text | string | Custom ID specified by the user when creating the order |
| »» accepted | string | Whether the request was accepted, as the string true or false |
| »» label | string | Error label when the request is not accepted; empty on success |
| »» message | string | Error message when the request is not accepted; empty on success |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Query order details
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/orders/2048522992198912'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/orders/2048522992198912"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/orders/{order_id}
Query order details
Rate Limit: 200 requests per 10 seconds
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| order_id | path | string | true | 1. Supports querying order IDs returned when creating orders 2. Supports custom IDs specified by users when creating orders (i.e., the text field) |
# Detailed descriptions
order_id: 1. Supports querying order IDs returned when creating orders
2. Supports custom IDs specified by users when creating orders (i.e., the text field)
Example responses
200 Response
{
"user_id": "10001004",
"order_id": "2048522992198912",
"text": "2048522992198912",
"state": "FILLED",
"symbol": "BINANCE_SPOT_ADA_USDT",
"side": "BUY",
"type": "MARKET",
"attribute": "COMMON",
"exchange_type": "BINANCE",
"business_type": "SPOT",
"qty": "0",
"quote_qty": "7",
"price": "0",
"time_in_force": "GTC",
"executed_qty": "12.9",
"executed_amount": "6.96471",
"executed_avg_price": "0.5399",
"fee_coin": "ADA",
"fee": "0.0129",
"reduce_only": "false",
"leverage": "1",
"reason": "",
"last_executed_qty": "12.9",
"last_executed_price": "0.5399",
"last_executed_amount": "6.96471",
"position_side": "NONE",
"create_time": "1750681141933",
"update_time": "1750681142379"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | CrossexOrder |
Response Schema
Status Code 200
CrossexOrder
| Name | Type | Description |
|---|---|---|
| » user_id | string | User ID |
| » order_id | string | Order ID |
| » text | string | Client-defined order ID. |
| » state | string | Order status:NEW: validated locally, pending submission to the exchangeOPEN: resting on the exchange order bookPARTIALLY_FILLED: partially filledFILLED: fully filledFAIL: CrossEx validation failed; see reasonREJECT: rejected by the exchange; see reasonCANCELLED: cancelled |
| » symbol | string | Unique trading pair identifiers, e.g.BINANCE_SPOT_BTC_USDT, BINANCE_FUTURE_BTC_USDT. |
| » side | string | Side (BUY buy / SELL sell). |
| » type | string | Order type (LIMIT limit / MARKET market). |
| » attribute | string | Order attributes (COMMON normal / LIQ liquidation takeover / REDUCE liquidation reduction / ADL auto-deleverage / SETTLEMENT delisting settlement). |
| » exchange_type | string | Venue bucket (BINANCE / OKX / GATE / BYBIT / KRAKEN / HYPERLIQUID / DERIBIT / LIGHTER). |
| » business_type | string | Business type (SPOT Spot / FUTURE Futures / MARGIN Margin / CONVERT Flash Swap). |
| » qty | string | Order quantity in the base currency. |
| » quote_qty | string | Order quantity in the quote currency. |
| » price | string | Order price. |
| » time_in_force | string | Time-in-force policy (default: GTC; allowed values: GTC, IOC, FOK, POC, and RPI) |
| » executed_qty | string | Filled base amount. |
| » executed_amount | string | Filled quote amount. |
| » executed_avg_price | string | Average Filled Price |
| » fee_coin | string | Fee currency |
| » fee | string | Fee amount. |
| » reduce_only | string | Reduce-only order ("true" or "false"). |
| » leverage | string | Order leverage multiplier. |
| » reason | string | Failure reason description. |
| » last_executed_qty | string | Base quantity of the latest fill. |
| » last_executed_price | string | Price of the latest fill. |
| » last_executed_amount | string | Quote amount of the latest fill. |
| » position_side | string | Position side (NONE one-way position / LONG long / SHORT short) |
| » create_time | string | Created time |
| » update_time | string | Update time |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Modify Order
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/orders/string'
query_param = ''
body='{"qty":"20","price":"0.65"}'
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('PUT', prefix + url, query_param, body)
headers.update(sign_headers)
r = requests.request('PUT', host + prefix + url, headers=headers, data=body)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="PUT"
url="/crossex/orders/string"
query_param=""
body_param='{"qty":"20","price":"0.65"}'
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url -d "$body_param" -H "Content-Type: application/json" \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
PUT /crossex/orders/{order_id}
Modify Order
Rate Limit: 100 requests per 10 seconds
Body parameter
{
"qty": "20",
"price": "0.65"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| order_id | path | string | true | Support Order ID or Text for Modify Order |
| body | body | CrossexOrderUpdateRequest | false | none |
| » qty | body | string | false | modify amount |
| » price | body | string | false | modify price |
Example responses
200 Response
{
"order_id": "123",
"text": "crossex-test-1"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | CrossexOrderActionResponse |
Response Schema
Status Code 200
CrossexOrderActionResponse
| Name | Type | Description |
|---|---|---|
| » order_id | string | Order ID |
| » text | string | User-defined Order ID |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Cancel Order
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/orders/string'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('DELETE', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('DELETE', host + prefix + url, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="DELETE"
url="/crossex/orders/string"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
DELETE /crossex/orders/{order_id}
Cancel Order
Rate Limit: 100 requests per 10 seconds
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| order_id | path | string | true | Support Order ID or Text for Cancel Order |
Example responses
200 Response
{
"order_id": "123456",
"text": "crossex-test-1"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | CrossexOrderActionResponse |
Response Schema
Status Code 200
CrossexOrderActionResponse
| Name | Type | Description |
|---|---|---|
| » order_id | string | Order ID |
| » text | string | User-defined Order ID |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Flash Swap Inquiry
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/convert/quote'
query_param = ''
body='{"exchange_type":"GATE","from_coin":"BTC","to_coin":"USDT","from_amount":"0.00008"}'
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('POST', prefix + url, query_param, body)
headers.update(sign_headers)
r = requests.request('POST', host + prefix + url, headers=headers, data=body)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="POST"
url="/crossex/convert/quote"
query_param=""
body_param='{"exchange_type":"GATE","from_coin":"BTC","to_coin":"USDT","from_amount":"0.00008"}'
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url -d "$body_param" -H "Content-Type: application/json" \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
POST /crossex/convert/quote
Flash Swap Inquiry
Rate limit: 100 requests per day
For HYPERLIQUID, swaps between HYPERLIQUID_USDC and CROSSEX_USDT are supported. Flash Swap in isolated exchange mode is not currently supported for HYPERLIQUID.
For LIGHTER, swaps between LIGHTER_USDC and CROSSEX_USDT are supported. Flash Swap in isolated exchange mode is not currently supported for LIGHTER.
For KRAKEN, only conversion from KRAKEN_USD to CROSSEX_USDT is supported. Flash Swap in isolated exchange mode is not currently supported for KRAKEN.
Body parameter
{
"exchange_type": "GATE",
"from_coin": "BTC",
"to_coin": "USDT",
"from_amount": "0.00008"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | CrossexConvertQuoteRequest | false | none |
| » exchange_type | body | string | true | Exchange type Currently supports only BINANCE, OKX, GATE, BYBIT, HYPERLIQUID, KRAKEN, and LIGHTER |
| » from_coin | body | string | true | Asset Sold |
| » to_coin | body | string | true | Asset to receive OKX and GATE only support conversion to BTC, ETH, or USDT BYBIT and BINANCE only support conversion to USDT HYPERLIQUID only supports conversion to USDT or USDC KRAKEN only supports conversion to USDT LIGHTER only supports swaps between USDT and USDC |
| » from_amount | body | string | true | Amount to sell |
# Detailed descriptions
» exchange_type: Exchange type
Currently supports only BINANCE, OKX, GATE, BYBIT, HYPERLIQUID, KRAKEN, and LIGHTER
» to_coin: Asset to receive
OKX and GATE only support conversion to BTC, ETH, or USDT
BYBIT and BINANCE only support conversion to USDT
HYPERLIQUID only supports conversion to USDT or USDC
KRAKEN only supports conversion to USDT
LIGHTER only supports swaps between USDT and USDC
Example responses
200 Response
{
"quote_id": "2074460878500352",
"valid_ms": "5000",
"from_coin": "USDT",
"to_coin": "BTC",
"from_amount": "3",
"to_amount": "0.000027",
"price": "0.000009"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | CrossexConvertQuoteResponse |
Response Schema
Status Code 200
CrossexConvertQuoteResponse
| Name | Type | Description |
|---|---|---|
| » quote_id | string | Quote ID |
| » valid_ms | string | Valid time (milliseconds timestamp) |
| » from_coin | string | Asset Sold |
| » to_coin | string | Asset Bought |
| » from_amount | string | Amount to sell |
| » to_amount | string | Amount to buy |
| » price | string | Quoted price |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Flash Swap Transaction
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/convert/orders'
query_param = ''
body='{"quote_id":"232321331"}'
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('POST', prefix + url, query_param, body)
headers.update(sign_headers)
r = requests.request('POST', host + prefix + url, headers=headers, data=body)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="POST"
url="/crossex/convert/orders"
query_param=""
body_param='{"quote_id":"232321331"}'
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url -d "$body_param" -H "Content-Type: application/json" \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
POST /crossex/convert/orders
Flash Swap Transaction
Rate limit: 10 requests per 10 seconds
Body parameter
{
"quote_id": "232321331"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | CrossexConvertOrderRequest | false | none |
| » quote_id | body | string | true | Inquiry ID |
Example responses
200 Response
{
"order_id": "123456",
"text": "123456"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | CrossexConvertOrderResponse |
Response Schema
Status Code 200
CrossexConvertOrderResponse
| Name | Type | Description |
|---|---|---|
| » order_id | string | Order ID |
| » text | string | Order ID (cannot be customized) |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Query Account Assets
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/accounts'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/accounts"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/accounts
Query Account Assets
Rate limit: 200 requests per 10 seconds If 100% <= initial_margin_rate < 110%, transferring out the margin currency is prohibited. If initial_margin_rate < 100%, the system automatically cancels orders; only closing positions is allowed, not opening new ones. If maintenance_margin_rate <= 100%, the system forces liquidation.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| exchange_type | query | string | false | Trading venue identifier. Omit in cross-exchange mode; required in isolated-per-venue mode (BINANCE / OKX / GATE / BYBIT / KRAKEN / HYPERLIQUID / DERIBIT / LIGHTER). |
Example responses
200 Response
{
"user_id": "123456789",
"available_margin": "1200",
"margin_balance": "1200",
"initial_margin": "500",
"maintenance_margin": "250",
"initial_margin_rate": "2.4",
"maintenance_margin_rate": "4.8",
"position_mode": "SINGLE",
"account_limit": "5000",
"create_time": "1687573845000",
"update_time": "1687588938000",
"account_mode": "CROSS_EXCHANGE",
"exchange_type": "CROSSEX",
"assets": [
{
"user_id": "123456789",
"coin": "USDT",
"exchange_type": "BINANCE",
"balance": "1000",
"upnl": "200",
"equity": "1200",
"futures_initial_margin": "400",
"futures_maintenance_margin": "130",
"borrowing_initial_margin": "100",
"borrowing_maintenance_margin": "120",
"available_balance": "1000.0",
"liability": "0"
}
]
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | CrossexAccount |
Response Schema
Status Code 200
CrossexAccount
| Name | Type | Description |
|---|---|---|
| » user_id | string | User ID |
| » available_margin | string | Available Margin |
| » margin_balance | string | marginbalance |
| » initial_margin | string | Initial Margin |
| » maintenance_margin | string | Maintenance margin |
| » initial_margin_rate | string | Initial margin rate |
| » maintenance_margin_rate | string | Maintenance margin rate |
| » position_mode | string | Contract Position Mode |
| » account_limit | string | Account limit |
| » create_time | string | Created time |
| » update_time | string | Update time |
| » account_mode | string | Account Mode. CROSS_EXCHANGE: Cross-Exchange Mode; ISOLATED_EXCHANGE: Split-Exchange Mode |
| » exchange_type | string | Exchange Type. When account_mode is CROSS_EXCHANGE, it must be CROSSEX; otherwise, it is another exchange. |
| » assets | array | Asset list: grouped by exchange and currency, returning per-account balances, margin, and PnL details |
| »» CrossexAccountAsset | object | none |
| »»» user_id | string | User ID |
| »»» coin | string | Currency |
| »»» exchange_type | string | Exchange |
| »»» balance | string | Balance |
| »»» upnl | string | Unrealized P&L |
| »»» equity | string | Net margin equity for the currency |
| »»» futures_initial_margin | string | Currency-specific futures initial margin. This value is populated for futures settlement currencies (USDT/USDC/USD) |
| »»» futures_maintenance_margin | string | Currency-specific futures maintenance margin. This value is populated for futures settlement currencies (USDT/USDC/USD) |
| »»» borrowing_initial_margin | string | Currency-specific margin trading initial margin. This value is populated for margin or futures settlement currencies (USDT/USDC/USD) |
| »»» borrowing_maintenance_margin | string | Currency-specific margin trading maintenance margin. This value is populated for margin or futures settlement currencies (USDT/USDC/USD) |
| »»» available_balance | string | Available Balance |
| »»» liability | string | Liability for the currency. This value is populated only for USDT, USDC, or USD |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Modify Account Contract Position Mode and Account Mode
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/accounts'
query_param = ''
body='{"position_mode":"SINGLE"}'
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('PUT', prefix + url, query_param, body)
headers.update(sign_headers)
r = requests.request('PUT', host + prefix + url, headers=headers, data=body)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="PUT"
url="/crossex/accounts"
query_param=""
body_param='{"position_mode":"SINGLE"}'
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url -d "$body_param" -H "Content-Type: application/json" \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
PUT /crossex/accounts
Modify Account Contract Position Mode and Account Mode
Rate Limit: 100 requests per 60 seconds. position_mode+exchange_type modifies contract position mode (exchange_type is required when the user's account mode is split exchange); account_mode modifies the user's account mode.
Body parameter
{
"position_mode": "SINGLE"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | CrossexAccountUpdateRequest | false | none |
| » position_mode | body | string | false | Futures position mode (SINGLE/DUAL) |
| » account_mode | body | string | false | Account mode (CROSS_EXCHANGE/ISOLATED_EXCHANGE, default: CROSS_EXCHANGE) |
| » exchange_type | body | string | false | Exchange (BINANCE / OKX / GATE / BYBIT / KRAKEN / HYPERLIQUID / DERIBIT / LIGHTER / CROSSEX). When account mode is ISOLATED_EXCHANGE, the exchange must be specified to adjust futures position mode. |
Example responses
202 Response
{
"position_mode": "SINGLE"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 202 | Accepted (opens new window) | none | CrossexAccountUpdateResponse |
Response Schema
Status Code 202
CrossexAccountUpdateResponse
| Name | Type | Description |
|---|---|---|
| » position_mode | string | Requested futures position mode to modify (SINGLE/DUAL) |
| » account_mode | string | Requested account mode to modify (CROSS_EXCHANGE/ISOLATED_EXCHANGE, default: CROSS_EXCHANGE) |
| » exchange_type | string | Exchange targeted by the requested change (BINANCE / OKX / GATE / BYBIT / KRAKEN / HYPERLIQUID / DERIBIT / LIGHTER / CROSSEX). When account mode is ISOLATED_EXCHANGE, the exchange must be specified to change futures position mode. |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Query Contract Trading Pair Leverage Multiplier
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/positions/leverage'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/positions/leverage"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/positions/leverage
Query Contract Trading Pair Leverage Multiplier
Rate Limit: 200 requests per 10 seconds
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| symbols | query | string | false | Trading Pair List, multiple separated by commas |
Example responses
200 Response
{
"BINANCE_FUTURE_BTC_USDT": "3",
"OKX_FUTURE_BTC_USDT": "3",
"GATE_FUTURE_BTC_USDT": "3"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | Inline |
Response Schema
Status Code 200
Mapping from trading pair to leverage multiplier.
| Name | Type | Description |
|---|---|---|
| » additionalProperties | string | Leverage multiplier for the corresponding trading pair |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Modify Contract Trading Pair Leverage Multiplier
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/positions/leverage'
query_param = ''
body='{"symbol":"OKX_FUTURE_ADA_USDT","leverage":"1"}'
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('POST', prefix + url, query_param, body)
headers.update(sign_headers)
r = requests.request('POST', host + prefix + url, headers=headers, data=body)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="POST"
url="/crossex/positions/leverage"
query_param=""
body_param='{"symbol":"OKX_FUTURE_ADA_USDT","leverage":"1"}'
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url -d "$body_param" -H "Content-Type: application/json" \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
POST /crossex/positions/leverage
Modify Contract Trading Pair Leverage Multiplier
Rate Limit: 100 requests per 10 seconds
Body parameter
{
"symbol": "OKX_FUTURE_ADA_USDT",
"leverage": "1"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | CrossexLeverageRequest | false | none |
| » symbol | body | string | true | Currency pair |
| » leverage | body | string | true | Leverage |
Example responses
202 Response
{
"symbol": "OKX_FUTURE_ADA_USDT",
"leverage": "1"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 202 | Accepted (opens new window) | none | CrossexLeverageResponse |
Response Schema
Status Code 202
CrossexLeverageResponse
| Name | Type | Description |
|---|---|---|
| » symbol | string | Currency pair |
| » leverage | string | Requested Modified Leverage |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Query Leveraged Trading Pair Leverage Multiplier
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/margin_positions/leverage'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/margin_positions/leverage"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/margin_positions/leverage
Query Leveraged Trading Pair Leverage Multiplier
Rate Limit: 200 requests per 10 seconds
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| symbols | query | string | false | Trading Pair List, multiple separated by commas |
Example responses
200 Response
{
"BINANCE_MARGIN_BTC_USDT": "3",
"OKX_MARGIN_BTC_USDT": "3",
"GATE_MARGIN_BTC_USDT": "3"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | Inline |
Response Schema
Status Code 200
Mapping from trading pair to leverage multiplier.
| Name | Type | Description |
|---|---|---|
| » additionalProperties | string | Leverage multiplier for the corresponding trading pair |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Modify Leveraged Trading Pair Leverage Multiplier
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/margin_positions/leverage'
query_param = ''
body='{"symbol":"OKX_MARGIN_ADA_USDT","leverage":"1"}'
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('POST', prefix + url, query_param, body)
headers.update(sign_headers)
r = requests.request('POST', host + prefix + url, headers=headers, data=body)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="POST"
url="/crossex/margin_positions/leverage"
query_param=""
body_param='{"symbol":"OKX_MARGIN_ADA_USDT","leverage":"1"}'
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url -d "$body_param" -H "Content-Type: application/json" \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
POST /crossex/margin_positions/leverage
Modify Leveraged Trading Pair Leverage Multiplier
Rate Limit: 100 requests per 10 seconds
Body parameter
{
"symbol": "OKX_MARGIN_ADA_USDT",
"leverage": "1"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | CrossexLeverageRequest | false | none |
| » symbol | body | string | true | Currency pair |
| » leverage | body | string | true | Leverage |
Example responses
202 Response
{
"symbol": "string",
"leverage": "string"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 202 | Accepted (opens new window) | none | CrossexLeverageResponse |
Response Schema
Status Code 202
CrossexLeverageResponse
| Name | Type | Description |
|---|---|---|
| » symbol | string | Currency pair |
| » leverage | string | Requested Modified Leverage |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Full Close Position
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/position'
query_param = ''
body='{"symbol":"BINANCE_FUTURE_SOL_USDT","position_side":"LONG"}'
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('POST', prefix + url, query_param, body)
headers.update(sign_headers)
r = requests.request('POST', host + prefix + url, headers=headers, data=body)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="POST"
url="/crossex/position"
query_param=""
body_param='{"symbol":"BINANCE_FUTURE_SOL_USDT","position_side":"LONG"}'
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url -d "$body_param" -H "Content-Type: application/json" \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
POST /crossex/position
Full Close Position
Rate limit: 100 requests per day. Automatic position-closing rules. FUTURE and MARGIN positions are supported.
Before using this endpoint, ensure that the following prerequisite is met:
- There are no open orders for the symbol in the current account.
- Once the prerequisite is met, the system checks whether the position meets either of the following conditions:
- Less than the minimum notional amount (minNotional)
- Less than the minimum order size (minSize)
When either condition is met, the system automatically creates a closing order and immediately closes the entire position. This endpoint prevents positions that are too small to be submitted to an exchange from becoming stranded and ensures that small positions can be closed when they fall below the threshold.
Body parameter
{
"symbol": "BINANCE_FUTURE_SOL_USDT",
"position_side": "LONG"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | CrossexClosePositionRequest | false | none |
| » symbol | body | string | true | Trading Pair 1. Supports leveraged trading pairs, e.g., BINANCE_MARGIN_SOL_USDT 2. Supports contract trading pairs, e.g., OKX_FUTURE_ETH_USDT |
| » position_side | body | string | false | Position Direction 1. For leveraged positions, this parameter must be passed 2. For contract positions, pass selectively based on your contract holding method |
# Detailed descriptions
» symbol: Trading Pair
1. Supports leveraged trading pairs, e.g., BINANCE_MARGIN_SOL_USDT
2. Supports contract trading pairs, e.g., OKX_FUTURE_ETH_USDT
» position_side: Position Direction
1. For leveraged positions, this parameter must be passed
2. For contract positions, pass selectively based on your contract holding method
Example responses
202 Response
{
"order_id": "123456",
"text": "123456"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 202 | Accepted (opens new window) | none | CrossexOrderActionResponse |
Response Schema
Status Code 202
CrossexOrderActionResponse
| Name | Type | Description |
|---|---|---|
| » order_id | string | Order ID |
| » text | string | User-defined Order ID |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Get futures position margin mode
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/positions/margin_mode'
query_param = 'symbol=HYPERLIQUID_FUTURE_CXMT_USDC'
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url + "?" + query_param, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/positions/margin_mode"
query_param="symbol=HYPERLIQUID_FUTURE_CXMT_USDC"
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url?$query_param"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/positions/margin_mode
Get futures position margin mode
Rate Limit: 200 requests per 10 seconds
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| symbol | query | string | true | Futures trading pair |
Example responses
200 Response
{
"symbol": "HYPERLIQUID_FUTURE_CXMT_USDC",
"margin_mode": "ISOLATED"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | CrossexMarginModeResponse |
Response Schema
Status Code 200
CrossexMarginModeResponse
| Name | Type | Description |
|---|---|---|
| » symbol | string | Futures trading pair |
| » margin_mode | string | Margin mode (CROSS/ISOLATED) |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Update futures position margin mode
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/positions/margin_mode'
query_param = ''
body='{"symbol":"HYPERLIQUID_FUTURE_CXMT_USDC","margin_mode":"ISOLATED"}'
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('POST', prefix + url, query_param, body)
headers.update(sign_headers)
r = requests.request('POST', host + prefix + url, headers=headers, data=body)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="POST"
url="/crossex/positions/margin_mode"
query_param=""
body_param='{"symbol":"HYPERLIQUID_FUTURE_CXMT_USDC","margin_mode":"ISOLATED"}'
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url -d "$body_param" -H "Content-Type: application/json" \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
POST /crossex/positions/margin_mode
Update futures position margin mode
Rate limit: 100 requests per 10 seconds. Only Hyperliquid futures trading pairs are supported. The margin mode cannot be changed while open orders or positions exist
Body parameter
{
"symbol": "HYPERLIQUID_FUTURE_CXMT_USDC",
"margin_mode": "ISOLATED"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | CrossexMarginModeRequest | false | none |
| » symbol | body | string | true | Hyperliquid futures trading pair |
| » margin_mode | body | string | true | Margin mode (CROSS/ISOLATED) |
# Enumerated Values
| Parameter | Value |
|---|---|
| » margin_mode | CROSS |
| » margin_mode | ISOLATED |
Example responses
202 Response
{
"symbol": "HYPERLIQUID_FUTURE_CXMT_USDC",
"margin_mode": "ISOLATED"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 202 | Accepted (opens new window) | none | CrossexMarginModeResponse |
Response Schema
Status Code 202
CrossexMarginModeResponse
| Name | Type | Description |
|---|---|---|
| » symbol | string | Futures trading pair |
| » margin_mode | string | Margin mode (CROSS/ISOLATED) |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Increase or decrease isolated margin
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/positions/margin'
query_param = ''
body='{"symbol":"HYPERLIQUID_FUTURE_CXMT_USDC","margin":"-30","position_side":"NONE"}'
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('POST', prefix + url, query_param, body)
headers.update(sign_headers)
r = requests.request('POST', host + prefix + url, headers=headers, data=body)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="POST"
url="/crossex/positions/margin"
query_param=""
body_param='{"symbol":"HYPERLIQUID_FUTURE_CXMT_USDC","margin":"-30","position_side":"NONE"}'
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url -d "$body_param" -H "Content-Type: application/json" \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
POST /crossex/positions/margin
Increase or decrease isolated margin
Rate limit: 100 requests per 10 seconds. Only Hyperliquid isolated futures positions are supported. Positive values increase margin, while negative values decrease margin
Body parameter
{
"symbol": "HYPERLIQUID_FUTURE_CXMT_USDC",
"margin": "-30",
"position_side": "NONE"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | CrossexIsolatedMarginRequest | false | none |
| » symbol | body | string | true | Hyperliquid futures trading pair |
| » margin | body | string | true | Margin adjustment amount. Positive values increase margin, while negative values decrease margin. Values with more than two decimal places are truncated to two decimal places |
| » position_side | body | string | false | Position side (NONE/LONG/SHORT). Defaults to NONE for one-way positions if omitted |
# Enumerated Values
| Parameter | Value |
|---|---|
| » position_side | NONE |
| » position_side | LONG |
| » position_side | SHORT |
Example responses
202 Response
{
"symbol": "HYPERLIQUID_FUTURE_CXMT_USDC",
"margin": "-30",
"position_side": "NONE"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 202 | Accepted (opens new window) | none | CrossexIsolatedMarginResponse |
Response Schema
Status Code 202
CrossexIsolatedMarginResponse
| Name | Type | Description |
|---|---|---|
| » symbol | string | Futures trading pair |
| » margin | string | Amount of isolated margin increased or decreased in this request |
| » position_side | string | Position side (NONE/LONG/SHORT). Defaults to NONE for one-way positions if omitted |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Query margin asset interest rates
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/interest_rate'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/interest_rate"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/interest_rate
Query margin asset interest rates
Rate Limit: 200 requests per 10 seconds
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| coin | query | string | false | Query by specified currency name |
| exchange_type | query | string | false | Exchange |
Example responses
200 Response
[
{
"coin": "BCH",
"exchange_type": "GATE",
"hour_interest_rate": "0.00000485",
"time": "1763971200000"
},
{
"coin": "ADA",
"exchange_type": "BINANCE",
"hour_interest_rate": "0.0000036558334",
"time": "1763971200000"
},
{
"coin": "BCH",
"exchange_type": "OKX",
"hour_interest_rate": "0.00000115",
"time": "1763971200000"
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | [Inline] |
Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
| » CrossexInterestRate | object | none |
| »» coin | string | Currency |
| »» exchange_type | string | Exchange |
| »» hour_interest_rate | string | Hourly Interest Rate |
| »» time | string | Millisecond Timestamp |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Query User Fee Rates
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/fee'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/fee"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/fee
Query User Fee Rates
Rate Limit: 200 requests per 10 seconds
Example responses
200 Response
[
{
"exchange_type": "BINANCE",
"spot_maker_fee": "0.0001",
"spot_taker_fee": "0.00025",
"spot_rpi_maker_fee": "",
"future_maker_fee": "0.00006",
"future_taker_fee": "0.00022",
"future_rpi_maker_fee": "",
"special_fee_list": []
},
{
"exchange_type": "OKX",
"spot_maker_fee": "0.0001",
"spot_taker_fee": "0.00025",
"spot_rpi_maker_fee": "",
"future_maker_fee": "0.00006",
"future_taker_fee": "0.00022",
"future_rpi_maker_fee": "",
"special_fee_list": [
{
"symbol": "OKX_SPOT_FLOW_USDT",
"taker_fee_rate": "0.0004",
"maker_fee_rate": "0.0001"
}
]
},
{
"exchange_type": "GATE",
"spot_maker_fee": "0.0001",
"spot_taker_fee": "0.00025",
"spot_rpi_maker_fee": "",
"future_maker_fee": "0.00006",
"future_taker_fee": "0.00022",
"future_rpi_maker_fee": "",
"special_fee_list": []
},
{
"exchange_type": "BYBIT",
"spot_maker_fee": "0.0001",
"spot_taker_fee": "0.00025",
"spot_rpi_maker_fee": "",
"future_maker_fee": "0.00006",
"future_taker_fee": "0.00022",
"future_rpi_maker_fee": "",
"special_fee_list": [
{
"symbol": "BYBIT_FUTURE_BLAST_USDT",
"taker_fee_rate": "0.00029",
"maker_fee_rate": "0.00006"
}
]
},
{
"exchange_type": "KRAKEN",
"spot_maker_fee": "0.0001",
"spot_taker_fee": "0.00025",
"spot_rpi_maker_fee": "",
"future_maker_fee": "0.00006",
"future_taker_fee": "0.00022",
"future_rpi_maker_fee": ""
},
{
"exchange_type": "HYPERLIQUID",
"spot_maker_fee": "0.0001",
"spot_taker_fee": "0.00025",
"spot_rpi_maker_fee": "",
"future_maker_fee": "0.00006",
"future_taker_fee": "0.00022",
"future_rpi_maker_fee": ""
},
{
"exchange_type": "DERIBIT",
"spot_maker_fee": "0.0001",
"spot_taker_fee": "0.00025",
"spot_rpi_maker_fee": "",
"future_maker_fee": "0.00006",
"future_taker_fee": "0.00022",
"future_rpi_maker_fee": ""
},
{
"exchange_type": "LIGHTER",
"spot_maker_fee": "0.0005",
"spot_taker_fee": "0.0005",
"spot_rpi_maker_fee": "",
"future_maker_fee": "0.00005",
"future_taker_fee": "0.00005",
"future_rpi_maker_fee": ""
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | [Inline] |
Response Schema
Status Code 200
CrossexFee
| Name | Type | Description |
|---|---|---|
| CrossexFee | array | none |
| » exchange_type | string | Exchange |
| » spot_maker_fee | string | spotMakerfee rate |
| » spot_taker_fee | string | spotTakerfee rate |
| » spot_rpi_maker_fee | string | Spot RPI order maker fee rate |
| » future_maker_fee | string | contractMakerfee rate |
| » future_taker_fee | string | contractTakerfee rate |
| » future_rpi_maker_fee | string | Futures RPI order maker fee rate |
| » special_fee_list | array | none |
| »» CrossexSpecialFee | object | none |
| »»» symbol | string | Currency pair |
| »»» taker_fee_rate | string | Taker fee rate |
| »»» maker_fee_rate | string | Maker fee rate |
| »»» rpi_fee_rate | string | RPI order maker fee rate |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Query Contract Positions
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/positions'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/positions"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/positions
Query Contract Positions
Rate Limit: 200 requests per 10 seconds
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| symbol | query | string | false | Trading Pair |
| exchange_type | query | string | false | Exchange |
Example responses
200 Response
[
{
"user_id": "10001004",
"position_id": "20062926505289216",
"symbol": "OKX_FUTURE_ADA_USDT",
"position_side": "LONG",
"initial_margin": "5.79934625",
"isolated_margin": "0",
"margin_mode": "CROSS",
"maintenance_margin": "0.06229625",
"position_qty": "10",
"position_value": "5.795",
"upnl": "0.369",
"upnl_rate": "0.068005897530409141",
"entry_price": "0.5426",
"liq_price": "0",
"mark_price": "0.5795",
"leverage": "1",
"max_leverage": "18",
"risk_limit": "1",
"fee": "0.002713",
"funding_fee": "0",
"funding_time": "0",
"create_time": "1750682334273",
"update_time": "1750730699867",
"closed_pnl": "12"
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | [Inline] |
Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
| » CrossexPosition | object | none |
| »» user_id | string | User ID |
| »» position_id | string | Position ID |
| »» symbol | string | Currency pair |
| »» position_side | string | Position Direction |
| »» initial_margin | string | Initial Margin |
| »» isolated_margin | string | Isolated margin. It is 0 in cross margin mode and applies only to isolated margin positions |
| »» margin_mode | string | Margin mode (CROSS/ISOLATED) |
| »» maintenance_margin | string | Maintenance margin |
| »» position_qty | string | Position Quantity |
| »» position_value | string | Position Value |
| »» upnl | string | Unrealized P&L |
| »» upnl_rate | string | Unrealized P&L Ratio |
| »» entry_price | string | Position Average Entry Price |
| »» liq_price | string | Liquidation price. It is 0 in cross margin mode and applies only to isolated margin positions; 0 in isolated margin mode means the position will not be liquidated |
| »» mark_price | string | Mark price |
| »» leverage | string | Position Leverage |
| »» max_leverage | string | Maximum leverage |
| »» risk_limit | string | Position risk limit |
| »» fee | string | Position Fee |
| »» funding_fee | string | Accumulated position funding fee. A positive value indicates a gain, while a negative value indicates a loss. |
| »» funding_time | string | Position funding fee collection time (0 indicates it has not been collected yet) |
| »» create_time | string | Position Creation Time |
| »» update_time | string | Position Update Time |
| »» closed_pnl | string | Realized PnL |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Query Leveraged Positions
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/margin_positions'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/margin_positions"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/margin_positions
Query Leveraged Positions
Rate Limit: 200 requests per 10 seconds
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| symbol | query | string | false | Currency pair |
| exchange_type | query | string | false | Exchange |
Example responses
200 Response
[
{
"user_id": "12345",
"position_id": "20126312530221056",
"symbol": "BINANCE_MARGIN_ADA_USDT",
"position_side": "LONG",
"initial_margin": "0",
"maintenance_margin": "0",
"asset_qty": "0",
"asset_coin": "ADA",
"position_value": "0",
"liability": "0.0001708920658",
"liability_coin": "USDT",
"interest": "0.0001708920658",
"max_position_qty": "0",
"entry_price": "0",
"index_price": "0.35466844",
"upnl": "-0.0001708920658",
"upnl_rate": "-3",
"leverage": "3",
"max_leverage": "5",
"create_time": "1765794740152",
"update_time": "1766716075010"
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | [Inline] |
Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
| » CrossexMarginPosition | object | none |
| »» user_id | string | User ID |
| »» position_id | string | Leveraged Position ID |
| »» symbol | string | Trading Pair |
| »» position_side | string | Position Direction |
| »» initial_margin | string | Initial position margin |
| »» maintenance_margin | string | Position maintenance margin |
| »» asset_qty | string | Position Asset Quantity |
| »» asset_coin | string | Position Asset Currency |
| »» position_value | string | Position Value |
| »» liability | string | Debt Quantity |
| »» liability_coin | string | Debt Currency |
| »» interest | string | Deducted Interest |
| »» max_position_qty | string | Max Trade Size |
| »» entry_price | string | Position Cost Price (Average Opening Price) |
| »» index_price | string | Index price |
| »» upnl | string | Unrealized P&L |
| »» upnl_rate | string | Unrealized P&L Ratio |
| »» leverage | string | Opening Leverage |
| »» max_leverage | string | Maximum leverage |
| »» create_time | string | Created time |
| »» update_time | string | Update time |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Query ADL Position Reduction Ranking
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/adl_rank'
query_param = 'symbol=BINANCE_FUTURE_ADA_USDT'
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url + "?" + query_param, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/adl_rank"
query_param="symbol=BINANCE_FUTURE_ADA_USDT"
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url?$query_param"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/adl_rank
Query ADL Position Reduction Ranking
Rate Limit: 200 requests per 10 seconds
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| symbol | query | string | true | Trading Pair |
Example responses
200 Response
[
{
"user_id": "111",
"symbol": "BINANCE_FUTURE_ADA_USDT",
"crossex_adl_rank": "1",
"exchange_adl_rank": "1"
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | Inline |
Response Schema
Status Code 200
CrossexAdlRank
| Name | Type | Description |
|---|---|---|
| » user_id | string | User ID |
| » symbol | string | Currency pair |
| » crossex_adl_rank | string | CrossEx ADL priority, with values from 1 to 5 Priority from highest to lowest: 5, 4, 3, 2, 1 |
| » exchange_adl_rank | string | Raw exchange ADL rank. Priority order from highest to lowest by exchange: - BINANCE: 4, 3, 2, 1, 0 - OKX: 5, 4, 3, 2, 1, 0 - GATE: 1, 2, 3, 4, 5 - Kraken: 20, 40, 60, 80, 100 - BYBIT: 5, 4, 3, 2, 1, 0 |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Query All Current Open Orders
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/open_orders'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/open_orders"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/open_orders
Query All Current Open Orders
Rate Limit: 200 requests per 10 seconds
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| symbol | query | string | false | Trading Pair |
| exchange_type | query | string | false | Exchange |
| business_type | query | string | false | Business Type |
Example responses
200 Response
[
{
"user_id": "10001004",
"order_id": "2048529119934720",
"client_order_id": "2048529119934720",
"state": "PARTIALLY_FILLED",
"symbol": "OKX_SPOT_ADA_USDT",
"side": "BUY",
"type": "MARKET",
"attribute": "COMMON",
"exchange_type": "OKX",
"business_type": "SPOT",
"qty": "6",
"quote_qty": "6",
"price": "0",
"time_in_force": "GTC",
"executed_qty": "11.0354",
"executed_amount": "5.99994698",
"executed_avg_price": "0.5437",
"fee_coin": "ADA",
"fee": "0.0110354",
"reduce_only": "false",
"leverage": "1",
"reason": "",
"last_executed_qty": "11.0354",
"last_executed_price": "0.5437",
"last_executed_amount": "5.99994698",
"position_side": "NONE",
"create_time": "1750682602377",
"update_time": "1750682602413"
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | [CrossexOrder] |
Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
| None | array | none |
| » CrossexOrder | CrossexOrder | none |
| »» user_id | string | User ID |
| »» order_id | string | Order ID |
| »» text | string | Client-defined order ID. |
| »» state | string | Order status:NEW: validated locally, pending submission to the exchangeOPEN: resting on the exchange order bookPARTIALLY_FILLED: partially filledFILLED: fully filledFAIL: CrossEx validation failed; see reasonREJECT: rejected by the exchange; see reasonCANCELLED: cancelled |
| »» symbol | string | Unique trading pair identifiers, e.g.BINANCE_SPOT_BTC_USDT, BINANCE_FUTURE_BTC_USDT. |
| »» side | string | Side (BUY buy / SELL sell). |
| »» type | string | Order type (LIMIT limit / MARKET market). |
| »» attribute | string | Order attributes (COMMON normal / LIQ liquidation takeover / REDUCE liquidation reduction / ADL auto-deleverage / SETTLEMENT delisting settlement). |
| »» exchange_type | string | Venue bucket (BINANCE / OKX / GATE / BYBIT / KRAKEN / HYPERLIQUID / DERIBIT / LIGHTER). |
| »» business_type | string | Business type (SPOT Spot / FUTURE Futures / MARGIN Margin / CONVERT Flash Swap). |
| »» qty | string | Order quantity in the base currency. |
| »» quote_qty | string | Order quantity in the quote currency. |
| »» price | string | Order price. |
| »» time_in_force | string | Time-in-force policy (default: GTC; allowed values: GTC, IOC, FOK, POC, and RPI) |
| »» executed_qty | string | Filled base amount. |
| »» executed_amount | string | Filled quote amount. |
| »» executed_avg_price | string | Average Filled Price |
| »» fee_coin | string | Fee currency |
| »» fee | string | Fee amount. |
| »» reduce_only | string | Reduce-only order ("true" or "false"). |
| »» leverage | string | Order leverage multiplier. |
| »» reason | string | Failure reason description. |
| »» last_executed_qty | string | Base quantity of the latest fill. |
| »» last_executed_price | string | Price of the latest fill. |
| »» last_executed_amount | string | Quote amount of the latest fill. |
| »» position_side | string | Position side (NONE one-way position / LONG long / SHORT short) |
| »» create_time | string | Created time |
| »» update_time | string | Update time |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Query order history
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/history_orders'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/history_orders"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/history_orders
Query order history
Rate Limit: 200 requests per 10 seconds
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| page | query | integer | false | Page number |
| limit | query | integer | false | Maximum number of records returned in a single list |
| symbol | query | string | false | Currency pair |
| from | query | integer | false | Start Millisecond Timestamp |
| to | query | integer | false | End Millisecond Timestamp |
| attributes | query | string | false | Order attributes (COMMON normal / LIQ liquidation takeover / REDUCE liquidation reduction / ADL auto-deleverage / SETTLEMENT delisting settlement). Multiple values, comma-separated. |
Example responses
200 Response
[
{
"user_id": "10001004",
"order_id": "2048522992198912",
"text": "2048522992198912",
"state": "FILLED",
"symbol": "BINANCE_SPOT_ADA_USDT",
"side": "BUY",
"type": "MARKET",
"attribute": "COMMON",
"exchange_type": "BINANCE",
"business_type": "SPOT",
"qty": "0",
"quote_qty": "7",
"price": "0",
"time_in_force": "GTC",
"executed_qty": "12.9",
"executed_amount": "6.96471",
"executed_avg_price": "0.5399",
"fee_coin": "ADA",
"fee": "0.0129",
"reduce_only": "false",
"leverage": "1",
"reason": "",
"last_executed_qty": "12.9",
"last_executed_price": "0.5399",
"last_executed_amount": "6.96471",
"position_side": "NONE",
"create_time": "1750681141933",
"update_time": "1750681142379"
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | [CrossexOrder] |
Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
| None | array | none |
| » CrossexOrder | CrossexOrder | none |
| »» user_id | string | User ID |
| »» order_id | string | Order ID |
| »» text | string | Client-defined order ID. |
| »» state | string | Order status:NEW: validated locally, pending submission to the exchangeOPEN: resting on the exchange order bookPARTIALLY_FILLED: partially filledFILLED: fully filledFAIL: CrossEx validation failed; see reasonREJECT: rejected by the exchange; see reasonCANCELLED: cancelled |
| »» symbol | string | Unique trading pair identifiers, e.g.BINANCE_SPOT_BTC_USDT, BINANCE_FUTURE_BTC_USDT. |
| »» side | string | Side (BUY buy / SELL sell). |
| »» type | string | Order type (LIMIT limit / MARKET market). |
| »» attribute | string | Order attributes (COMMON normal / LIQ liquidation takeover / REDUCE liquidation reduction / ADL auto-deleverage / SETTLEMENT delisting settlement). |
| »» exchange_type | string | Venue bucket (BINANCE / OKX / GATE / BYBIT / KRAKEN / HYPERLIQUID / DERIBIT / LIGHTER). |
| »» business_type | string | Business type (SPOT Spot / FUTURE Futures / MARGIN Margin / CONVERT Flash Swap). |
| »» qty | string | Order quantity in the base currency. |
| »» quote_qty | string | Order quantity in the quote currency. |
| »» price | string | Order price. |
| »» time_in_force | string | Time-in-force policy (default: GTC; allowed values: GTC, IOC, FOK, POC, and RPI) |
| »» executed_qty | string | Filled base amount. |
| »» executed_amount | string | Filled quote amount. |
| »» executed_avg_price | string | Average Filled Price |
| »» fee_coin | string | Fee currency |
| »» fee | string | Fee amount. |
| »» reduce_only | string | Reduce-only order ("true" or "false"). |
| »» leverage | string | Order leverage multiplier. |
| »» reason | string | Failure reason description. |
| »» last_executed_qty | string | Base quantity of the latest fill. |
| »» last_executed_price | string | Price of the latest fill. |
| »» last_executed_amount | string | Quote amount of the latest fill. |
| »» position_side | string | Position side (NONE one-way position / LONG long / SHORT short) |
| »» create_time | string | Created time |
| »» update_time | string | Update time |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Query Contract Position History
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/history_positions'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/history_positions"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/history_positions
Query Contract Position History
Rate Limit: 200 requests per 10 seconds
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| page | query | integer | false | Page number |
| limit | query | integer | false | Maximum number returned by list, max 1000 |
| symbol | query | string | false | Currency pair |
| from | query | integer | false | Start Millisecond Timestamp |
| to | query | integer | false | End Millisecond Timestamp |
Example responses
200 Response
[
{
"position_id": "20064013106942976",
"user_id": "12345678",
"symbol": "BINANCE_FUTURE_ADA_USDT",
"closed_type": "COMPLETE_CLOSED",
"closed_pnl": "-0.001",
"closed_pnl_rate": "-0.001",
"open_avg_price": "0.5598",
"closed_avg_price": "0.5597",
"max_position_qty": "10",
"closed_qty": "10",
"closed_value": "5.597",
"fee": "0.0055975",
"liq_fee": "0",
"funding_fee": "0",
"position_side": "LONG",
"position_mode": "DUAL",
"leverage": "1",
"create_time": "1750941400632",
"update_time": "1750941402661",
"margin_mode": "CROSS"
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | [Inline] |
Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
| » CrossexHistoricalPosition | object | none |
| »» position_id | string | Position ID |
| »» user_id | string | User ID |
| »» symbol | string | Currency pair |
| »» closed_type | string | Position close type (PARTIAL_CLOSED: partially closed; COMPLETE_CLOSED: fully closed) |
| »» closed_pnl | string | Close Position P&L |
| »» closed_pnl_rate | string | Close Position P&L Ratio |
| »» open_avg_price | string | Average Opening Price |
| »» closed_avg_price | string | Average Close Price |
| »» max_position_qty | string | Max Trade Size |
| »» closed_qty | string | Close Position Quantity |
| »» closed_value | string | Close Position Value |
| »» fee | string | Position Accumulated Fees |
| »» liq_fee | string | Liquidation Fee |
| »» funding_fee | string | Funding Fee |
| »» position_side | string | Position Direction Before Close |
| »» position_mode | string | Position Mode at Close |
| »» leverage | string | Leverage at Close |
| »» margin_mode | string | Margin mode (CROSS/ISOLATED) |
| »» business_type | string | Business Type |
| »» create_time | string | Created time |
| »» update_time | string | Update time |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Query Leveraged Position History
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/history_margin_positions'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/history_margin_positions"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/history_margin_positions
Query Leveraged Position History
Rate Limit: 200 requests per 10 seconds
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| page | query | integer | false | Page number |
| limit | query | integer | false | Maximum number returned by list, max 1000 |
| symbol | query | string | false | Currency pair |
| from | query | integer | false | Start Millisecond Timestamp |
| to | query | integer | false | End Millisecond Timestamp |
Example responses
200 Response
[
{
"position_id": "20064013106942976",
"user_id": "12345678",
"symbol": "BINANCE_FUTURE_ADA_USDT",
"closed_type": "COMPLETE_CLOSED",
"closed_pnl": "-0.001",
"closed_pnl_rate": "-0.001",
"open_avg_price": "0.5598",
"closed_avg_price": "0.5597",
"max_position_qty": "10",
"closed_qty": "10",
"closed_value": "5.597",
"liq_fee": "0",
"position_side": "LONG",
"leverage": "1",
"interest": "0.2",
"business_type": "MARGIN",
"create_time": "1750941400632",
"update_time": "1750941402661"
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | [Inline] |
Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
| » CrossexHistoricalMarginPosition | object | none |
| »» position_id | string | Position ID |
| »» user_id | string | User ID |
| »» symbol | string | Currency pair |
| »» closed_type | string | Position close type (PARTIAL_CLOSED: partially closed; COMPLETE_CLOSED: fully closed) |
| »» closed_pnl | string | Close Position P&L |
| »» closed_pnl_rate | string | Close Position P&L Ratio |
| »» open_avg_price | string | Average Opening Price |
| »» closed_avg_price | string | Average Close Price |
| »» max_position_qty | string | Max Trade Size |
| »» closed_qty | string | Close Position Quantity |
| »» closed_value | string | Close Position Value |
| »» liq_fee | string | Liquidation Fee |
| »» position_side | string | Position Direction Before Close |
| »» leverage | string | Leverage at Close |
| »» interest | string | Accumulated position interest |
| »» business_type | string | Position Business Type |
| »» create_time | string | Created time |
| »» update_time | string | Update time |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Query Leveraged Interest Deduction History
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/history_margin_interests'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/history_margin_interests"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/history_margin_interests
Query Leveraged Interest Deduction History
Rate Limit: 200 requests per 10 seconds
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| symbol | query | string | false | Currency pair |
| from | query | integer | false | Start Millisecond Timestamp |
| to | query | integer | false | End Millisecond Timestamp |
| page | query | integer | false | Page number |
| limit | query | integer | false | Maximum number returned by list, max 1000 |
| exchange_type | query | string | false | Exchange |
Example responses
200 Response
[
{
"user_id": "2124575357",
"symbol": "OKX_MARGIN_WLD_USDT",
"interest_id": "2115944013038336",
"liability_id": "2115944013038080",
"liability": "2",
"liability_coin": "USDT",
"interest": "0.00000732",
"interest_rate": "0.00000366",
"interest_type": "IMMEDIATE_OPEN_ORDER",
"create_time": "1766755565807",
"exchange_type": "OKX"
},
{
"user_id": "2124575357",
"symbol": "OKX_MARGIN_WLD_USDT",
"interest_id": "2114666587422976",
"liability_id": "2114666587422720",
"liability": "2",
"liability_coin": "USDT",
"interest": "0.00000732",
"interest_rate": "0.00000366",
"interest_type": "IMMEDIATE_OPEN_ORDER",
"create_time": "1766451003780",
"exchange_type": "OKX"
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | [Inline] |
Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
| » CrossexMarginInterestRecord | object | none |
| »» user_id | string | User ID |
| »» symbol | string | Trading Pair |
| »» interest_id | string | Interest Deduction ID |
| »» liability_id | string | Debt Source ID, can be Order ID or Position ID |
| »» liability | string | Debt Quantity |
| »» liability_coin | string | Debt Currency |
| »» interest | string | Interest |
| »» interest_rate | string | interest rate |
| »» interest_type | string | Interest deduction typePERIODIC_POSITION: hourly interest charged on positionsPERIODIC_OPEN_ORDER: hourly interest charged on open ordersIMMEDIATE_OPEN_ORDER: interest charged when an order is placedPERIODIC_ISOLATED: hourly interest charged on liabilities |
| »» create_time | string | Created time |
| »» exchange_type | string | Exchange |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Query filled history
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/history_trades'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/history_trades"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/history_trades
Query filled history
Rate Limit: 200 requests per 10 seconds
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| page | query | integer | false | Page number |
| limit | query | integer | false | Maximum number returned by list, max 1000 |
| symbol | query | string | false | Currency pair |
| from | query | integer | false | Start Millisecond Timestamp |
| to | query | integer | false | End Millisecond Timestamp |
Example responses
200 Response
[
{
"user_id": "3511316454450547",
"transaction_id": "2049614605858560",
"order_id": "2049614605857536",
"text": "2049614605857536",
"symbol": "BINANCE_FUTURE_ADA_USDT",
"exchange_type": "BINANCE",
"business_type": "FUTURE",
"side": "SELL",
"qty": "10",
"price": "0.5597",
"fee": "0.002798500000000000",
"fee_coin": "USDT",
"fee_rate": "0.0005",
"match_role": "MAKER",
"rpnl": "-0.001",
"position_mode": "DUAL",
"position_side": "LONG",
"create_time": "1750941402661"
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | [Inline] |
Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
| » CrossexTrade | object | none |
| »» user_id | string | User ID |
| »» transaction_id | string | filledrecordsID |
| »» order_id | string | Order ID |
| »» text | string | User Order ID |
| »» symbol | string | Currency pair |
| »» exchange_type | string | Exchange |
| »» business_type | string | Business Type |
| »» side | string | Buy/Sell Direction |
| »» qty | string | Trading size |
| »» price | string | Fill Price |
| »» fee | string | fee |
| »» fee_coin | string | Fee currency |
| »» fee_rate | string | Fee Rate |
| »» match_role | string | Filled Role |
| »» rpnl | string | Realized P&L |
| »» position_mode | string | Position Mode |
| »» position_side | string | Position Direction |
| »» create_time | string | Created time |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Query Account Asset Change History
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/account_book'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/account_book"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/account_book
Query Account Asset Change History
Rate Limit: 200 requests per 10 seconds
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| page | query | integer | false | Page number |
| limit | query | integer | false | Maximum number returned by list, max 1000 |
| coin | query | string | false | Query by specified currency name |
| statement_type | query | string | false | Bill entry type. The filter accepts the same values returned in the response. |
| from | query | integer | false | Start Millisecond Timestamp |
| to | query | integer | false | End Millisecond Timestamp |
Example responses
200 Response
[
{
"id": "121",
"user_id": "12345678",
"business_id": "20818182821",
"statement_type": "FUNDING_FEE",
"exchange_type": "BINANCE",
"coin": "USDT",
"symbol": "BINANCE_FUTURE_BTC_USDT",
"change": "-0.002",
"balance": "81",
"create_time": "1750941402661"
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | [Inline] |
Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
| » CrossexAccountBookRecord | object | none |
| »» id | string | Account Change Record ID |
| »» user_id | string | User ID |
| »» business_id | string | Business ID. Its meaning varies by statement_type.TRANSACTION: order ID TRADING_FEE: order ID LIQUIDATION_FEE: liquidation order ID FUNDING_FEE: position ID and funding fee settlement time For other types, it is a system-generated processing ID with no business meaning |
| »» statement_type | string | Bill entry type. |
| »» exchange_type | string | Exchange |
| »» coin | string | Currency |
| »» symbol | string | Trading Pair |
| »» change | string | Change amount (positive values indicate an increase; negative values indicate a decrease) |
| »» balance | string | Balance after change |
| »» create_time | string | Created time |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Query Currency Discount Rate
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/coin_discount_rate'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/coin_discount_rate"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/coin_discount_rate
Query Currency Discount Rate
Rate Limit: 200 requests per 10 seconds
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| coin | query | string | false | Query by specified currency name |
| exchange_type | query | string | false | OKX/GATE/BINANCE/BYBIT/KRAKEN/HYPERLIQUID/DERIBIT/LIGHTER |
Example responses
200 Response
[
{
"coin": "SOL",
"exchange_type": "GATE",
"tier": "1",
"min_value": "0",
"max_value": "10000",
"discount_rate": "0.95"
},
{
"coin": "SOL",
"exchange_type": "GATE",
"tier": "2",
"min_value": "10000",
"max_value": "20000",
"discount_rate": "0.93"
},
{
"coin": "SOL",
"exchange_type": "GATE",
"tier": "3",
"min_value": "20000",
"max_value": "30000",
"discount_rate": "0.2"
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | [Inline] |
Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
| » CrossexCoinDiscountRate | object | none |
| »» coin | string | Currency |
| »» exchange_type | string | Exchange |
| »» tier | string | Tier |
| »» min_value | string | Minimum value |
| »» max_value | string | Maximum value |
| »» discount_rate | string | Discount rate |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Get exchange tickers
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/market/tickers'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/market/tickers"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/market/tickers
Get exchange tickers
Rate limit: 1 request per second
- Margin trading pairs cannot be passed directly as parameters. For example,
GATE_MARGIN_BTC_USDTis invalid.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| symbols | query | string | false | Trading Pair List, multiple separated by commas |
Example responses
200 Response
[
{
"symbol": "GATE_FUTURE_BTC_USDT",
"last_price": "64052.4",
"open_24h": "65144.7",
"low_24h": "64375",
"high_24h": "65734.8",
"volume_24h_base": "31705",
"volume_24h_quote": "2063128626",
"mark_price": "65148.9",
"index_price": "65174.38",
"open_interest": "65568.2144",
"open_interest_quote": "4271697043.12416",
"timestamp": "1785168000000"
},
{
"symbol": "GATE_SPOT_BTC_USDT",
"last_price": "65179.4",
"open_24h": "",
"low_24h": "65744",
"high_24h": "64410.9",
"volume_24h_base": "3480.769758",
"volume_24h_quote": "226794942.82361",
"mark_price": "",
"index_price": "",
"open_interest": "",
"open_interest_quote": "",
"timestamp": "1785168000000"
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | [Inline] |
Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
| » symbol | string | Trading Pair |
| » last_price | string | Last price |
| » open_24h | string | 24-hour opening price |
| » low_24h | string | 24h Low |
| » high_24h | string | 24h High |
| » volume_24h_base | string | 24-hour trading volume in base currency |
| » volume_24h_quote | string | 24-hour trading volume in quote currency |
| » mark_price | string | Mark price |
| » index_price | string | Index price |
| » open_interest | string | Open interest |
| » open_interest_quote | string | Open interest (in quote currency) |
| » timestamp | string | Update timestamp |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Get exchange futures funding rate information
Code samples
# coding: utf-8
import requests
import time
import hashlib
import hmac
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/crossex/market/funding_info'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())
key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/crossex/market/funding_info"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')
full_url="$host$prefix$url"
curl -X $method $full_url \
-H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"
GET /crossex/market/funding_info
Get exchange futures funding rate information
Rate limit: 1 request per second
- For
Deribit,funding_rateis the current real-time rate calculated over an 8-hour period.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| symbols | query | string | false | Trading Pair List, multiple separated by commas |
Example responses
200 Response
[
{
"symbol": "BINANCE_FUTURE_BTC_USDT",
"funding_rate": "0.00006537",
"funding_time": "1785168000000",
"funding_interval": "28800"
},
{
"symbol": "OKX_FUTURE_BTC_USDT",
"funding_rate": "0.0000543885374247",
"funding_time": "1785168000000",
"funding_interval": "28800"
},
{
"symbol": "KRAKEN_FUTURE_BTC_USD",
"funding_rate": "0.000011898754310345",
"funding_time": "1785139200000",
"funding_interval": "3600"
},
{
"symbol": "GATE_FUTURE_BTC_USDT",
"funding_rate": "0.0001",
"funding_time": "1785168000000",
"funding_interval": "28800"
},
{
"symbol": "BYBIT_FUTURE_BTC_USDT",
"funding_rate": "0.00008708",
"funding_time": "1785168000000",
"funding_interval": "28800"
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK (opens new window) | none | [Inline] |
Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
| » symbol | string | Currency |
| » funding_rate | string | Funding rate |
| » funding_interval | string | Funding interval (in seconds) |
| » funding_time | string | Next funding time (Unix timestamp in milliseconds) |
WARNING
To perform this operation, you must be authenticated by API key and secret
# Schemas
# CrossexIsolatedMarginResponse
{
"symbol": "string",
"margin": "string",
"position_side": "string"
}
CrossexIsolatedMarginResponse
# Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| symbol | string | true | none | Futures trading pair |
| margin | string | true | none | Amount of isolated margin increased or decreased in this request |
| position_side | string | false | none | Position side (NONE/LONG/SHORT). Defaults to NONE for one-way positions if omitted |
# CrossexBatchCancelOrderRequest
{}
CrossexBatchCancelOrderRequest
# Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| order_id | string | false | none | Order ID; either this field or text is required |
| text | string | false | none | Custom ID specified by the user when creating the order; either this field or order_id is required |
anyOf
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| None | object | false | none | none |
or
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| None | object | false | none | none |
# CrossexOrderRequest
{
"text": "string",
"symbol": "string",
"side": "BUY",
"type": "LIMIT",
"time_in_force": "GTC",
"qty": "string",
"price": "string",
"quote_qty": "string",
"reduce_only": "true",
"position_side": "LONG"
}
Place Order Request Body
# Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| text | string | false | none | Client-defined Order ID, supports letters (a-z), numbers (0-9), symbols (-, _) only |
| symbol | string | true | none | Unique identifier {Exchange}_{Business}_{Base}_{Counter}Examples: To send a Binance spot order on ADA/USDT, use BINANCE_SPOT_ADA_USDT;For an ADA/USDT-margined USDT perpetual futures order on OKX, use OKX_FUTURE_ADA_USDT;For ADA/USDT margin trading on Gate, use GATE_MARGIN_ADA_USDT;For ADA/USDT spot trading on Bybit, use BYBIT_SPOT_ADA_USDT;For an ADA/USD futures order on Kraken, use KRAKEN_FUTURE_ADA_USD;For an ADA/USDC futures order on Hyperliquid, use HYPERLIQUID_FUTURE_ADA_USDC;For an ADA/USDC futures order on Deribit, use DERIBIT_FUTURE_ADA_USDC;For an ADA/USDC futures order on Lighter, use LIGHTER_FUTURE_ADA_USDC;Supports spot trades, USDT-margined perpetual futures, and spot margin templates. BYBIT and DERIBIT omit spot margin for now; Kraken, Hyperliquid, and Lighter omit dedicated spot/margin legs inside CrossEx. |
| side | string | true | none | BUY, SELL |
| type | string | false | none | Order type (default: LIMIT; supported types: LIMIT, MARKET) |
| time_in_force | string | false | none | Defaults to GTC. Supported values: GTC, IOC, FOK, POC, and RPIGTC: GoodTillCancelledIOC: ImmediateOrCancelledFOK: FillOrKillPOC: PendingOrCancelled or PostOnlyRPI: Retail Price Improvement |
| qty | string | false | none | Order quantity (required unless spot or margin market buy) |
| price | string | false | none | Limit Order Price (Required for Limit Orders) |
| quote_qty | string | false | none | Order quote quantity; required for spot and margin market buy orders |
| reduce_only | string | false | none | Reduce-only: true or false |
| position_side | string | false | none | Position side: NONE, LONG, SHORTDefaults to NONE (single position mode) if not specified |
# Enumerated Values
| Property | Value |
|---|---|
| side | BUY |
| side | SELL |
| type | LIMIT |
| type | MARKET |
| time_in_force | GTC |
| time_in_force | IOC |
| time_in_force | FOK |
| time_in_force | POC |
| time_in_force | RPI |
| reduce_only | true |
| reduce_only | false |
| position_side | LONG |
| position_side | SHORT |
| position_side | NONE |
# CrossexConvertQuoteRequest
{
"exchange_type": "string",
"from_coin": "string",
"to_coin": "string",
"from_amount": "string"
}
Flash Swap Quote Request Body
# Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| exchange_type | string | true | none | Exchange type Currently supports only BINANCE, OKX, GATE, BYBIT, HYPERLIQUID, KRAKEN, and LIGHTER |
| from_coin | string | true | none | Asset Sold |
| to_coin | string | true | none | Asset to receive OKX and GATE only support conversion to BTC, ETH, or USDT BYBIT and BINANCE only support conversion to USDT HYPERLIQUID only supports conversion to USDT or USDC KRAKEN only supports conversion to USDT LIGHTER only supports swaps between USDT and USDC |
| from_amount | string | true | none | Amount to sell |
# CrossexOrder
{
"user_id": "string",
"order_id": "string",
"text": "string",
"state": "string",
"symbol": "string",
"side": "string",
"type": "string",
"attribute": "string",
"exchange_type": "string",
"business_type": "string",
"qty": "string",
"quote_qty": "string",
"price": "string",
"time_in_force": "string",
"executed_qty": "string",
"executed_amount": "string",
"executed_avg_price": "string",
"fee_coin": "string",
"fee": "string",
"reduce_only": "string",
"leverage": "string",
"reason": "string",
"last_executed_qty": "string",
"last_executed_price": "string",
"last_executed_amount": "string",
"position_side": "string",
"create_time": "string",
"update_time": "string"
}
CrossexOrder
# Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| user_id | string | true | none | User ID |
| order_id | string | true | none | Order ID |
| text | string | true | none | Client-defined order ID. |
| state | string | true | none | Order status:NEW: validated locally, pending submission to the exchangeOPEN: resting on the exchange order bookPARTIALLY_FILLED: partially filledFILLED: fully filledFAIL: CrossEx validation failed; see reasonREJECT: rejected by the exchange; see reasonCANCELLED: cancelled |
| symbol | string | true | none | Unique trading pair identifiers, e.g.BINANCE_SPOT_BTC_USDT, BINANCE_FUTURE_BTC_USDT. |
| side | string | true | none | Side (BUY buy / SELL sell). |
| type | string | true | none | Order type (LIMIT limit / MARKET market). |
| attribute | string | true | none | Order attributes (COMMON normal / LIQ liquidation takeover / REDUCE liquidation reduction / ADL auto-deleverage / SETTLEMENT delisting settlement). |
| exchange_type | string | true | none | Venue bucket (BINANCE / OKX / GATE / BYBIT / KRAKEN / HYPERLIQUID / DERIBIT / LIGHTER). |
| business_type | string | true | none | Business type (SPOT Spot / FUTURE Futures / MARGIN Margin / CONVERT Flash Swap). |
| qty | string | true | none | Order quantity in the base currency. |
| quote_qty | string | true | none | Order quantity in the quote currency. |
| price | string | true | none | Order price. |
| time_in_force | string | true | none | Time-in-force policy (default: GTC; allowed values: GTC, IOC, FOK, POC, and RPI) |
| executed_qty | string | true | none | Filled base amount. |
| executed_amount | string | true | none | Filled quote amount. |
| executed_avg_price | string | true | none | Average Filled Price |
| fee_coin | string | true | none | Fee currency |
| fee | string | true | none | Fee amount. |
| reduce_only | string | true | none | Reduce-only order ("true" or "false"). |
| leverage | string | true | none | Order leverage multiplier. |
| reason | string | true | none | Failure reason description. |
| last_executed_qty | string | true | none | Base quantity of the latest fill. |
| last_executed_price | string | true | none | Price of the latest fill. |
| last_executed_amount | string | true | none | Quote amount of the latest fill. |
| position_side | string | true | none | Position side (NONE one-way position / LONG long / SHORT short) |
| create_time | string | true | none | Created time |
| update_time | string | true | none | Update time |
# CrossexAccount
{
"user_id": "string",
"available_margin": "string",
"margin_balance": "string",
"initial_margin": "string",
"maintenance_margin": "string",
"initial_margin_rate": "string",
"maintenance_margin_rate": "string",
"position_mode": "string",
"account_limit": "string",
"create_time": "string",
"update_time": "string",
"account_mode": "string",
"exchange_type": "string",
"assets": [
{
"user_id": "string",
"coin": "string",
"exchange_type": "string",
"balance": "string",
"upnl": "string",
"equity": "string",
"futures_initial_margin": "string",
"futures_maintenance_margin": "string",
"borrowing_initial_margin": "string",
"borrowing_maintenance_margin": "string",
"available_balance": "string",
"liability": "string"
}
]
}
CrossexAccount
# Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| user_id | string | true | none | User ID |
| available_margin | string | true | none | Available Margin |
| margin_balance | string | true | none | marginbalance |
| initial_margin | string | true | none | Initial Margin |
| maintenance_margin | string | true | none | Maintenance margin |
| initial_margin_rate | string | true | none | Initial margin rate |
| maintenance_margin_rate | string | true | none | Maintenance margin rate |
| position_mode | string | true | none | Contract Position Mode |
| account_limit | string | false | none | Account limit |
| create_time | string | true | none | Created time |
| update_time | string | true | none | Update time |
| account_mode | string | false | none | Account Mode. CROSS_EXCHANGE: Cross-Exchange Mode; ISOLATED_EXCHANGE: Split-Exchange Mode |
| exchange_type | string | false | none | Exchange Type. When account_mode is CROSS_EXCHANGE, it must be CROSSEX; otherwise, it is another exchange. |
| assets | array | true | none | Asset list: grouped by exchange and currency, returning per-account balances, margin, and PnL details |
| » CrossexAccountAsset | object | false | none | none |
| »» user_id | string | false | none | User ID |
| »» coin | string | false | none | Currency |
| »» exchange_type | string | false | none | Exchange |
| »» balance | string | false | none | Balance |
| »» upnl | string | false | none | Unrealized P&L |
| »» equity | string | false | none | Net margin equity for the currency |
| »» futures_initial_margin | string | false | none | Currency-specific futures initial margin. This value is populated for futures settlement currencies (USDT/USDC/USD) |
| »» futures_maintenance_margin | string | false | none | Currency-specific futures maintenance margin. This value is populated for futures settlement currencies (USDT/USDC/USD) |
| »» borrowing_initial_margin | string | true | none | Currency-specific margin trading initial margin. This value is populated for margin or futures settlement currencies (USDT/USDC/USD) |
| »» borrowing_maintenance_margin | string | true | none | Currency-specific margin trading maintenance margin. This value is populated for margin or futures settlement currencies (USDT/USDC/USD) |
| »» available_balance | string | false | none | Available Balance |
| »» liability | string | false | none | Liability for the currency. This value is populated only for USDT, USDC, or USD |
# CrossexMarginModeRequest
{
"symbol": "string",
"margin_mode": "CROSS"
}
Request body for updating the futures position margin mode
# Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| symbol | string | true | none | Hyperliquid futures trading pair |
| margin_mode | string | true | none | Margin mode (CROSS/ISOLATED) |
# Enumerated Values
| Property | Value |
|---|---|
| margin_mode | CROSS |
| margin_mode | ISOLATED |
# CrossexAccountUpdateResponse
{
"position_mode": "string",
"account_mode": "string",
"exchange_type": "string"
}
CrossexAccountUpdateResponse
# Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| position_mode | string | false | none | Requested futures position mode to modify (SINGLE/DUAL) |
| account_mode | string | false | none | Requested account mode to modify (CROSS_EXCHANGE/ISOLATED_EXCHANGE, default: CROSS_EXCHANGE) |
| exchange_type | string | false | none | Exchange targeted by the requested change (BINANCE / OKX / GATE / BYBIT / KRAKEN / HYPERLIQUID / DERIBIT / LIGHTER / CROSSEX). When account mode is ISOLATED_EXCHANGE, the exchange must be specified to change futures position mode. |
# CrossexTransferRequest
{
"coin": "string",
"amount": "string",
"from": "string",
"to": "string",
"text": "string"
}
Fund Transfer Request Body
# Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| coin | string | true | none | Currency |
| amount | string | true | none | Transfer amount |
| from | string | true | none | from debit account (funds withdrawn from): CROSSEX_BINANCE, CROSSEX_OKX, CROSSEX_GATE, CROSSEX_BYBIT, CROSSEX_KRAKEN, CROSSEX_HYPERLIQUID, CROSSEX_DERIBIT, CROSSEX_LIGHTER, CROSSEX, SPOT |
| to | string | true | none | to receiving account (CROSSEX_BINANCE, CROSSEX_OKX, CROSSEX_GATE, CROSSEX_BYBIT, CROSSEX_KRAKEN, CROSSEX_HYPERLIQUID, CROSSEX_DERIBIT, CROSSEX_LIGHTER, CROSSEX, SPOT). |
| text | string | false | none | User-defined ID |
# CrossexClosePositionRequest
{
"symbol": "string",
"position_side": "string"
}
Full Close Position Request Body
# Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| symbol | string | true | none | Trading Pair 1. Supports leveraged trading pairs, e.g., BINANCE_MARGIN_SOL_USDT 2. Supports contract trading pairs, e.g., OKX_FUTURE_ETH_USDT |
| position_side | string | false | none | Position Direction 1. For leveraged positions, this parameter must be passed 2. For contract positions, pass selectively based on your contract holding method |
# CrossexBatchCancelOrderResponse
{
"order_id": "string",
"text": "string",
"accepted": "string",
"label": "string",
"message": "string"
}
CrossexBatchCancelOrderResponse
# Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| order_id | string | true | none | Order ID |
| text | string | true | none | Custom ID specified by the user when creating the order |
| accepted | string | true | none | Whether the request was accepted, as the string true or false |
| label | string | true | none | Error label when the request is not accepted; empty on success |
| message | string | true | none | Error message when the request is not accepted; empty on success |
# Symbol
{
"symbol": "string",
"exchange_type": "string",
"business_type": "string",
"state": "string",
"min_size": "string",
"min_notional": "string",
"lot_size": "string",
"tick_size": "string",
"max_num_orders": "string",
"max_market_size": "string",
"max_limit_size": "string",
"contract_size": "string",
"liquidation_fee": "string",
"delist_time": "string",
"support_rpi": "string",
"support_cross": "string"
}
# Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| symbol | string | true | none | Unique trading pair identifier in the form ExchangeType_BusinessType_Base_Counter. |
| exchange_type | string | true | none | Venue bucket (BINANCE / OKX / GATE / BYBIT / KRAKEN / HYPERLIQUID / DERIBIT / LIGHTER). |
| business_type | string | true | none | Business type (SPOT Spot / FUTURE Futures / MARGIN Margin). |
| state | string | true | none | Status (live running / suspend paused). |
| min_size | string | true | none | Minimum order quantity |
| min_notional | string | true | none | Minimum Order Value |
| lot_size | string | true | none | Quantity Step |
| tick_size | string | true | none | Price Step |
| max_num_orders | string | true | none | maximumopen orderamount |
| max_market_size | string | true | none | Maximum Market Order Quantity |
| max_limit_size | string | true | none | Maximum order quantity for limit orders. |
| contract_size | string | true | none | Contract multiplier (deprecated; quantity is used uniformly) |
| liquidation_fee | string | true | none | Liquidation Fee Rate |
| delist_time | string | true | none | Millisecond timestamp; 0 means not delisted. |
| support_rpi | string | false | none | Whether RPI order placement is supported (true if supported; false otherwise) |
| support_cross | string | false | none | Whether cross-margin order placement is supported (true if supported; false otherwise) |
# CrossexConvertQuoteResponse
{
"quote_id": "string",
"valid_ms": "string",
"from_coin": "string",
"to_coin": "string",
"from_amount": "string",
"to_amount": "string",
"price": "string"
}
CrossexConvertQuoteResponse
# Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| quote_id | string | true | none | Quote ID |
| valid_ms | string | true | none | Valid time (milliseconds timestamp) |
| from_coin | string | true | none | Asset Sold |
| to_coin | string | true | none | Asset Bought |
| from_amount | string | true | none | Amount to sell |
| to_amount | string | true | none | Amount to buy |
| price | string | true | none | Quoted price |
# CrossexIsolatedMarginRequest
{
"symbol": "string",
"margin": "string",
"position_side": "NONE"
}
Request body for increasing or decreasing isolated margin
# Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| symbol | string | true | none | Hyperliquid futures trading pair |
| margin | string | true | none | Margin adjustment amount. Positive values increase margin, while negative values decrease margin. Values with more than two decimal places are truncated to two decimal places |
| position_side | string | false | none | Position side (NONE/LONG/SHORT). Defaults to NONE for one-way positions if omitted |
# Enumerated Values
| Property | Value |
|---|---|
| position_side | NONE |
| position_side | LONG |
| position_side | SHORT |
# CrossexAccountUpdateRequest
{
"position_mode": "string",
"account_mode": "string",
"exchange_type": "string"
}
Change Account Request Body
# Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| position_mode | string | false | none | Futures position mode (SINGLE/DUAL) |
| account_mode | string | false | none | Account mode (CROSS_EXCHANGE/ISOLATED_EXCHANGE, default: CROSS_EXCHANGE) |
| exchange_type | string | false | none | Exchange (BINANCE / OKX / GATE / BYBIT / KRAKEN / HYPERLIQUID / DERIBIT / LIGHTER / CROSSEX). When account mode is ISOLATED_EXCHANGE, the exchange must be specified to adjust futures position mode. |