gate-exchange-crossex
Resolving gate-cli (binary path)
Resolve gate-cli in order: (1) command -v gate-cli and gate-cli --version succeeds; (2) ${HOME}/.local/bin/gate-cli if executable; (3) ${HOME}/.openclaw/skills/bin/gate-cli if executable. Canonical rules: exchange-runtime-rules.md §4 (or gate-runtime-rules.md §4).
Gate CrossEx Trading Suite
This skill is the unified entry point for Gate CrossEx cross-exchange trading. It supports lots of core operations: order management, position query, and history query. User intents are routed to corresponding workflows.
General Rules
⚠️ STOP — You MUST read and strictly follow the shared runtime rules before proceeding. Do NOT select or call any tool until all rules are read. These rules have the highest priority. → Read gate-runtime-rules.md
- Only use the
gate-clicommands explicitly listed in this skill. Commands not documented here must NOT be run for these workflows, even if other interfaces expose them.
Skill Dependencies
gate-cli commands used
Query Operations (Read-only)
gate-cli cex cross-ex account getgate-cli cex cross-ex market feegate-cli cex cross-ex market interest-rategate-cli cex cross-ex position margin-leveragegate-cli cex cross-ex order getgate-cli cex cross-ex position leveragegate-cli cex cross-ex account bookgate-cli cex cross-ex position adl-rankgate-cli cex cross-ex market discount-rategate-cli cex cross-ex position margin-interestsgate-cli cex cross-ex position margin-historygate-cli cex cross-ex order historygate-cli cex cross-ex position historygate-cli cex cross-ex order tradesgate-cli cex cross-ex position margin-listgate-cli cex cross-ex order listgate-cli cex cross-ex position listgate-cli cex cross-ex market risk-limitsgate-cli cex cross-ex market symbolsgate-cli cex cross-ex market transfer-coinsgate-cli cex cross-ex transfer list
Execution Operations (Write)
gate-cli cex cross-ex order cancelgate-cli cex cross-ex position closegate-cli cex cross-ex convert creategate-cli cex cross-ex convert quotegate-cli cex cross-ex order creategate-cli cex cross-ex transfer creategate-cli cex cross-ex account updategate-cli cex cross-ex position set-margin-leveragegate-cli cex cross-ex order updategate-cli cex cross-ex position set-leverage
Authentication
- Interactive file setup: when
GATE_API_KEYandGATE_API_SECRETare not both set on the host, rungate-cli config initto complete the wizard for API key, secret, profiles, and defaults (see gate-cli). - Env / flags:
gate-cli config initis not required when credentials are already supplied — e.g. bothGATE_API_KEYandGATE_API_SECRETset on the host, or--api-key/--api-secretwhere supported — never ask the user to paste secrets into chat. - Permissions: Crx:Write
- Portal: create or rotate keys outside the chat: https://www.gate.com/myaccount/profile/api-key/manage
Installation Check
- Required:
gate-cli(runsh ./setup.shfrom this skill directory if missing; optionalGATE_CLI_SETUP_MODE=release). - Add
$HOME/.openclaw/skills/bintoPATHif you invokegate-cliby name (or the directory wheresetup.shinstalls it). - Credentials: When
GATE_API_KEYandGATE_API_SECRETare both set (non-empty) for the host, do not requiregate-cli config init— that is equivalent valid config forgate-cli. When both are unset or empty, remind the operator to rungate-cli config initor to configureGATE_API_KEY/GATE_API_SECRETin the matching skill from the skill library (never ask the user to paste secrets into chat). - Sanity check: Do not proceed with authenticated calls until the CLI behaves as expected (e.g.
gate-cli --versionor a read-onlygate-cli cex ...command from this skill); confirm credentials resolve before mutating operations.
Execution mode
Read and strictly follow references/gate-cli.md, then execute this skill's CrossEx workflow.
SKILL.mdkeeps route dispatch and feature boundaries.references/gate-cli.mdis the authoritativegate-cliexecution contract for query/mutation sequencing, confirmation gates, and risk-aware updates.
Module Overview
| Module | Description | Trigger Keywords |
|---|---|---|
| Spot | Limit/market buy/sell, cross-exchange arbitrage | spot buy, spot sell, buy spot, sell spot |
| Margin | Long/short trading, margin management, auto-borrowing | margin long, margin short, long margin, short margin |
| Futures | USDT perpetual contracts, dual-direction positions, leverage adjustment | futures long, futures short, open long, open short |
| Transfer | Cross-exchange fund transfer | fund transfer, cross-exchange transfer, transfer, move funds |
| Convert | Flash convert and conversion quote workflow | convert trading, flash convert, convert, quote convert |
| Orders | Query, cancel, amend orders, order history | query orders, cancel order, amend order, order history, list orders |
| Positions | Query all position types, history records | query positions, check positions, position history, positions |
| History | Query order/position/trade/interest history | history query, trade history, interest history, history |
Routing Rules
| Intent | Example Phrases | Route To |
|---|---|---|
| Spot Trading | "Buy 100 USDT worth of BTC", "Sell 0.5 BTC", "Market buy ETH spot" | Read references/spot-trading.md |
| Margin Trading | "Long 50 USDT worth of XRP on margin", "Short BTC on margin", "10x leverage long" | Read references/margin-trading.md |
| Futures Trading | "Open 1 BTC futures long position", "Market short ETH", "Adjust leverage to 20x" | Read references/futures-trading.md |
| Cross-Exchange Transfer | "Transfer 100 USDT from Gate to Binance", "Move ETH from OKX to Gate" | Read references/transfer.md |
| Convert Trading | "Flash convert 10 USDT to BTC", "Convert 50 USDT to ETH on Gate" | Read references/convert-trading.md |
| Order Management | "Query all open orders", "Cancel that buy order", "Amend order price", "Query order history" | Read references/order-management.md |
| Position Query | "Query all my positions", "Show futures positions", "Position history" | Read references/position-query.md |
| History Query | "Query trade history", "Position history", "Margin interest history", "Account ledger" | Read references/history-query.md |
| Unclear | "Show account" , "Help me" , "Please Check my account" | Clarify: Query account, then guide user |
gate-cli command index
This skill uses the CrossEx MCP toolset with the cex_crx prefix as its only core tool family.
Scope rule: Only execute operations explicitly documented in this skill. Only call tools listed in the tables below
or in references/*.md. Tools or operations not mentioned here must not be called.
Tool Naming Convention
- List operations in the cex_crx family query symbols, orders, positions, transfers, or history
- Get operations in the cex_crx family query a single account setting, fee, rate, or order detail
- Create operations in the cex_crx family create an order, transfer, convert quote, or convert order
- Update operations in the cex_crx family update account settings, leverage, or existing orders
- Cancel operations in the cex_crx family cancel an existing order
- Close operations in the cex_crx family close an existing position
Symbol And Rule Tools
| Tool | Purpose |
|---|---|
gate-cli cex cross-ex market symbols |
List supported CrossEx trading symbols |
gate-cli cex cross-ex market risk-limits |
Query symbol risk limit rules |
gate-cli cex cross-ex market transfer-coins |
List assets supported for CrossEx transfer |
gate-cli cex cross-ex market fee |
Query CrossEx trading fee information |
gate-cli cex cross-ex market interest-rate |
Query CrossEx interest rates |
gate-cli cex cross-ex market discount-rate |
Query collateral discount rates |
Account Tools
| Tool | Purpose |
|---|---|
gate-cli cex cross-ex account get |
Query CrossEx account overview and balances |
gate-cli cex cross-ex account update |
Update CrossEx account settings |
gate-cli cex cross-ex account book |
Query CrossEx account ledger entries |
Transfer And Convert Tools
| Tool | Purpose |
|---|---|
gate-cli cex cross-ex transfer list |
Query transfer history |
gate-cli cex cross-ex transfer create |
Create a cross-exchange transfer |
gate-cli cex cross-ex convert quote |
Get a flash convert quote |
gate-cli cex cross-ex convert create |
Execute a flash convert order |
Order Tools
| Tool | Purpose |
|---|---|
gate-cli cex cross-ex order list |
Query current open orders |
gate-cli cex cross-ex order create |
Create a CrossEx order |
gate-cli cex cross-ex order get |
Query order details |
gate-cli cex cross-ex order update |
Amend an existing order |
gate-cli cex cross-ex order cancel |
Cancel a single order |
gate-cli cex cross-ex order history |
Query order history |
gate-cli cex cross-ex order trades |
Query trade history |
Position And Leverage Tools
| Tool | Purpose |
|---|---|
gate-cli cex cross-ex position list |
Query current futures positions |
gate-cli cex cross-ex position margin-list |
Query current margin positions |
gate-cli cex cross-ex position close |
Close an existing CrossEx position |
gate-cli cex cross-ex position leverage |
Query futures leverage settings |
gate-cli cex cross-ex position set-leverage |
Update futures leverage |
gate-cli cex cross-ex position margin-leverage |
Query margin leverage settings |
gate-cli cex cross-ex position set-margin-leverage |
Update margin leverage |
gate-cli cex cross-ex position history |
Query futures position history |
gate-cli cex cross-ex position margin-history |
Query margin position history |
gate-cli cex cross-ex position margin-interests |
Query margin interest history |
gate-cli cex cross-ex position adl-rank |
Query ADL rank information |
Usage Guidance
- Use the cex_crx MCP family as the default and only core MCP family for this skill.
- Use list/get tools to query symbol rules, fees, balances, leverage, or supported assets.
- Prefer history and account-book tools when the user asks for records, audit trails, or status verification.
Execution
1. Intent and Parameter Identification
- Determine module (orders/positions/history)
- Extract key parameters:
- Trading Pair:
GATE_SPOT_BTC_USDT,GATE_MARGIN_XRP_USDT,GATE_FUTURE_ETH_USDT - Exchange:
GATE,BINANCE,OKX,BYBIT - Direction:
BUY(buy/long),SELL(sell/short) - Quantity: USDT amount, coin quantity, contract size
- Price: Limit, market
- Leverage: Leverage multiplier (margin/futures only)
- Position Side:
LONG(long),SHORT(short, margin/futures only) - Missing Parameters: If required parameters are missing, ask user
2. Pre-checks
- Trading Pair: Call
gate-cli cex cross-ex market symbolsto verify - Account Balance: Call
gate-cli cex cross-ex account getto check if available margin is sufficient - Position Check:
- Margin Trading: Check existing positions to avoid direction conflicts
- Futures Trading: Check dual-direction position mode
- Minimum Amount: Query
min_quote_amount(typically 3 USDT) - Exchange Status: Verify target exchange is operating normally
3. Module Logic
Module A: Spot Trading
- Parameter Confirmation:
- Trading pair format:
GATE_SPOT_{BASE}_{QUOTE} - Buy parameters:
quote_qty(USDT amount) - Sell parameters:
qty(coin quantity)
- Minimum Amount Check: Call
gate-cli cex cross-ex market symbolsto query minimum amount - Pre-order Confirmation: Display order summary (pair, direction, quantity, price), require user confirmation
- Place Order: Call
gate-cli cex cross-ex order create - Verification: Call
gate-cli cex cross-ex order getto confirm order status
Module B: Margin Trading
- Parameter Confirmation:
- Trading pair format:
GATE_MARGIN_{BASE}_{QUOTE} - Required parameters:
qty(coin quantity),position_side(LONGorSHORT) - Optional parameters:
quote_qty(USDT amount)
- Leverage Check: Query current leverage, adjust if user specifies
- Position Direction:
- Long (
LONG): Buy coin, borrow USDT - Short (
SHORT): Sell coin, borrow coin
- Minimum Amount Check: Call
gate-cli cex cross-ex market symbolsto query minimum amount - Pre-order Confirmation: Display order summary (pair, direction, quantity, leverage), require confirmation
- Place Order: Call
gate-cli cex cross-ex order createwith parameterposition_side - Verification: Call
gate-cli cex cross-ex position margin-listwith asymbolfilter to confirm position
Module C: Futures Trading
- Parameter Confirmation:
- Trading pair format:
GATE_FUTURE_{BASE}_{QUOTE} - Required parameters:
qty(contract size),position_side(LONGorSHORT)
- Leverage Adjustment: If user specifies leverage, call
gate-cli cex cross-ex position leverageandgate-cli cex cross-ex position set-leverage - Contract Size Calculation (if ordering by value):
- Get
quanto_multiplierand current price - Round down to ensure overspending is avoided
- Minimum Size Check: Call
gate-cli cex cross-ex market symbolsto query minimum size - Pre-order Confirmation: Display order summary (pair, direction, size, leverage), require confirmation
- Place Order: Call
gate-cli cex cross-ex order createwith parameterposition_side - Verification: Call
gate-cli cex cross-ex position listwith asymbolfilter to confirm position
Module D: Cross-Exchange Transfer
- Transfer Type:
- Cross-exchange transfer:
gate-cli cex cross-ex transfer create(Exchange A -> Exchange B)
- Parameter Confirmation:
- Cross-exchange transfer:
from,to,coin,amount - From/To Account Rules:
| Coin | Mode | Valid
from/to| Defaults | |------|------|--------------------|---------| | USDT | Cross-Exchange |SPOT↔CROSSEX|CROSSEX_{exchange_type}→CROSSEX| | USDT | Sub-Exchange |SPOT↔CROSSEX_{exchange_type}orCROSSEX_{exchange_type}↔CROSSEX_{exchange_type}|CROSSEX→CROSSEX_GATE| | Non-USDT | Any | Must useCROSSEX_{exchange_type}(neverCROSSEXalone). Cross-exchange transfers allowed (e.g.,CROSSEX_BINANCE↔CROSSEX_GATE). | — |
- Supported Coin Check: Call
gate-cli cex cross-ex market transfer-coinsto verify - Balance Check: Confirm source account has sufficient balance
- Pre-transfer Confirmation: Display transfer summary (source, destination, coin, quantity), require confirmation
- Execute Transfer: Call
gate-cli cex cross-ex transfer create - Verification: Call
gate-cli cex cross-ex transfer listto query transfer history and confirm
Module E: Convert Trading
- Convert Type:
- Flash convert quote:
gate-cli cex cross-ex convert quote - Flash convert execution:
gate-cli cex cross-ex convert create
- Parameter Confirmation:
- Flash convert:
from_coin,to_coin,from_amount,exchange_type
- Balance Check: Confirm source account has sufficient balance for the convert pair
- Pre-convert Confirmation: Display source asset, target asset, rate, and expected receive amount, then require confirmation
- Quote: Call
gate-cli cex cross-ex convert quote - Execute Convert: Call
gate-cli cex cross-ex convert createwith the returnedquote_id - Verification: Call
gate-cli cex cross-ex account getto confirm resulting balances
Module F: Order Management
- Query Orders:
- Current open orders: Call
gate-cli cex cross-ex order list - Order details: Call
gate-cli cex cross-ex order get - Order History: Call
gate-cli cex cross-ex order history(parameters: limit, page, from, to)
- Cancel Orders:
- Single cancel: Call
gate-cli cex cross-ex order cancel
- Amend Orders:
- Check order status must be
open - Call
gate-cli cex cross-ex order updateto amend price or quantity
- Display Results: Display order information in table format
Module G: Position Query
- Query Types:
- Futures positions: Call
gate-cli cex cross-ex position list - Margin positions: Call
gate-cli cex cross-ex position margin-list - Futures leverage: Call
gate-cli cex cross-ex position leverage - Margin leverage: Call
gate-cli cex cross-ex position margin-leverage
- History Query:
- Position History: Call
gate-cli cex cross-ex position history(parameters: limit, page, from, to) - Margin Position History: Call
gate-cli cex cross-ex position margin-history - Trade History: Call
gate-cli cex cross-ex order trades(parameters: limit, page, from, to)
- Display Format:
- Current positions: Table format (pair, direction, quantity, entry price, unrealized PnL)
- History records: Reverse chronological order, display recent N records
Module H: History Query
- Order History:
- Call
gate-cli cex cross-ex order history - Parameters:
limit(max 100),page,from(start timestamp),to(end timestamp)
- Trade History:
- Call
gate-cli cex cross-ex order trades - Same parameters as above
- Position History:
- Call
gate-cli cex cross-ex position history - Same parameters as above
- Margin Position History:
- Call
gate-cli cex cross-ex position margin-history - Same parameters as above
- Margin Interest History:
- Call
gate-cli cex cross-ex position margin-interests - Same parameters as above
Report Template
After each operation, output a concise standardized result.
Safety Rules
- Credentials: Never prompt or induce the user to paste API Secret Key into chat; prefer secure local MCP configuration.
- User-to-User Transfer: This skill does not support P2P or user-to-user transfers; only transfers between the user's own accounts (e.g., SPOT ↔ CROSSEX) are allowed.
- Trade Orders: Display complete order summary (pair, direction, quantity, price, leverage), require user confirmation before placing order
- Cross-Exchange Transfer: Display transfer details (source, destination, quantity, arrival time), require confirmation
- Scope rule: Only call tools documented in this skill. If the user requests an operation not documented here, respond that it is not supported by this skill.
- Batch Operations: Display operation scope and impact, require explicit confirmation
Example: "Reply 'confirm' to execute the above operation."
Error Handling
| Error Code | Handling |
|---|---|
USER_NOT_EXIST |
Please confirm if a GATE CrossEx account has been opened. Refer to the GATE Help Center -> CrossEx Trading -> CrossEx Account Operation Guide for instructions. |
TRADE_INVALID_QUOTE_ORDER_QTY |
⚠️ Incorrect parameter name: Market buy must use quote_qty |
TRADE_INVALID_ORDER_QTY |
⚠️ Limit order error: Limit orders must use qty (coin quantity) + price |
TRADE_ORDER_AMOUNT_MIN_ERROR |
Order amount below minimum notional value (typically 3 USDT), increase quantity or amount |
CONVERT_TRADE_QUOTE_EXCHANGE_INVALID_ERROR |
⚠️ Flash convert: exchange_type parameter value must be uppercase exchange code (e.g., GATE) |
TRADE_MARGIN_INVALID_PZ_SIDE_ERROR |
Prompt that margin/futures trading must specify position_side (LONG/SHORT) |
BALANCE_NOT_ENOUGH |
Insufficient available margin, suggest reducing trade amount or depositing |
SYMBOL_NOT_FOUND |
Confirm trading pair format is correct (e.g., GATE_SPOT_BTC_USDT) |
INVALID_PARAM_VALUE |
Check parameter format (qty is numeric string, position_side is LONG/SHORT) |
POSITION_NOT_EMPTY |
Prompt to close position before reversing direction |
TRADE_ORDER_LOT_SIZE_ERROR |
Suggest adjusting quantity to minimum unit of the trading pair |
RATE_LIMIT_EXCEEDED |
Prompt user about rate limit; suggest retrying later or reducing request frequency |
TRADE_INVALID_EXCHANGE_TYPE |
Invalid exchange type; please check the exchange_type parameter (e.g., GATE, BINANCE, OKX, BYBIT) |
More from gate/gate-skills
gate-exchange-futures
Gate Exchange USDT perpetual futures trading skill. Use when the user wants to trade contracts, open/close perpetual positions, or manage futures leverage. Triggers on 'open long', 'close short', 'USDT perpetual', 'futures TP/SL'.
125gate-exchange-spot
Gate spot trading and account operations skill. Use when the user asks to buy/sell crypto on spot, check account value, list spot balances, or place conditional/trigger orders. Triggers on 'buy coin', 'sell spot', 'take profit', 'stop loss', 'cancel order', 'my spot balance', '查看我的现货账户余额', or '现货账户余额'.
113gate-exchange-marketanalysis
Gate Exchange market analysis tool. Use when the user asks for deep market metrics like liquidity, slippage, funding arbitrage, or manipulation risk. Triggers on 'liquidity', 'depth', 'slippage', 'momentum', 'buy/sell pressure', 'squeeze', 'funding rate', 'arbitrage', 'basis', 'premium'.
102gate-news-briefing
News briefing. Use this skill ONLY when the user's query is exclusively about recent news or headlines with no other analysis dimensions. Trigger phrases: what happened recently, today's highlights, crypto news, any new updates. If the query ALSO mentions coin analysis, risk check, technicals, or any other analysis dimension, use gate-info-research instead — it handles multi-dimension queries in a single unified report.
95gate-info-trendanalysis
Trend and technical analysis. Use this skill ONLY when the user's query is exclusively about technical indicators or trend analysis for one coin with no other analysis dimensions. Trigger phrases: technical analysis, K-line, RSI, MACD, trend, support, resistance. If the query ALSO mentions fundamentals, risk, news, sentiment, or any other analysis dimension, use gate-info-research instead — it handles multi-dimension queries in a single unified report.
84gate-dex-market
On-chain DEX market data queries via Gate: token prices/价格, K-line/OHLC candlestick charts, token rankings, security risk audits, new token discovery, holder analysis, and trading volume stats. Read-only — no transactions. Use when the user asks for 'token price', 'price of ETH', 'check SOL price', '查价格', 'K线', 'candlestick', 'OHLC', 'top gainers', 'trending tokens', 'is this token safe', 'honeypot check', 'new tokens', 'trading volume', or 'liquidity events'. Do NOT use for swap/trade execution (use gate-dex-trade) or wallet balance/account queries (use gate-dex-wallet).
76