gate-crossex
Gate CrossEx 跨交易所统一交易接口技能 - 支持币安、欧易、Gate.io 统一账户交易
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/johnsonwang0720/cross-exchange-trading-platformGate CrossEx Skill
Gate CrossEx 是 Gate.io 推出的跨交易所交易平台技能,允许用户通过统一账户在多个主流交易所(币安、欧易、Gate.io)进行交易,提供完整的账户管理、资产划转、下单和仓位管理功能。
核心价值
- 跨所保证金共用 - 打破资金孤岛,一份保证金多所共用,头寸盈亏互抵
- 统一 API 标准 - 单套 API 管理全所资产与头寸,极简化部署与运维
- 全局风控体系 - 统一风控规则体系,监控多市场联动风险
- 多市场覆盖 - 接入 550+ 主流交易所市场,捕捉全网交易机会
支持的交易所
- BINANCE - 币安
- OKX - 欧易
- GATE - Gate.io
支持的交易类型
- 现货交易(Spot)
- 全仓杠杆(Cross Margin)
- U 本位永续合约(USDT Perpetual Futures)
配置说明
1. API Key 配置
在使用本技能前,需要配置 Gate CrossEx API 凭证:
方法 1:环境变量(推荐)
export GATE_API_KEY="your_api_key_here"
export GATE_API_SECRET="your_api_secret_here"
方法 2:配置文件
将 API 凭证保存到 ~/.openclaw/credentials/gate.json:
{
"apiKey": "your_api_key_here",
"secretKey": "your_api_secret_here"
}
⚠️ 安全提示:
- 确保配置文件权限为
600(仅所有者可读写) - 不要在版本控制中提交 API 密钥
- 建议使用受限权限的 API Key
2. 开通 CrossEx 账户
- 登录 Gate.io 账户
- 在顶部菜单栏的【交易-跨所交易】中开通跨所账户
- 进入【账户管理】→ 【APIv4 Keys】
- 创建新的 API Key,需勾选 跨所交易权限
3. API 签名机制
Gate CrossEx 使用 HMAC-SHA512 签名算法:
import time
import hashlib
import hmac
def gen_sign(method, url, query_string=None, payload_string=None):
key = os.getenv('GATE_API_KEY')
secret = os.getenv('GATE_API_SECRET')
t = str(int(time.time()))
m = hashlib.sha512()
m.update((payload_string or '').encode('utf-8'))
hashed_payload = m.hexdigest()
s = '%s\n%s\n%s\n%s\n%s' % (
method, url, query_string or '', hashed_payload, t
)
sign = hmac.new(
secret.encode('utf-8'),
s.encode('utf-8'),
hashlib.sha512
).hexdigest()
return {
'KEY': key,
'Timestamp': t,
'SIGN': sign,
'Accept': 'application/json',
'Content-Type': 'application/json'
}
API 接口
基础信息
- 实盘交易:
https://api.gateio.ws/api/v4/crossex
主要功能模块
1. 公共接口(无需认证)
# 查询币对信息
GET /rule/symbols
# 查询风险限额信息
GET /rule/risk_limits
# 查询划转币种支持
GET /rule/support_currencies
2. 账户管理(需要认证)
# 查询账户资产
GET /accounts
# 查询杠杆仓位
GET /position/margin
# 查询合约仓位
GET /position/futures
3. 资金划转(需要认证)
# 资金划转
POST /wallet/transfers
# 查询资金划转历史
GET /wallet/transfers
4. 订单管理(需要认证)
# 下单
POST /orders
# 撤单
DELETE /orders
# 改单
PUT /orders/{order_id}
# 查询订单详情
GET /orders/{order_id}
# 查询当前所有挂单
GET /orders
5. 闪兑交易(需要认证)
# 闪兑询价
POST /convert/quote
# 闪兑交易
POST /convert/execute
使用示例
Python 示例
# coding: utf-8
import os
import time
import hashlib
import hmac
import requests
# 从环境变量获取 API 凭证
API_KEY = os.getenv('GATE_API_KEY')
API_SECRET = os.getenv('GATE_API_SECRET')
def gen_sign(method, url, query_string=None, payload_string=None):
"""生成 Gate CrossEx API 签名"""
t = str(int(time.time()))
m = hashlib.sha512()
m.update((payload_string or '').encode('utf-8'))
hashed_payload = m.hexdigest()
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-johnsonwang0720-cross-exchange-trading-platform": {
"enabled": true,
"auto_update": true
}
}
}Tags
Related Skills
vynn-backtester
Run trading strategy backtests with natural language — powered by Vynn
q-kdb-code-review
AI-powered code review for Q/kdb+ — catch bugs in the most terse language in finance
scrapebadger
Web scraping platform — Twitter/X data, Vinted marketplace, and general web scraping API
clinicaltrials-gov-parser
Monitor and summarize competitor clinical trial status changes from ClinicalTrials.gov. Trigger: When user asks to track clinical trials, monitor trial status changes, get updates on specific trials, or analyze competitor trial activities. Use cases: Pharma competitive intelligence, trial monitoring, status tracking, recruitment updates, completion alerts.
agent3-hub
Universal AI resource registry — search and invoke agents, MCP servers, and APIs through a single MCP endpoint. Includes Telegram content search, Google search, X/Twitter search, and more.