opentrade-cex

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

OpenTrade CEX Trading

OpenTrade CEX 交易

29 API endpoints for centralized exchange trading — market data, account management, spot & futures orders, positions, leverage, and wallet agent.
IMPORTANT: This is a CEX (centralized exchange) trading skill. All trades are executed server-side with built-in risk controls — no private key management or transaction signing required.
IMPORTANT: Write operations (place order, edit order, close position, set leverage) are protected by a 4-layer risk engine: price deviation check, position limit, rate limit, and balance verification.
包含29个用于中心化交易所交易的API端点——覆盖行情数据、账户管理、现货与期货订单、持仓、杠杆和钱包代理功能。
重要提示:这是一项**CEX(中心化交易所)**交易技能。所有交易都在服务端执行,内置风险控制机制——无需管理私钥或对交易签名。
重要提示:写入操作(下单、编辑订单、平仓、设置杠杆)受四层风险引擎保护:价格偏差检查、持仓限额、速率限制和余额校验。

Pre-flight Checks

前置检查

Every time before running any CEX command, always follow these steps in order:
  1. Find or create a
    .env
    file in the project root to load the API credentials:
bash
OPEN_TOKEN=your_token_here
Get your API token at: https://6551.io/mcp
Security warning: Never commit .env to git (add it to .gitignore) and never expose credentials in logs, screenshots, or chat messages.
  1. Set the base URL and auth header:
bash
BASE_URL="https://ai.6551.io"
AUTH_HEADER="Authorization: Bearer $OPEN_TOKEN"
每次运行任何CEX命令前,请务必按顺序执行以下步骤:
  1. 找到或在项目根目录创建
    .env
    文件,用于加载API凭证:
bash
OPEN_TOKEN=your_token_here
获取你的API令牌:https://6551.io/mcp
安全警告:切勿将.env提交到git(请将其添加到.gitignore中),也切勿在日志、截图或聊天消息中泄露凭证。
  1. 设置基础URL和鉴权请求头:
bash
BASE_URL="https://ai.6551.io"
AUTH_HEADER="Authorization: Bearer $OPEN_TOKEN"

Skill Routing

技能路由

  • For DEX swaps / on-chain token exchange → use
    opentrade-dex-swap
  • For on-chain wallet balances / portfolio → use
    opentrade-portfolio
  • For on-chain market data / smart money signals → use
    opentrade-market
  • For token search / holders / trending → use
    opentrade-token
  • For custodial wallet (BSC/Solana) → use
    opentrade-wallet
  • For transaction broadcasting / gas → use
    opentrade-gateway
  • For CEX trading (spot, futures, leverage, orders, positions) → use this skill (
    opentrade-cex
    )
  • DEX兑换/链上代币交易 → 使用
    opentrade-dex-swap
  • 链上钱包余额/资产组合 → 使用
    opentrade-portfolio
  • 链上市场数据/聪明钱信号 → 使用
    opentrade-market
  • 代币搜索/持币地址/热门代币 → 使用
    opentrade-token
  • 托管钱包(BSC/Solana) → 使用
    opentrade-wallet
  • 交易广播/Gas费处理 → 使用
    opentrade-gateway
  • CEX交易(现货、期货、杠杆、订单、持仓) → 使用本技能(
    opentrade-cex

Supported Exchanges

支持的交易所

ExchangeIDName
binance
Binance
bybit
Bybit
okx
OKX
hyperliquid
Hyperliquid
aster
Aster
交易所ID名称
binance
Binance
bybit
Bybit
okx
OKX
hyperliquid
Hyperliquid
aster
Aster

Quickstart

快速开始

bash
undefined
bash
undefined

1. Get real-time ticker

1. 获取实时行情

curl -s "$BASE_URL/open/trader/newsliquid/v1/market/ticker?symbol=BTC/USDT&exchangeId=binance"
-H "$AUTH_HEADER"
curl -s "$BASE_URL/open/trader/newsliquid/v1/market/ticker?symbol=BTC/USDT&exchangeId=binance"
-H "$AUTH_HEADER"

2. Check account balance

2. 查看账户余额

curl -s "$BASE_URL/open/trader/newsliquid/v1/account/summary?exchangeId=binance&symbol=BTC/USDT:USDT"
-H "$AUTH_HEADER"
curl -s "$BASE_URL/open/trader/newsliquid/v1/account/summary?exchangeId=binance&symbol=BTC/USDT:USDT"
-H "$AUTH_HEADER"

3. Place a limit buy order

3. 下限价买单

curl -s -X POST "$BASE_URL/open/trader/newsliquid/v1/orders"
-H "$AUTH_HEADER" -H "Content-Type: application/json"
-d '{"symbol":"BTC/USDT:USDT","side":"buy","type":"limit","quantity":0.001,"price":60000,"exchangeId":"binance"}'
curl -s -X POST "$BASE_URL/open/trader/newsliquid/v1/orders"
-H "$AUTH_HEADER" -H "Content-Type: application/json"
-d '{"symbol":"BTC/USDT:USDT","side":"buy","type":"limit","quantity":0.001,"price":60000,"exchangeId":"binance"}'

4. Check open orders

4. 查看未成交订单

curl -s "$BASE_URL/open/trader/newsliquid/v1/orders/open?exchangeId=binance"
-H "$AUTH_HEADER"
curl -s "$BASE_URL/open/trader/newsliquid/v1/orders/open?exchangeId=binance"
-H "$AUTH_HEADER"

5. Check current positions

5. 查看当前持仓

curl -s "$BASE_URL/open/trader/newsliquid/v1/positions?exchangeId=binance"
-H "$AUTH_HEADER"
curl -s "$BASE_URL/open/trader/newsliquid/v1/positions?exchangeId=binance"
-H "$AUTH_HEADER"

6. Close a position (market price)

6. 平仓(市价)

curl -s -X POST "$BASE_URL/open/trader/newsliquid/v1/positions/close"
-H "$AUTH_HEADER" -H "Content-Type: application/json"
-d '{"symbol":"BTC/USDT:USDT","side":"long","quantity":0,"exchangeId":"binance"}'

> **Note**: Trading pair format follows CCXT standard: `BTC/USDT` for spot, `BTC/USDT:USDT` for USDT perpetual contracts.
curl -s -X POST "$BASE_URL/open/trader/newsliquid/v1/positions/close"
-H "$AUTH_HEADER" -H "Content-Type: application/json"
-d '{"symbol":"BTC/USDT:USDT","side":"long","quantity":0,"exchangeId":"binance"}'

> **注意**:交易对格式遵循CCXT标准:现货用`BTC/USDT`,USDT永续合约用`BTC/USDT:USDT`。

Command Index

命令索引

Market Data (no risk control)

行情数据(无风控)

#EndpointMethodDescription
1
/open/trader/newsliquid/v1/market/metadata
GETGet market metadata (trading pairs, precision, limits)
2
/open/trader/newsliquid/v1/market/ticker
GETGet real-time ticker (last price, 24h change, volume)
3
/open/trader/newsliquid/v1/market/klines
GETGet K-line / candlestick data
4
/open/trader/newsliquid/v1/market/base-currencies
GETGet base currency list (USDT, BTC, etc.)
5
/open/trader/newsliquid/v1/market/time
GETGet server time
#端点请求方法描述
1
/open/trader/newsliquid/v1/market/metadata
GET获取市场元数据(交易对、精度、交易限制)
2
/open/trader/newsliquid/v1/market/ticker
GET获取实时行情(最新价格、24小时涨跌幅、成交量)
3
/open/trader/newsliquid/v1/market/klines
GET获取K线/蜡烛图数据
4
/open/trader/newsliquid/v1/market/base-currencies
GET获取基础币种列表(USDT、BTC等)
5
/open/trader/newsliquid/v1/market/time
GET获取服务器时间

Account (no risk control)

账户(无风控)

#EndpointMethodDescription
6
/open/trader/newsliquid/v1/account/summary
GETAccount summary (balance, leverage, max position)
7
/open/trader/newsliquid/v1/account/spot
GETQuery specific spot asset
8
/open/trader/newsliquid/v1/account/spots
GETQuery all spot assets
#端点请求方法描述
6
/open/trader/newsliquid/v1/account/summary
GET账户摘要(余额、杠杆、最大持仓)
7
/open/trader/newsliquid/v1/account/spot
GET查询指定现货资产
8
/open/trader/newsliquid/v1/account/spots
GET查询所有现货资产

Config (no risk control)

配置(无风控)

#EndpointMethodDescription
9
/open/trader/newsliquid/v1/config
GETGet trading config
10
/open/trader/newsliquid/v1/config
PUTUpdate trading config
#端点请求方法描述
9
/open/trader/newsliquid/v1/config
GET获取交易配置
10
/open/trader/newsliquid/v1/config
PUT更新交易配置

Orders (risk control on create/edit)

订单(创建/编辑操作受风控)

#EndpointMethodRiskDescription
11
/open/trader/newsliquid/v1/orders
POSTYesPlace order (limit/market/stop-loss/take-profit)
12
/open/trader/newsliquid/v1/orders/edit
PUTYesEdit existing order
13
/open/trader/newsliquid/v1/orders/:orderId
DELETENoCancel order
14
/open/trader/newsliquid/v1/orders/open
GETNoList open orders
15
/open/trader/newsliquid/v1/orders/closed
GETNoList closed orders
#端点请求方法受风控描述
11
/open/trader/newsliquid/v1/orders
POST下单(限价/市价/止损/止盈)
12
/open/trader/newsliquid/v1/orders/edit
PUT编辑现有订单
13
/open/trader/newsliquid/v1/orders/:orderId
DELETE取消订单
14
/open/trader/newsliquid/v1/orders/open
GET列出未成交订单
15
/open/trader/newsliquid/v1/orders/closed
GET列出已完成订单

Positions (risk control on close)

持仓(平仓操作受风控)

#EndpointMethodRiskDescription
16
/open/trader/newsliquid/v1/positions
GETNoList current positions
17
/open/trader/newsliquid/v1/positions/history
GETNoList historical positions
18
/open/trader/newsliquid/v1/positions/close
POSTYesClose position (market price)
#端点请求方法受风控描述
16
/open/trader/newsliquid/v1/positions
GET列出当前持仓
17
/open/trader/newsliquid/v1/positions/history
GET列出历史持仓
18
/open/trader/newsliquid/v1/positions/close
POST平仓(市价)

Trades (no risk control)

交易记录(无风控)

#EndpointMethodDescription
19
/open/trader/newsliquid/v1/trades/history
GETGet trade execution history
#端点请求方法描述
19
/open/trader/newsliquid/v1/trades/history
GET获取交易执行历史

Leverage & Margin (risk control on leverage change)

杠杆与保证金(更改杠杆受风控)

#EndpointMethodRiskDescription
20
/open/trader/newsliquid/v1/leverage
GETNoGet available leverage tiers
21
/open/trader/newsliquid/v1/leverage/current
GETNoGet current leverage setting
22
/open/trader/newsliquid/v1/leverage/current
PUTYesSet leverage multiplier
23
/open/trader/newsliquid/v1/margin/mode
GETNoGet margin mode
24
/open/trader/newsliquid/v1/position/mode
GETNoGet position mode (one-way/hedge)
25
/open/trader/newsliquid/v1/position/mode
PUTNoSet position mode
#端点请求方法受风控描述
20
/open/trader/newsliquid/v1/leverage
GET获取可用杠杆档位
21
/open/trader/newsliquid/v1/leverage/current
GET获取当前杠杆设置
22
/open/trader/newsliquid/v1/leverage/current
PUT设置杠杆倍数
23
/open/trader/newsliquid/v1/margin/mode
GET获取保证金模式
24
/open/trader/newsliquid/v1/position/mode
GET获取持仓模式(单向/双向)
25
/open/trader/newsliquid/v1/position/mode
PUT设置持仓模式

Wallet Agent (no risk control)

钱包代理(无风控)

#EndpointMethodDescription
26
/open/trader/newsliquid/v1/walletagent/create
POSTCreate wallet agent
27
/open/trader/newsliquid/v1/walletagent/list
GETList wallet agents
28
/open/trader/newsliquid/v1/walletagent/address/:address
GETQuery wallet agent by address
29
/open/trader/newsliquid/v1/walletagent/authorize
PUTAuthorize wallet agent
#端点请求方法描述
26
/open/trader/newsliquid/v1/walletagent/create
POST创建钱包代理
27
/open/trader/newsliquid/v1/walletagent/list
GET列出钱包代理
28
/open/trader/newsliquid/v1/walletagent/address/:address
GET按地址查询钱包代理
29
/open/trader/newsliquid/v1/walletagent/authorize
PUT授权钱包代理

API Reference

API 参考

1. Get Market Metadata

1. 获取市场元数据

获取指定交易对在所有交易所的市场元数据信息(交易对列表、合约类型、杠杆范围、最小下单量等)。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/market/metadata?ticker=BTC" \
  -H "$AUTH_HEADER"
Parameters:
FieldTypeRequiredDescription
ticker
String (query)YesBase currency code (e.g.,
BTC
,
ETH
,
SOL
)
Response:
json
{
  "success": true,
  "data": {
    "ticker": "BTC",
    "markets": [
      {
        "exchangeId": "binance",
        "id": "BTCUSDT",
        "symbol": "BTC/USDT",
        "displaySymbol": "BTC/USDT",
        "active": true,
        "leverageMin": 1,
        "leverageMax": 125,
        "baseCurrency": "BTC",
        "quoteCurrency": "USDT",
        "settleCurrency": "USDT",
        "type": "swap",
        "rawType": "swap",
        "costMin": 5.0,
        "amountMin": 0.001,
        "margin": true,
        "spot": false,
        "swap": true,
        "future": false,
        "option": false,
        "contract": true
      }
    ]
  },
  "usage": {"cost": 1, "quota": 99}
}
Display to user:
  • List available exchanges and trading pairs for the requested ticker
  • Highlight leverage range, min order size, and contract type (spot/swap/future)

获取指定交易对在所有交易所的市场元数据信息(交易对列表、合约类型、杠杆范围、最小下单量等)。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/market/metadata?ticker=BTC" \
  -H "$AUTH_HEADER"
参数:
字段类型必填描述
ticker
String(查询参数)基础币种代码(例如
BTC
ETH
SOL
返回结果:
json
{
  "success": true,
  "data": {
    "ticker": "BTC",
    "markets": [
      {
        "exchangeId": "binance",
        "id": "BTCUSDT",
        "symbol": "BTC/USDT",
        "displaySymbol": "BTC/USDT",
        "active": true,
        "leverageMin": 1,
        "leverageMax": 125,
        "baseCurrency": "BTC",
        "quoteCurrency": "USDT",
        "settleCurrency": "USDT",
        "type": "swap",
        "rawType": "swap",
        "costMin": 5.0,
        "amountMin": 0.001,
        "margin": true,
        "spot": false,
        "swap": true,
        "future": false,
        "option": false,
        "contract": true
      }
    ]
  },
  "usage": {"cost": 1, "quota": 99}
}
向用户展示内容:
  • 列出请求币种支持的交易所和交易对
  • 突出显示杠杆范围、最小下单量和合约类型(现货/永续/期货)

2. Get Ticker

2. 获取行情

获取指定交易所和交易对的实时行情数据。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/market/ticker?symbol=BTC/USDT&exchangeId=binance" \
  -H "$AUTH_HEADER"
Parameters:
FieldTypeRequiredDescription
symbol
String (query)YesTrading pair in CCXT format (e.g.,
BTC/USDT
)
exchangeId
String (query)YesExchange ID:
binance
,
bybit
,
okx
,
hyperliquid
Response:
json
{
  "success": true,
  "data": {
    "symbol": "BTC/USDT",
    "last": 67890.50,
    "bid": 67889.00,
    "ask": 67891.00,
    "high": 68500.00,
    "low": 66800.00,
    "volume": 12345.678,
    "timestamp": "2026-03-21T10:30:00Z"
  },
  "usage": {"cost": 1, "quota": 99}
}
Display to user:
  • "BTC/USDT: $67,890.50"
  • "Bid: $67,889 | Ask: $67,891"
  • "24h High: $68,500 | Low: $66,800 | Volume: 12,345.68 BTC"

获取指定交易所和交易对的实时行情数据。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/market/ticker?symbol=BTC/USDT&exchangeId=binance" \
  -H "$AUTH_HEADER"
参数:
字段类型必填描述
symbol
String(查询参数)CCXT格式的交易对(例如
BTC/USDT
exchangeId
String(查询参数)交易所ID:
binance
bybit
okx
hyperliquid
返回结果:
json
{
  "success": true,
  "data": {
    "symbol": "BTC/USDT",
    "last": 67890.50,
    "bid": 67889.00,
    "ask": 67891.00,
    "high": 68500.00,
    "low": 66800.00,
    "volume": 12345.678,
    "timestamp": "2026-03-21T10:30:00Z"
  },
  "usage": {"cost": 1, "quota": 99}
}
向用户展示内容:
  • "BTC/USDT: $67,890.50"
  • "买一价: $67,889 | 卖一价: $67,891"
  • "24小时最高价: $68,500 | 最低价: $66,800 | 成交量: 12,345.68 BTC"

3. Get K-Lines

3. 获取K线

获取 Binance K 线(蜡烛图)数据。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/market/klines?symbol=BTCUSDT&interval=1h&limit=100" \
  -H "$AUTH_HEADER"
Parameters:
FieldTypeRequiredDescription
symbol
String (query)NoTrading pair (default:
BTCUSDT
)
interval
String (query)NoK-line interval (default:
1m
):
1m
,
5m
,
15m
,
1h
,
4h
,
1d
, etc.
limit
Integer (query)NoNumber of candles (default: 100)
Response:
json
{
  "success": true,
  "data": [
    {
      "openTime": 1679400000000,
      "open": "67800.00",
      "high": "67900.00",
      "low": "67750.00",
      "close": "67850.00",
      "volume": "123.456",
      "closeTime": 1679400059999
    }
  ],
  "usage": {"cost": 1, "quota": 99}
}
Display to user:
  • Summarize recent price action (e.g., "BTC rose from $67,800 to $67,850 in the last hour")
  • Mention support/resistance levels if visible

获取 Binance K 线(蜡烛图)数据。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/market/klines?symbol=BTCUSDT&interval=1h&limit=100" \
  -H "$AUTH_HEADER"
参数:
字段类型必填描述
symbol
String(查询参数)交易对(默认:
BTCUSDT
interval
String(查询参数)K线周期(默认:
1m
):
1m
5m
15m
1h
4h
1d
limit
Integer(查询参数)K线数量(默认:100)
返回结果:
json
{
  "success": true,
  "data": [
    {
      "openTime": 1679400000000,
      "open": "67800.00",
      "high": "67900.00",
      "low": "67750.00",
      "close": "67850.00",
      "volume": "123.456",
      "closeTime": 1679400059999
    }
  ],
  "usage": {"cost": 1, "quota": 99}
}
向用户展示内容:
  • 总结近期价格走势(例如:"过去1小时BTC价格从$67,800上涨至$67,850")
  • 如果有明显的支撑/阻力位可以提及

4. Get Base Currencies

4. 获取基础币种列表

获取所有交易所支持的去重基础币种列表。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/market/base-currencies" \
  -H "$AUTH_HEADER"
Parameters: None
Response:
json
{
  "success": true,
  "data": ["BTC", "ETH", "SOL", "DOGE", "XRP"],
  "usage": {"cost": 1, "quota": 99}
}

获取所有交易所支持的去重基础币种列表。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/market/base-currencies" \
  -H "$AUTH_HEADER"
参数:
返回结果:
json
{
  "success": true,
  "data": ["BTC", "ETH", "SOL", "DOGE", "XRP"],
  "usage": {"cost": 1, "quota": 99}
}

5. Get Server Time

5. 获取服务器时间

获取 ai-bots-trading 服务器的当前时间。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/market/time" \
  -H "$AUTH_HEADER"
Parameters: None
Response:
json
{
  "timestamp": 1679400000000,
  "time": "2026-03-21T10:30:00Z",
  "usage": {"cost": 1, "quota": 99}
}

获取 ai-bots-trading 服务器的当前时间。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/market/time" \
  -H "$AUTH_HEADER"
参数:
返回结果:
json
{
  "timestamp": 1679400000000,
  "time": "2026-03-21T10:30:00Z",
  "usage": {"cost": 1, "quota": 99}
}

6. Get Account Summary

6. 获取账户摘要

获取指定交易所的账户余额摘要信息,包括总余额、可用余额、杠杆分析等。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/account/summary?exchangeId=binance&symbol=BTC/USDT:USDT&accountType=swap" \
  -H "$AUTH_HEADER"
Parameters:
FieldTypeRequiredDescription
exchangeId
String (query)YesExchange ID
symbol
String (query)NoTrading pair, for determining quote currency
accountType
String (query)NoAccount type (default:
spot
):
spot
,
swap
,
future
,
margin
Response:
json
{
  "success": true,
  "data": {
    "exchangeId": "binance",
    "accountType": "swap",
    "balance": 10000.00,
    "available": 8500.00,
    "currency": "USDT",
    "leverage": 10,
    "maxPosition": 85000.00,
    "totals": {
      "USDT": 10000.00,
      "BTC": 0.05
    },
    "frees": {
      "USDT": 8500.00,
      "BTC": 0.05
    },
    "leverageAnalysis": {
      "symbol": "BTC/USDT:USDT",
      "exchangeId": "binance",
      "availableBalance": 8500.00,
      "balanceCurrency": "USDT",
      "leverageInfo": {
        "exchangeId": "binance",
        "symbol": "BTC/USDT:USDT",
        "tiers": [],
        "supportsDynamicLeverage": true,
        "baseCurrency": "BTC",
        "quoteCurrency": "USDT",
        "settleCurrency": "USDT",
        "generatedAt": 1679400000000
      },
      "marketPrice": 67890.50
    }
  },
  "usage": {"cost": 1, "quota": 99}
}
Display to user:
  • "Total Balance: $10,000.00 USDT"
  • "Available: $8,500.00 | Leverage: 10x"
  • "Max Position: $85,000.00"

获取指定交易所的账户余额摘要信息,包括总余额、可用余额、杠杆分析等。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/account/summary?exchangeId=binance&symbol=BTC/USDT:USDT&accountType=swap" \
  -H "$AUTH_HEADER"
参数:
字段类型必填描述
exchangeId
String(查询参数)交易所ID
symbol
String(查询参数)交易对,用于确定计价币种
accountType
String(查询参数)账户类型(默认:
spot
):
spot
swap
future
margin
返回结果:
json
{
  "success": true,
  "data": {
    "exchangeId": "binance",
    "accountType": "swap",
    "balance": 10000.00,
    "available": 8500.00,
    "currency": "USDT",
    "leverage": 10,
    "maxPosition": 85000.00,
    "totals": {
      "USDT": 10000.00,
      "BTC": 0.05
    },
    "frees": {
      "USDT": 8500.00,
      "BTC": 0.05
    },
    "leverageAnalysis": {
      "symbol": "BTC/USDT:USDT",
      "exchangeId": "binance",
      "availableBalance": 8500.00,
      "balanceCurrency": "USDT",
      "leverageInfo": {
        "exchangeId": "binance",
        "symbol": "BTC/USDT:USDT",
        "tiers": [],
        "supportsDynamicLeverage": true,
        "baseCurrency": "BTC",
        "quoteCurrency": "USDT",
        "settleCurrency": "USDT",
        "generatedAt": 1679400000000
      },
      "marketPrice": 67890.50
    }
  },
  "usage": {"cost": 1, "quota": 99}
}
向用户展示内容:
  • "总余额: $10,000.00 USDT"
  • "可用余额: $8,500.00 | 杠杆: 10x"
  • "最大持仓额: $85,000.00"

7. Get Spot Asset

7. 获取现货资产

查询指定交易所和交易对的现货资产持有信息。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/account/spot?exchangeId=binance&symbol=BTC/USDT" \
  -H "$AUTH_HEADER"
Parameters:
FieldTypeRequiredDescription
exchangeId
String (query)YesExchange ID
symbol
String (query)YesTrading pair (e.g.,
BTC/USDT
)
Response:
json
{
  "success": true,
  "data": {
    "exchangeId": "binance",
    "symbol": "BTC/USDT",
    "baseAsset": "BTC",
    "quantity": 0.5,
    "free": 0.45,
    "locked": 0.05,
    "costPrice": 65000.00,
    "totalCost": 32500.00
  },
  "usage": {"cost": 1, "quota": 99}
}
Display to user:
  • "BTC: 0.5 (Free: 0.45, Locked: 0.05)"
  • "Avg Cost: $65,000 | Total Cost: $32,500"

查询指定交易所和交易对的现货资产持有信息。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/account/spot?exchangeId=binance&symbol=BTC/USDT" \
  -H "$AUTH_HEADER"
参数:
字段类型必填描述
exchangeId
String(查询参数)交易所ID
symbol
String(查询参数)交易对(例如
BTC/USDT
返回结果:
json
{
  "success": true,
  "data": {
    "exchangeId": "binance",
    "symbol": "BTC/USDT",
    "baseAsset": "BTC",
    "quantity": 0.5,
    "free": 0.45,
    "locked": 0.05,
    "costPrice": 65000.00,
    "totalCost": 32500.00
  },
  "usage": {"cost": 1, "quota": 99}
}
向用户展示内容:
  • "BTC: 0.5(可用: 0.45, 冻结: 0.05)"
  • "平均成本: $65,000 | 总成本: $32,500"

8. Get All Spot Assets

8. 获取所有现货资产

获取指定交易所的所有现货资产列表。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/account/spots?exchangeId=binance" \
  -H "$AUTH_HEADER"
Parameters:
FieldTypeRequiredDescription
exchangeId
String (query)YesExchange ID
symbol
String (query)NoFilter by trading pair
Response:
json
{
  "success": true,
  "data": [
    {
      "exchangeId": "binance",
      "symbol": null,
      "baseAsset": "BTC",
      "quantity": 0.5,
      "free": 0.45,
      "locked": 0.05,
      "costPrice": 65000.00,
      "totalCost": 32500.00
    },
    {
      "exchangeId": "binance",
      "symbol": null,
      "baseAsset": "USDT",
      "quantity": 10000.00,
      "free": 8500.00,
      "locked": 1500.00,
      "costPrice": 1.00,
      "totalCost": 10000.00
    }
  ],
  "usage": {"cost": 1, "quota": 99}
}
Display to user:
  • List all assets with non-zero balances, showing free/locked split and cost basis

获取指定交易所的所有现货资产列表。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/account/spots?exchangeId=binance" \
  -H "$AUTH_HEADER"
参数:
字段类型必填描述
exchangeId
String(查询参数)交易所ID
symbol
String(查询参数)按交易对过滤
返回结果:
json
{
  "success": true,
  "data": [
    {
      "exchangeId": "binance",
      "symbol": null,
      "baseAsset": "BTC",
      "quantity": 0.5,
      "free": 0.45,
      "locked": 0.05,
      "costPrice": 65000.00,
      "totalCost": 32500.00
    },
    {
      "exchangeId": "binance",
      "symbol": null,
      "baseAsset": "USDT",
      "quantity": 10000.00,
      "free": 8500.00,
      "locked": 1500.00,
      "costPrice": 1.00,
      "totalCost": 10000.00
    }
  ],
  "usage": {"cost": 1, "quota": 99}
}
向用户展示内容:
  • 列出所有余额不为零的资产,展示可用/冻结拆分和成本基准

9. Get Trading Config

9. 获取交易配置

获取用户的交易配置摘要(不包含密钥敏感信息)。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/config" \
  -H "$AUTH_HEADER"
Parameters: None
Response:
json
{
  "success": true,
  "data": {
    "defaultExchange": "binance",
    "defaultLeverage": 10,
    "defaultPosition": 100.0,
    "general": {},
    "binanceConfigured": true,
    "bybitConfigured": false,
    "okxConfigured": true,
    "hyperliquidConfigured": false,
    "asterConfigured": false
  },
  "usage": {"cost": 1, "quota": 99}
}
Display to user:
  • "Default Exchange: binance | Leverage: 10x | Position: $100"
  • List which exchanges are configured

获取用户的交易配置摘要(不包含密钥敏感信息)。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/config" \
  -H "$AUTH_HEADER"
参数:
返回结果:
json
{
  "success": true,
  "data": {
    "defaultExchange": "binance",
    "defaultLeverage": 10,
    "defaultPosition": 100.0,
    "general": {},
    "binanceConfigured": true,
    "bybitConfigured": false,
    "okxConfigured": true,
    "hyperliquidConfigured": false,
    "asterConfigured": false
  },
  "usage": {"cost": 1, "quota": 99}
}
向用户展示内容:
  • "默认交易所: binance | 杠杆: 10x | 持仓额: $100"
  • 列出已配置的交易所

10. Update Trading Config

10. 更新交易配置

更新用户的交易配置,包括默认交易所、杠杆和交易所凭证。
IMPORTANT: Exchange API credentials (
apiKey
,
secret
,
password
) are sensitive. Never log or display them.
bash
curl -s -X PUT "$BASE_URL/open/trader/newsliquid/v1/config" \
  -H "$AUTH_HEADER" -H "Content-Type: application/json" \
  -d '{
    "defaultExchange": "binance",
    "defaultLeverage": 10,
    "defaultPosition": 100.0,
    "binance": {
      "apiKey": "your-api-key",
      "secret": "your-api-secret",
      "password": ""
    }
  }'
Parameters (body):
FieldTypeRequiredDescription
defaultExchange
StringNoDefault exchange:
binance
,
bybit
,
okx
,
hyperliquid
defaultLeverage
IntegerNoDefault leverage (1-125)
defaultPosition
FloatNoDefault position size
general
ObjectNoGeneral config
binance
/
bybit
/
okx
/
hyperliquid
/
aster
ObjectNoExchange credentials:
apiKey
(required),
secret
(required),
password
(optional, OKX requires)
Response:
json
{
  "success": true,
  "data": {
    "updated": true
  },
  "usage": {"cost": 1, "quota": 99}
}

更新用户的交易配置,包括默认交易所、杠杆和交易所凭证。
重要提示:交易所API凭证(
apiKey
secret
password
)属于敏感信息,切勿记录或展示。
bash
curl -s -X PUT "$BASE_URL/open/trader/newsliquid/v1/config" \
  -H "$AUTH_HEADER" -H "Content-Type: application/json" \
  -d '{
    "defaultExchange": "binance",
    "defaultLeverage": 10,
    "defaultPosition": 100.0,
    "binance": {
      "apiKey": "your-api-key",
      "secret": "your-api-secret",
      "password": ""
    }
  }'
参数(请求体):
字段类型必填描述
defaultExchange
String默认交易所:
binance
bybit
okx
hyperliquid
defaultLeverage
Integer默认杠杆(1-125)
defaultPosition
Float默认持仓额
general
Object通用配置
binance
/
bybit
/
okx
/
hyperliquid
/
aster
Object交易所凭证:
apiKey
(必填)、
secret
(必填)、
password
(可选,OKX需要)
返回结果:
json
{
  "success": true,
  "data": {
    "updated": true
  },
  "usage": {"cost": 1, "quota": 99}
}

11. Place Order (Risk Controlled)

11. 下单(受风控)

在指定交易所下单。支持多种订单类型。
This endpoint is protected by the risk engine — orders that deviate too far from market price, exceed position limits, hit rate limits, or lack sufficient balance will be rejected.
bash
undefined
在指定交易所下单。支持多种订单类型。
该端点受风险引擎保护——与市场价格偏差过大、超出持仓限额、触发速率限制或余额不足的订单将被拒绝。
bash
undefined

Limit order: buy 0.01 BTC at $65,000 with TP/SL

限价单:以$65,000买入0.01 BTC,附带止盈止损

curl -s -X POST "$BASE_URL/open/trader/newsliquid/v1/orders"
-H "$AUTH_HEADER" -H "Content-Type: application/json"
-d '{ "exchangeId": "binance", "symbol": "BTC/USDT:USDT", "side": "buy", "type": "limit", "quantity": 0.01, "price": 65000.00, "stopLossPrice": 64000.00, "takeProfitPrice": 70000.00 }'
curl -s -X POST "$BASE_URL/open/trader/newsliquid/v1/orders"
-H "$AUTH_HEADER" -H "Content-Type: application/json"
-d '{ "exchangeId": "binance", "symbol": "BTC/USDT:USDT", "side": "buy", "type": "limit", "quantity": 0.01, "price": 65000.00, "stopLossPrice": 64000.00, "takeProfitPrice": 70000.00 }'

Market order: sell 0.5 ETH

市价单:卖出0.5 ETH

curl -s -X POST "$BASE_URL/open/trader/newsliquid/v1/orders"
-H "$AUTH_HEADER" -H "Content-Type: application/json"
-d '{ "exchangeId": "binance", "symbol": "ETH/USDT:USDT", "side": "sell", "type": "market", "quantity": 0.5 }'
curl -s -X POST "$BASE_URL/open/trader/newsliquid/v1/orders"
-H "$AUTH_HEADER" -H "Content-Type: application/json"
-d '{ "exchangeId": "binance", "symbol": "ETH/USDT:USDT", "side": "sell", "type": "market", "quantity": 0.5 }'

Stop-loss market order

止损市价单

curl -s -X POST "$BASE_URL/open/trader/newsliquid/v1/orders"
-H "$AUTH_HEADER" -H "Content-Type: application/json"
-d '{ "exchangeId": "binance", "symbol": "BTC/USDT:USDT", "side": "sell", "type": "stop_market", "quantity": 0.01, "triggerPrice": 58000.00 }'

**Parameters (body):**

| Field | Type | Required | Description |
|---|---|---|---|
| `exchangeId` | String | No | Exchange ID (default: `binance`) |
| `symbol` | String | Yes | Trading pair in CCXT format (e.g., `BTC/USDT:USDT`) |
| `side` | String | Yes | `buy` or `sell` |
| `type` | String | Yes | Order type (see below) |
| `quantity` | Float | Conditional | Base currency quantity |
| `quoteAmount` | Float | Conditional | Quote currency amount (e.g., USDT) |
| `price` | Float | Conditional | Limit price, required for `limit`, `stop_limit`, `take_profit_limit` |
| `triggerPrice` | Float | Conditional | Trigger price, required for `stop_market`, `stop_limit`, `take_profit_market`, `take_profit_limit` |
| `hedged` | Boolean | No | Hedge mode (default: `false`) |
| `stopLossPrice` | Float | No | Attached stop-loss trigger price |
| `takeProfitPrice` | Float | No | Attached take-profit trigger price |

**Order types:**
- `market` — Market order
- `limit` — Limit order
- `oco` — OCO order
- `stop_market` — Stop-loss market order
- `stop_limit` — Stop-loss limit order
- `take_profit_market` — Take-profit market order
- `take_profit_limit` — Take-profit limit order

**Response:**
```json
{
  "success": true,
  "data": {
    "exchange": "binance",
    "orderId": "123456789",
    "symbol": "BTC/USDT:USDT",
    "side": "buy",
    "type": "limit",
    "amount": 0.01,
    "price": 65000.00,
    "triggerPrice": 0,
    "status": "open",
    "filledQty": 0,
    "avgPrice": 0,
    "reduceOnly": false,
    "createdAt": "2026-03-21T10:30:00Z",
    "tpsl": {
      "tpTriggerPx": 70000.00,
      "tpTriggerPxType": "last",
      "tpOrdPx": -1,
      "slTriggerPx": 64000.00,
      "slTriggerPxType": "last",
      "slOrdPx": -1,
      "attachId": "attach_001",
      "closePosition": false
    }
  },
  "usage": {"cost": 1, "quota": 99}
}
Display to user:
  • "Order placed! ID: 123456789"
  • "Buy 0.01 BTC @ $65,000 (Limit) on Binance"
  • "TP: $70,000 | SL: $64,000"
  • "Status: Open"

curl -s -X POST "$BASE_URL/open/trader/newsliquid/v1/orders"
-H "$AUTH_HEADER" -H "Content-Type: application/json"
-d '{ "exchangeId": "binance", "symbol": "BTC/USDT:USDT", "side": "sell", "type": "stop_market", "quantity": 0.01, "triggerPrice": 58000.00 }'

**参数(请求体):**

| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
| `exchangeId` | String | 否 | 交易所ID(默认:`binance`) |
| `symbol` | String | 是 | CCXT格式的交易对(例如`BTC/USDT:USDT`) |
| `side` | String | 是 | `buy`(买)或`sell`(卖) |
| `type` | String | 是 | 订单类型(见下方) |
| `quantity` | Float | 条件必填 | 基础币种数量 |
| `quoteAmount` | Float | 条件必填 | 计价币种金额(例如USDT) |
| `price` | Float | 条件必填 | 限价,`limit`、`stop_limit`、`take_profit_limit`类型订单必填 |
| `triggerPrice` | Float | 条件必填 | 触发价格,`stop_market`、`stop_limit`、`take_profit_market`、`take_profit_limit`类型订单必填 |
| `hedged` | Boolean | 否 | 对冲模式(默认:`false`) |
| `stopLossPrice` | Float | 否 | 附带的止损触发价格 |
| `takeProfitPrice` | Float | 否 | 附带的止盈触发价格 |

**订单类型:**
- `market` — 市价单
- `limit` — 限价单
- `oco` — OCO订单
- `stop_market` — 止损市价单
- `stop_limit` — 止损限价单
- `take_profit_market` — 止盈市价单
- `take_profit_limit` — 止盈限价单

**返回结果:**
```json
{
  "success": true,
  "data": {
    "exchange": "binance",
    "orderId": "123456789",
    "symbol": "BTC/USDT:USDT",
    "side": "buy",
    "type": "limit",
    "amount": 0.01,
    "price": 65000.00,
    "triggerPrice": 0,
    "status": "open",
    "filledQty": 0,
    "avgPrice": 0,
    "reduceOnly": false,
    "createdAt": "2026-03-21T10:30:00Z",
    "tpsl": {
      "tpTriggerPx": 70000.00,
      "tpTriggerPxType": "last",
      "tpOrdPx": -1,
      "slTriggerPx": 64000.00,
      "slTriggerPxType": "last",
      "slOrdPx": -1,
      "attachId": "attach_001",
      "closePosition": false
    }
  },
  "usage": {"cost": 1, "quota": 99}
}
向用户展示内容:
  • "订单已提交!ID: 123456789"
  • "在Binance以$65,000(限价)买入0.01 BTC"
  • "止盈: $70,000 | 止损: $64,000"
  • "状态: 未成交"

12. Edit Order (Risk Controlled)

12. 编辑订单(受风控)

修改已存在的挂单参数。
This endpoint is protected by the risk engine.
bash
curl -s -X PUT "$BASE_URL/open/trader/newsliquid/v1/orders/edit" \
  -H "$AUTH_HEADER" -H "Content-Type: application/json" \
  -d '{
    "exchangeId": "binance",
    "orderId": "123456789",
    "symbol": "BTC/USDT:USDT",
    "type": "limit",
    "side": "buy",
    "quantity": 0.02,
    "price": 64500.00
  }'
Parameters (body):
FieldTypeRequiredDescription
exchangeId
StringYesExchange ID
orderId
StringNoOrder ID (Binance TP/SL orders can omit)
symbol
StringYesTrading pair
type
StringNoOrder type
side
StringNoDirection
quantity
FloatNoNew quantity
price
FloatNoNew limit price
triggerPrice
FloatNoNew trigger price
stopLossPrice
FloatNoNew stop-loss price
takeProfitPrice
FloatNoNew take-profit price
hedged
BooleanNoHedge mode
Response: Same
OrderResponse
structure as Place Order.

修改已存在的挂单参数。
该端点受风险引擎保护。
bash
curl -s -X PUT "$BASE_URL/open/trader/newsliquid/v1/orders/edit" \
  -H "$AUTH_HEADER" -H "Content-Type: application/json" \
  -d '{
    "exchangeId": "binance",
    "orderId": "123456789",
    "symbol": "BTC/USDT:USDT",
    "type": "limit",
    "side": "buy",
    "quantity": 0.02,
    "price": 64500.00
  }'
参数(请求体):
字段类型必填描述
exchangeId
String交易所ID
orderId
String订单ID(Binance止盈止损订单可省略)
symbol
String交易对
type
String订单类型
side
String交易方向
quantity
Float新的数量
price
Float新的限价
triggerPrice
Float新的触发价格
stopLossPrice
Float新的止损价格
takeProfitPrice
Float新的止盈价格
hedged
Boolean对冲模式
返回结果: 与下单接口的
OrderResponse
结构相同。

13. Cancel Order

13. 取消订单

取消指定的挂单。
bash
curl -s -X DELETE "$BASE_URL/open/trader/newsliquid/v1/orders/123456789?exchangeId=binance&symbol=BTC/USDT:USDT" \
  -H "$AUTH_HEADER"
Parameters:
FieldTypeRequiredDescription
orderId
String (path)YesOrder ID (in URL path)
exchangeId
String (query)YesExchange ID
symbol
String (query)YesTrading pair
type
String (query)NoOrder type (required for TP/SL orders)
Response:
json
{
  "success": true,
  "data": {
    "cancelled": true
  },
  "usage": {"cost": 1, "quota": 99}
}

取消指定的挂单。
bash
curl -s -X DELETE "$BASE_URL/open/trader/newsliquid/v1/orders/123456789?exchangeId=binance&symbol=BTC/USDT:USDT" \
  -H "$AUTH_HEADER"
参数:
字段类型必填描述
orderId
String(路径参数)订单ID(在URL路径中)
exchangeId
String(查询参数)交易所ID
symbol
String(查询参数)交易对
type
String(查询参数)订单类型(止盈止损订单必填)
返回结果:
json
{
  "success": true,
  "data": {
    "cancelled": true
  },
  "usage": {"cost": 1, "quota": 99}
}

14. List Open Orders

14. 列出未成交订单

获取当前所有未成交的挂单。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/orders/open?exchangeId=binance&symbol=BTC/USDT:USDT" \
  -H "$AUTH_HEADER"
Parameters:
FieldTypeRequiredDescription
exchangeId
String (query)NoExchange ID (omit for all exchanges)
symbol
String (query)NoFilter by trading pair
days
Integer (query)NoFilter by creation time (days)
Response:
json
{
  "success": true,
  "data": [
    {
      "exchange": "binance",
      "orderId": "123456789",
      "symbol": "BTC/USDT:USDT",
      "side": "buy",
      "type": "limit",
      "amount": 0.01,
      "price": 65000.00,
      "triggerPrice": 0,
      "status": "open",
      "filledQty": 0,
      "avgPrice": 0,
      "reduceOnly": false,
      "createdAt": "2026-03-21T10:30:00Z",
      "tpsl": null
    }
  ],
  "usage": {"cost": 1, "quota": 99}
}
Display to user:
  • Table of open orders with exchange, ID, pair, side, type, amount, price, status

获取当前所有未成交的挂单。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/orders/open?exchangeId=binance&symbol=BTC/USDT:USDT" \
  -H "$AUTH_HEADER"
参数:
字段类型必填描述
exchangeId
String(查询参数)交易所ID(省略则查询所有交易所)
symbol
String(查询参数)按交易对过滤
days
Integer(查询参数)按创建时间过滤(天)
返回结果:
json
{
  "success": true,
  "data": [
    {
      "exchange": "binance",
      "orderId": "123456789",
      "symbol": "BTC/USDT:USDT",
      "side": "buy",
      "type": "limit",
      "amount": 0.01,
      "price": 65000.00,
      "triggerPrice": 0,
      "status": "open",
      "filledQty": 0,
      "avgPrice": 0,
      "reduceOnly": false,
      "createdAt": "2026-03-21T10:30:00Z",
      "tpsl": null
    }
  ],
  "usage": {"cost": 1, "quota": 99}
}
向用户展示内容:
  • 以表格形式展示未成交订单,包含交易所、ID、交易对、方向、类型、数量、价格、状态

15. List Closed Orders

15. 列出已完成订单

获取已完成(成交/取消)的历史订单。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/orders/closed?exchangeId=binance&symbol=BTC/USDT:USDT&days=7" \
  -H "$AUTH_HEADER"
Parameters:
FieldTypeRequiredDescription
exchangeId
String (query)NoExchange ID (omit for all exchanges)
symbol
String (query)NoFilter by trading pair
days
Integer (query)NoFilter by days (default: 7)
Response: Same
[]OrderResponse
structure as List Open Orders.

获取已完成(成交/取消)的历史订单。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/orders/closed?exchangeId=binance&symbol=BTC/USDT:USDT&days=7" \
  -H "$AUTH_HEADER"
参数:
字段类型必填描述
exchangeId
String(查询参数)交易所ID(省略则查询所有交易所)
symbol
String(查询参数)按交易对过滤
days
Integer(查询参数)按天数过滤(默认:7)
返回结果: 与未成交订单列表的
[]OrderResponse
结构相同。

16. List Current Positions

16. 列出当前持仓

获取当前所有持仓信息。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/positions?exchangeId=binance" \
  -H "$AUTH_HEADER"
Parameters:
FieldTypeRequiredDescription
exchangeId
String (query)NoExchange ID (omit for all exchanges)
symbol
String (query)NoFilter by trading pair
Response:
json
{
  "success": true,
  "data": [
    {
      "exchange": "binance",
      "symbol": "BTC/USDT:USDT",
      "side": "long",
      "contracts": 0.01,
      "entryPrice": 65000.00,
      "markPrice": 67890.50,
      "unrealizedPnl": 28.905,
      "leverage": 10,
      "liquidationPrice": 58500.00,
      "marginMode": "cross",
      "hedged": false,
      "timestamp": 1679400000000
    }
  ],
  "usage": {"cost": 1, "quota": 99}
}
Display to user:
  • "BTC/USDT:USDT Long 0.01 BTC (Binance)"
  • "Entry: $65,000 | Mark: $67,890.50"
  • "P&L: +$28.91 (+4.45%)"
  • "Leverage: 10x Cross | Liq: $58,500"

获取当前所有持仓信息。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/positions?exchangeId=binance" \
  -H "$AUTH_HEADER"
参数:
字段类型必填描述
exchangeId
String(查询参数)交易所ID(省略则查询所有交易所)
symbol
String(查询参数)按交易对过滤
返回结果:
json
{
  "success": true,
  "data": [
    {
      "exchange": "binance",
      "symbol": "BTC/USDT:USDT",
      "side": "long",
      "contracts": 0.01,
      "entryPrice": 65000.00,
      "markPrice": 67890.50,
      "unrealizedPnl": 28.905,
      "leverage": 10,
      "liquidationPrice": 58500.00,
      "marginMode": "cross",
      "hedged": false,
      "timestamp": 1679400000000
    }
  ],
  "usage": {"cost": 1, "quota": 99}
}
向用户展示内容:
  • "BTC/USDT:USDT 多仓 0.01 BTC(Binance)"
  • "开仓价: $65,000 | 标记价格: $67,890.50"
  • "未实现盈亏: +$28.91 (+4.45%)"
  • "杠杆: 10x 全仓 | 爆仓价: $58,500"

17. List Historical Positions

17. 列出历史持仓

获取已平仓的历史持仓记录(包含关联的交易明细)。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/positions/history?exchangeId=binance&days=7" \
  -H "$AUTH_HEADER"
Parameters:
FieldTypeRequiredDescription
exchangeId
String (query)NoExchange ID
symbol
String (query)NoFilter by trading pair
days
Integer (query)NoFilter by days (default: 0 = all)
Response:
json
{
  "success": true,
  "data": [
    {
      "exchange": "binance",
      "symbol": "BTC/USDT:USDT",
      "side": "long",
      "marginMode": "cross",
      "leverage": 10,
      "entryPrice": 65000.00,
      "openDateTime": "2026-03-20T08:00:00Z",
      "openTimestamp": 1679313600000,
      "closePrice": 67500.00,
      "fullyClosed": true,
      "closeDateTime": "2026-03-21T10:30:00Z",
      "closeTimestamp": 1679400600000,
      "closedAmount": 0.01,
      "totalAmount": 0.01,
      "realizedPnl": 25.00,
      "totalFee": 1.30,
      "tradeCount": 2,
      "openTrades": 1,
      "closeTrades": 1,
      "trades": [
        {
          "exchange": "binance",
          "tradeId": "trade_001",
          "orderId": "order_001",
          "symbol": "BTC/USDT:USDT",
          "side": "buy",
          "price": 65000.00,
          "amount": 0.01,
          "cost": 650.00,
          "fee": 0.65,
          "pnl": 0,
          "reduceOnly": false,
          "timestamp": 1679313600000,
          "datetime": "2026-03-20T08:00:00Z"
        },
        {
          "exchange": "binance",
          "tradeId": "trade_002",
          "orderId": "order_002",
          "symbol": "BTC/USDT:USDT",
          "side": "sell",
          "price": 67500.00,
          "amount": 0.01,
          "cost": 675.00,
          "fee": 0.65,
          "pnl": 25.00,
          "reduceOnly": true,
          "timestamp": 1679400600000,
          "datetime": "2026-03-21T10:30:00Z"
        }
      ]
    }
  ],
  "usage": {"cost": 1, "quota": 99}
}
Display to user:
  • "BTC/USDT:USDT Long — Closed"
  • "Entry: $65,000 → Exit: $67,500"
  • "Realized P&L: +$25.00 (Fee: $1.30)"
  • "Duration: ~26.5 hours"

获取已平仓的历史持仓记录(包含关联的交易明细)。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/positions/history?exchangeId=binance&days=7" \
  -H "$AUTH_HEADER"
参数:
字段类型必填描述
exchangeId
String(查询参数)交易所ID
symbol
String(查询参数)按交易对过滤
days
Integer(查询参数)按天数过滤(默认:0 = 全部)
返回结果:
json
{
  "success": true,
  "data": [
    {
      "exchange": "binance",
      "symbol": "BTC/USDT:USDT",
      "side": "long",
      "marginMode": "cross",
      "leverage": 10,
      "entryPrice": 65000.00,
      "openDateTime": "2026-03-20T08:00:00Z",
      "openTimestamp": 1679313600000,
      "closePrice": 67500.00,
      "fullyClosed": true,
      "closeDateTime": "2026-03-21T10:30:00Z",
      "closeTimestamp": 1679400600000,
      "closedAmount": 0.01,
      "totalAmount": 0.01,
      "realizedPnl": 25.00,
      "totalFee": 1.30,
      "tradeCount": 2,
      "openTrades": 1,
      "closeTrades": 1,
      "trades": [
        {
          "exchange": "binance",
          "tradeId": "trade_001",
          "orderId": "order_001",
          "symbol": "BTC/USDT:USDT",
          "side": "buy",
          "price": 65000.00,
          "amount": 0.01,
          "cost": 650.00,
          "fee": 0.65,
          "pnl": 0,
          "reduceOnly": false,
          "timestamp": 1679313600000,
          "datetime": "2026-03-20T08:00:00Z"
        },
        {
          "exchange": "binance",
          "tradeId": "trade_002",
          "orderId": "order_002",
          "symbol": "BTC/USDT:USDT",
          "side": "sell",
          "price": 67500.00,
          "amount": 0.01,
          "cost": 675.00,
          "fee": 0.65,
          "pnl": 25.00,
          "reduceOnly": true,
          "timestamp": 1679400600000,
          "datetime": "2026-03-21T10:30:00Z"
        }
      ]
    }
  ],
  "usage": {"cost": 1, "quota": 99}
}
向用户展示内容:
  • "BTC/USDT:USDT 多仓 — 已平仓"
  • "开仓价: $65,000 → 平仓价: $67,500"
  • "已实现盈亏: +$25.00(手续费: $1.30)"
  • "持仓时长: ~26.5小时"

18. Close Position (Risk Controlled)

18. 平仓(受风控)

关闭指定的持仓(全部或部分平仓)。
This endpoint is protected by the risk engine.
bash
curl -s -X POST "$BASE_URL/open/trader/newsliquid/v1/positions/close" \
  -H "$AUTH_HEADER" -H "Content-Type: application/json" \
  -d '{
    "exchangeId": "binance",
    "symbol": "BTC/USDT:USDT",
    "side": "long",
    "quantity": 0,
    "hedged": false
  }'
Parameters (body):
FieldTypeRequiredDescription
exchangeId
StringYesExchange ID
symbol
StringYesTrading pair
side
StringYesPosition side:
long
or
short
quantity
FloatNoClose quantity (0 = close all)
hedged
BooleanNoHedge mode
price
FloatNoMarket price for Hyperliquid
Response: Same
OrderResponse
structure as Place Order.
Display to user:
  • "Position closed! BTC/USDT:USDT Long"
  • Show realized P&L from the order response

关闭指定的持仓(全部或部分平仓)。
该端点受风险引擎保护。
bash
curl -s -X POST "$BASE_URL/open/trader/newsliquid/v1/positions/close" \
  -H "$AUTH_HEADER" -H "Content-Type: application/json" \
  -d '{
    "exchangeId": "binance",
    "symbol": "BTC/USDT:USDT",
    "side": "long",
    "quantity": 0,
    "hedged": false
  }'
参数(请求体):
字段类型必填描述
exchangeId
String交易所ID
symbol
String交易对
side
String持仓方向:
long
(多仓)或
short
(空仓)
quantity
Float平仓数量(0 = 全部平仓)
hedged
Boolean对冲模式
price
FloatHyperliquid的市价
返回结果: 与下单接口的
OrderResponse
结构相同。
向用户展示内容:
  • "持仓已平仓!BTC/USDT:USDT 多仓"
  • 展示订单返回结果中的已实现盈亏

19. Get Trade History

19. 获取交易历史

获取历史成交记录。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/trades/history?exchangeId=binance&symbol=BTC/USDT:USDT&days=7" \
  -H "$AUTH_HEADER"
Parameters:
FieldTypeRequiredDescription
exchangeId
String (query)NoExchange ID
symbol
String (query)NoFilter by trading pair
days
Integer (query)NoFilter by days (default: 7)
Response:
json
{
  "success": true,
  "data": [
    {
      "exchange": "binance",
      "tradeId": "trade_001",
      "orderId": "order_001",
      "symbol": "BTC/USDT:USDT",
      "side": "buy",
      "price": 65000.00,
      "amount": 0.01,
      "cost": 650.00,
      "fee": 0.65,
      "pnl": 0,
      "reduceOnly": false,
      "timestamp": 1679313600000,
      "datetime": "2026-03-20T08:00:00Z"
    }
  ],
  "usage": {"cost": 1, "quota": 99}
}
Display to user:
  • Table of trades with exchange, pair, side, price, amount, cost, fee, P&L

获取历史成交记录。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/trades/history?exchangeId=binance&symbol=BTC/USDT:USDT&days=7" \
  -H "$AUTH_HEADER"
参数:
字段类型必填描述
exchangeId
String(查询参数)交易所ID
symbol
String(查询参数)按交易对过滤
days
Integer(查询参数)按天数过滤(默认:7)
返回结果:
json
{
  "success": true,
  "data": [
    {
      "exchange": "binance",
      "tradeId": "trade_001",
      "orderId": "order_001",
      "symbol": "BTC/USDT:USDT",
      "side": "buy",
      "price": 65000.00,
      "amount": 0.01,
      "cost": 650.00,
      "fee": 0.65,
      "pnl": 0,
      "reduceOnly": false,
      "timestamp": 1679313600000,
      "datetime": "2026-03-20T08:00:00Z"
    }
  ],
  "usage": {"cost": 1, "quota": 99}
}
向用户展示内容:
  • 以表格形式展示交易记录,包含交易所、交易对、方向、价格、数量、成本、手续费、盈亏

20. Get Leverage Tiers

20. 获取杠杆档位

获取指定交易对的杠杆档位(梯度)信息。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/leverage?symbol=BTC/USDT:USDT&exchangeId=binance" \
  -H "$AUTH_HEADER"
Parameters:
FieldTypeRequiredDescription
symbol
String (query)YesTrading pair
exchangeId
String (query)YesExchange ID
Response:
json
{
  "success": true,
  "data": {
    "exchangeId": "binance",
    "symbol": "BTC/USDT:USDT",
    "tiers": [
      {
        "tier": 1,
        "minNotional": 0,
        "maxNotional": 50000,
        "maintenanceMarginRate": 0.004,
        "initialMarginRate": 0.01,
        "maxLeverage": 100
      },
      {
        "tier": 2,
        "minNotional": 50000,
        "maxNotional": 250000,
        "maintenanceMarginRate": 0.005,
        "initialMarginRate": 0.02,
        "maxLeverage": 50
      }
    ],
    "supportsDynamicLeverage": true,
    "baseCurrency": "BTC",
    "quoteCurrency": "USDT",
    "settleCurrency": "USDT",
    "minNotional": 5.0,
    "generatedAt": 1679400000000
  },
  "usage": {"cost": 1, "quota": 99}
}
Display to user:
  • Table of leverage tiers with max leverage, notional range, and margin rates

获取指定交易对的杠杆档位(梯度)信息。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/leverage?symbol=BTC/USDT:USDT&exchangeId=binance" \
  -H "$AUTH_HEADER"
参数:
字段类型必填描述
symbol
String(查询参数)交易对
exchangeId
String(查询参数)交易所ID
返回结果:
json
{
  "success": true,
  "data": {
    "exchangeId": "binance",
    "symbol": "BTC/USDT:USDT",
    "tiers": [
      {
        "tier": 1,
        "minNotional": 0,
        "maxNotional": 50000,
        "maintenanceMarginRate": 0.004,
        "initialMarginRate": 0.01,
        "maxLeverage": 100
      },
      {
        "tier": 2,
        "minNotional": 50000,
        "maxNotional": 250000,
        "maintenanceMarginRate": 0.005,
        "initialMarginRate": 0.02,
        "maxLeverage": 50
      }
    ],
    "supportsDynamicLeverage": true,
    "baseCurrency": "BTC",
    "quoteCurrency": "USDT",
    "settleCurrency": "USDT",
    "minNotional": 5.0,
    "generatedAt": 1679400000000
  },
  "usage": {"cost": 1, "quota": 99}
}
向用户展示内容:
  • 以表格形式展示杠杆档位,包含最大杠杆、名义价值范围和保证金率

21. Get Current Leverage

21. 获取当前杠杆

获取指定交易对当前设置的杠杆倍数和保证金模式。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/leverage/current?symbol=BTC/USDT:USDT&exchangeId=binance" \
  -H "$AUTH_HEADER"
Parameters:
FieldTypeRequiredDescription
symbol
String (query)YesTrading pair
exchangeId
String (query)YesExchange ID
Response:
json
{
  "success": true,
  "data": {
    "leverage": 10,
    "marginMode": "cross"
  },
  "usage": {"cost": 1, "quota": 99}
}
Display to user:
  • "BTC/USDT:USDT: 10x leverage, Cross margin"

获取指定交易对当前设置的杠杆倍数和保证金模式。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/leverage/current?symbol=BTC/USDT:USDT&exchangeId=binance" \
  -H "$AUTH_HEADER"
参数:
字段类型必填描述
symbol
String(查询参数)交易对
exchangeId
String(查询参数)交易所ID
返回结果:
json
{
  "success": true,
  "data": {
    "leverage": 10,
    "marginMode": "cross"
  },
  "usage": {"cost": 1, "quota": 99}
}
向用户展示内容:
  • "BTC/USDT:USDT: 10倍杠杆,全仓保证金"

22. Set Leverage (Risk Controlled)

22. 设置杠杆(受风控)

设置指定交易对的杠杆倍数。
This endpoint is protected by the risk engine.
bash
curl -s -X PUT "$BASE_URL/open/trader/newsliquid/v1/leverage/current" \
  -H "$AUTH_HEADER" -H "Content-Type: application/json" \
  -d '{"exchangeId":"binance","symbol":"BTC/USDT:USDT","leverage":20}'
Parameters (body):
FieldTypeRequiredDescription
exchangeId
StringYesExchange ID
symbol
StringYesTrading pair
leverage
IntegerYesLeverage multiplier (min: 1)
Response:
json
{
  "success": true,
  "data": {
    "updated": true
  },
  "usage": {"cost": 1, "quota": 99}
}
Display to user:
  • "Leverage updated! BTC/USDT:USDT: 20x"

设置指定交易对的杠杆倍数。
该端点受风险引擎保护。
bash
curl -s -X PUT "$BASE_URL/open/trader/newsliquid/v1/leverage/current" \
  -H "$AUTH_HEADER" -H "Content-Type: application/json" \
  -d '{"exchangeId":"binance","symbol":"BTC/USDT:USDT","leverage":20}'
参数(请求体):
字段类型必填描述
exchangeId
String交易所ID
symbol
String交易对
leverage
Integer杠杆倍数(最小:1)
返回结果:
json
{
  "success": true,
  "data": {
    "updated": true
  },
  "usage": {"cost": 1, "quota": 99}
}
向用户展示内容:
  • "杠杆已更新!BTC/USDT:USDT: 20x"

23. Get Margin Mode

23. 获取保证金模式

获取指定交易对的保证金模式(cross 全仓 / isolated 逐仓)。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/margin/mode?symbol=BTC/USDT:USDT&exchangeId=binance" \
  -H "$AUTH_HEADER"
Parameters:
FieldTypeRequiredDescription
symbol
String (query)YesTrading pair
exchangeId
String (query)YesExchange ID
Response:
json
{
  "success": true,
  "data": {
    "marginMode": "cross"
  },
  "usage": {"cost": 1, "quota": 99}
}

获取指定交易对的保证金模式(cross 全仓 / isolated 逐仓)。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/margin/mode?symbol=BTC/USDT:USDT&exchangeId=binance" \
  -H "$AUTH_HEADER"
参数:
字段类型必填描述
symbol
String(查询参数)交易对
exchangeId
String(查询参数)交易所ID
返回结果:
json
{
  "success": true,
  "data": {
    "marginMode": "cross"
  },
  "usage": {"cost": 1, "quota": 99}
}

24. Get Position Mode

24. 获取持仓模式

获取指定交易对的持仓模式(单向/双向)。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/position/mode?symbol=BTC/USDT:USDT&exchangeId=binance" \
  -H "$AUTH_HEADER"
Parameters:
FieldTypeRequiredDescription
symbol
String (query)YesTrading pair
exchangeId
String (query)YesExchange ID
Response:
json
{
  "success": true,
  "data": {
    "hedged": false,
    "positionMode": "one_way"
  },
  "usage": {"cost": 1, "quota": 99}
}

获取指定交易对的持仓模式(单向/双向)。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/position/mode?symbol=BTC/USDT:USDT&exchangeId=binance" \
  -H "$AUTH_HEADER"
参数:
字段类型必填描述
symbol
String(查询参数)交易对
exchangeId
String(查询参数)交易所ID
返回结果:
json
{
  "success": true,
  "data": {
    "hedged": false,
    "positionMode": "one_way"
  },
  "usage": {"cost": 1, "quota": 99}
}

25. Set Position Mode

25. 设置持仓模式

设置指定交易对的持仓模式。
bash
curl -s -X PUT "$BASE_URL/open/trader/newsliquid/v1/position/mode" \
  -H "$AUTH_HEADER" -H "Content-Type: application/json" \
  -d '{"exchangeId":"binance","symbol":"BTC/USDT:USDT","hedged":true}'
Parameters (body):
FieldTypeRequiredDescription
exchangeId
StringYesExchange ID
symbol
StringYesTrading pair
hedged
BooleanYes
true
= Hedge Mode (two-way),
false
= One-way Mode
Response:
json
{
  "success": true,
  "data": {
    "updated": true
  },
  "usage": {"cost": 1, "quota": 99}
}
Display to user:
  • "Position mode updated to Hedge (two-way)"

设置指定交易对的持仓模式。
bash
curl -s -X PUT "$BASE_URL/open/trader/newsliquid/v1/position/mode" \
  -H "$AUTH_HEADER" -H "Content-Type: application/json" \
  -d '{"exchangeId":"binance","symbol":"BTC/USDT:USDT","hedged":true}'
参数(请求体):
字段类型必填描述
exchangeId
String交易所ID
symbol
String交易对
hedged
Boolean
true
= 对冲模式(双向),
false
= 单向模式
返回结果:
json
{
  "success": true,
  "data": {
    "updated": true
  },
  "usage": {"cost": 1, "quota": 99}
}
向用户展示内容:
  • "持仓模式已更新为对冲(双向)模式"

26. Create Wallet Agent

26. 创建钱包代理

创建一个新的以太坊钱包代理(用于 Aster 或 Hyperliquid 交易)。
bash
curl -s -X POST "$BASE_URL/open/trader/newsliquid/v1/walletagent/create" \
  -H "$AUTH_HEADER" -H "Content-Type: application/json" \
  -d '{"exchange":"hyperliquid"}'
Parameters (body):
FieldTypeRequiredDescription
exchange
StringYesExchange type:
aster
or
hyperliquid
Response:
json
{
  "success": true,
  "data": {
    "id": 1,
    "userId": "user_001",
    "agentAddress": "0x1234567890abcdef...",
    "userAddress": "",
    "exchange": "hyperliquid",
    "authorized": false,
    "createdAt": "2026-03-21T10:30:00Z",
    "updatedAt": "2026-03-21T10:30:00Z"
  },
  "usage": {"cost": 1, "quota": 99}
}
Display to user:
  • "Wallet agent created!"
  • "Agent Address: 0x1234..."
  • "Exchange: Hyperliquid"
  • "Status: Not authorized (run authorize to activate)"

创建一个新的以太坊钱包代理(用于Aster或Hyperliquid交易)。
bash
curl -s -X POST "$BASE_URL/open/trader/newsliquid/v1/walletagent/create" \
  -H "$AUTH_HEADER" -H "Content-Type: application/json" \
  -d '{"exchange":"hyperliquid"}'
参数(请求体):
字段类型必填描述
exchange
String交易所类型:
aster
hyperliquid
返回结果:
json
{
  "success": true,
  "data": {
    "id": 1,
    "userId": "user_001",
    "agentAddress": "0x1234567890abcdef...",
    "userAddress": "",
    "exchange": "hyperliquid",
    "authorized": false,
    "createdAt": "2026-03-21T10:30:00Z",
    "updatedAt": "2026-03-21T10:30:00Z"
  },
  "usage": {"cost": 1, "quota": 99}
}
向用户展示内容:
  • "钱包代理已创建!"
  • "代理地址: 0x1234..."
  • "交易所: Hyperliquid"
  • "状态: 未授权(运行授权接口激活)"

27. List Wallet Agents

27. 列出钱包代理

获取当前用户的所有钱包代理列表。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/walletagent/list?exchange=hyperliquid" \
  -H "$AUTH_HEADER"
Parameters:
FieldTypeRequiredDescription
exchange
String (query)NoFilter by exchange type:
aster
or
hyperliquid
Response:
json
{
  "success": true,
  "data": [
    {
      "id": 1,
      "userId": "user_001",
      "agentAddress": "0x1234567890abcdef...",
      "userAddress": "0xabcdef1234567890...",
      "exchange": "hyperliquid",
      "authorized": true,
      "expiredAt": 1681992600000,
      "createdAt": "2026-03-21T10:30:00Z",
      "updatedAt": "2026-03-21T10:30:00Z"
    }
  ],
  "usage": {"cost": 1, "quota": 99}
}

获取当前用户的所有钱包代理列表。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/walletagent/list?exchange=hyperliquid" \
  -H "$AUTH_HEADER"
参数:
字段类型必填描述
exchange
String(查询参数)按交易所类型过滤:
aster
hyperliquid
返回结果:
json
{
  "success": true,
  "data": [
    {
      "id": 1,
      "userId": "user_001",
      "agentAddress": "0x1234567890abcdef...",
      "userAddress": "0xabcdef1234567890...",
      "exchange": "hyperliquid",
      "authorized": true,
      "expiredAt": 1681992600000,
      "createdAt": "2026-03-21T10:30:00Z",
      "updatedAt": "2026-03-21T10:30:00Z"
    }
  ],
  "usage": {"cost": 1, "quota": 99}
}

28. Query Wallet Agent by Address

28. 按地址查询钱包代理

根据钱包地址获取钱包代理信息。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/walletagent/address/0x1234567890abcdef?exchange=hyperliquid" \
  -H "$AUTH_HEADER"
Parameters:
FieldTypeRequiredDescription
address
String (path)YesWallet address (in URL path)
exchange
String (query)NoFilter by exchange type
Response:
json
{
  "success": true,
  "data": {
    "id": 1,
    "userId": "user_001",
    "agentAddress": "0x1234567890abcdef...",
    "userAddress": "0xabcdef1234567890...",
    "exchange": "hyperliquid",
    "authorized": true,
    "expiredAt": 1681992600000,
    "createdAt": "2026-03-21T10:30:00Z",
    "updatedAt": "2026-03-21T10:30:00Z"
  },
  "usage": {"cost": 1, "quota": 99}
}

根据钱包地址获取钱包代理信息。
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/walletagent/address/0x1234567890abcdef?exchange=hyperliquid" \
  -H "$AUTH_HEADER"
参数:
字段类型必填描述
address
String(路径参数)钱包地址(在URL路径中)
exchange
String(查询参数)按交易所类型过滤
返回结果:
json
{
  "success": true,
  "data": {
    "id": 1,
    "userId": "user_001",
    "agentAddress": "0x1234567890abcdef...",
    "userAddress": "0xabcdef1234567890...",
    "exchange": "hyperliquid",
    "authorized": true,
    "expiredAt": 1681992600000,
    "createdAt": "2026-03-21T10:30:00Z",
    "updatedAt": "2026-03-21T10:30:00Z"
  },
  "usage": {"cost": 1, "quota": 99}
}

29. Authorize Wallet Agent

29. 授权钱包代理

设置钱包代理的授权状态。
bash
curl -s -X PUT "$BASE_URL/open/trader/newsliquid/v1/walletagent/authorize" \
  -H "$AUTH_HEADER" -H "Content-Type: application/json" \
  -d '{
    "agentAddress": "0x1234567890abcdef...",
    "exchange": "hyperliquid",
    "userAddress": "0xabcdef1234567890...",
    "authorized": true,
    "expiredAt": 1681992600000
  }'
Parameters (body):
FieldTypeRequiredDescription
agentAddress
StringYesAgent wallet address
exchange
StringYesExchange type:
aster
or
hyperliquid
userAddress
StringYesUser's main wallet address
authorized
BooleanYes
true
to authorize,
false
to revoke
expiredAt
IntegerNoAuthorization expiry (Unix milliseconds)
Response:
json
{
  "success": true,
  "data": {
    "id": 1,
    "userId": "user_001",
    "agentAddress": "0x1234567890abcdef...",
    "userAddress": "0xabcdef1234567890...",
    "exchange": "hyperliquid",
    "authorized": true,
    "expiredAt": 1681992600000,
    "createdAt": "2026-03-21T10:30:00Z",
    "updatedAt": "2026-03-21T11:00:00Z"
  },
  "usage": {"cost": 1, "quota": 99}
}
设置钱包代理的授权状态。
bash
curl -s -X PUT "$BASE_URL/open/trader/newsliquid/v1/walletagent/authorize" \
  -H "$AUTH_HEADER" -H "Content-Type: application/json" \
  -d '{
    "agentAddress": "0x1234567890abcdef...",
    "exchange": "hyperliquid",
    "userAddress": "0xabcdef1234567890...",
    "authorized": true,
    "expiredAt": 1681992600000
  }'
参数(请求体):
字段类型必填描述
agentAddress
String代理钱包地址
exchange
String交易所类型:
aster
hyperliquid
userAddress
String用户主钱包地址
authorized
Boolean
true
为授权,
false
为撤销授权
expiredAt
Integer授权过期时间(Unix毫秒)
返回结果:
json
{
  "success": true,
  "data": {
    "id": 1,
    "userId": "user_001",
    "agentAddress": "0x1234567890abcdef...",
    "userAddress": "0xabcdef1234567890...",
    "exchange": "hyperliquid",
    "authorized": true,
    "expiredAt": 1681992600000,
    "createdAt": "2026-03-21T10:30:00Z",
    "updatedAt": "2026-03-21T11:00:00Z"
  },
  "usage": {"cost": 1, "quota": 99}
}

Cross-Skill Workflows

跨技能工作流

Workflow A: CEX Spot Trading

工作流A:CEX现货交易

User: "Buy 0.1 BTC on Binance"
1. opentrade-cex  GET /market/ticker?symbol=BTC/USDT&exchangeId=binance  → check current price
2. opentrade-cex  GET /account/summary?exchangeId=binance                → verify available balance
3. opentrade-cex  GET /market/metadata?ticker=BTC                        → confirm pair info/limits
4. opentrade-cex  POST /orders                                           → place order
       {"symbol":"BTC/USDT:USDT","side":"buy","type":"market","quantity":0.1,"exchangeId":"binance"}
5. opentrade-cex  GET /orders/open                                       → confirm order status
Data handoff:
  • last
    price from step 1 → helps user decide order type (market vs limit)
  • available
    balance from step 2 → validates user can afford the order
  • Market info from step 3 → confirms pair exists and shows limits
用户:"在Binance买0.1 BTC"
1. opentrade-cex  GET /market/ticker?symbol=BTC/USDT&exchangeId=binance  → 查看当前价格
2. opentrade-cex  GET /account/summary?exchangeId=binance                → 验证可用余额
3. opentrade-cex  GET /market/metadata?ticker=BTC                        → 确认交易对信息/限制
4. opentrade-cex  POST /orders                                           → 下单
       {"symbol":"BTC/USDT:USDT","side":"buy","type":"market","quantity":0.1,"exchangeId":"binance"}
5. opentrade-cex  GET /orders/open                                       → 确认订单状态
数据传递:
  • 步骤1返回的
    last
    最新价格 → 帮助用户决定订单类型(市价还是限价)
  • 步骤2返回的
    available
    可用余额 → 验证用户是否有足够余额下单
  • 步骤3返回的市场信息 → 确认交易对存在并展示交易限制

Workflow B: CEX Futures Trading

工作流B:CEX期货交易

User: "Open a 10x long on ETH with $1000"
1. opentrade-cex  GET /market/ticker?symbol=ETH/USDT&exchangeId=binance  → check ETH price
2. opentrade-cex  GET /account/summary?exchangeId=binance&symbol=ETH/USDT:USDT&accountType=swap  → check margin balance
3. opentrade-cex  GET /leverage/current?symbol=ETH/USDT:USDT&exchangeId=binance  → check current leverage
4. opentrade-cex  PUT /leverage/current                       → set leverage to 10x (if needed)
       {"symbol":"ETH/USDT:USDT","leverage":10,"exchangeId":"binance"}
5. opentrade-cex  POST /orders                                → open long position
       {"symbol":"ETH/USDT:USDT","side":"buy","type":"market","quantity":<calculated>,"exchangeId":"binance"}
6. opentrade-cex  GET /positions                              → verify position opened
Data handoff:
  • last
    price from step 1 → calculate quantity:
    $1000 / ETH_price
  • Leverage 10x means only $100 margin needed for $1000 position
用户:"用1000美元开ETH的10倍多仓"
1. opentrade-cex  GET /market/ticker?symbol=ETH/USDT&exchangeId=binance  → 查看ETH价格
2. opentrade-cex  GET /account/summary?exchangeId=binance&symbol=ETH/USDT:USDT&accountType=swap  → 查看保证金余额
3. opentrade-cex  GET /leverage/current?symbol=ETH/USDT:USDT&exchangeId=binance  → 查看当前杠杆
4. opentrade-cex  PUT /leverage/current                       → 如有需要将杠杆设置为10倍
       {"symbol":"ETH/USDT:USDT","leverage":10,"exchangeId":"binance"}
5. opentrade-cex  POST /orders                                → 开多仓
       {"symbol":"ETH/USDT:USDT","side":"buy","type":"market","quantity":<计算值>,"exchangeId":"binance"}
6. opentrade-cex  GET /positions                              → 验证持仓已开
数据传递:
  • 步骤1返回的
    last
    最新价格 → 计算数量:
    $1000 / ETH价格
  • 10倍杠杆意味着1000美元的持仓仅需要100美元的保证金

Workflow C: News-Driven CEX Trading

工作流C:新闻驱动的CEX交易

User: "Check latest crypto news and trade accordingly"
1. [opennews]             Search crypto news → get AI ratings and trade signals
2. [opentwitter]          Check KOL sentiment on the target token
3. opentrade-cex   GET /market/ticker                         → check CEX price
4. opentrade-cex   GET /market/klines?interval=1h             → check recent trend
5. opentrade-cex   GET /account/summary                       → check balance
6. opentrade-cex   POST /orders                               → execute trade
7. opentrade-cex   GET /positions                             → monitor position
用户:"查看最新加密货币新闻并据此交易"
1. [opennews]             搜索加密货币新闻 → 获取AI评级和交易信号
2. [opentwitter]          查看KOL对目标代币的情绪
3. opentrade-cex   GET /market/ticker                         → 查看CEX价格
4. opentrade-cex   GET /market/klines?interval=1h             → 查看近期走势
5. opentrade-cex   GET /account/summary                       → 查看余额
6. opentrade-cex   POST /orders                               → 执行交易
7. opentrade-cex   GET /positions                             → 监控持仓

Workflow D: CEX-DEX Price Arbitrage

工作流D:CEX-DEX价格套利

User: "Compare BTC price between CEX and DEX"
1. opentrade-cex   GET /market/ticker?symbol=BTC/USDT&exchangeId=binance   → CEX price
2. [opentrade-market]     GET /market/price (on-chain)               → DEX price
3. Compare prices → identify arbitrage opportunity
4a. CEX cheaper → opentrade-cex POST /orders (CEX buy) + [opentrade-dex-swap] (DEX sell)
4b. DEX cheaper → [opentrade-dex-swap] (DEX buy) + opentrade-cex POST /orders (CEX sell)
5. Confirm both sides filled → calculate profit
用户:"比较CEX和DEX的BTC价格"
1. opentrade-cex   GET /market/ticker?symbol=BTC/USDT&exchangeId=binance   → 获取CEX价格
2. [opentrade-market]     GET /market/price (链上)               → 获取DEX价格
3. 对比价格 → 发现套利机会
4a. CEX价格更低 → opentrade-cex POST /orders(CEX买入) + [opentrade-dex-swap](DEX卖出)
4b. DEX价格更低 → [opentrade-dex-swap](DEX买入) + opentrade-cex POST /orders(CEX卖出)
5. 确认两边都成交 → 计算利润

Workflow E: CEX Hedge + DEX Spot Holdings

工作流E:CEX对冲 + DEX现货持仓

User: "Hedge my on-chain ETH holdings with a CEX short"
1. [opentrade-portfolio]  Check on-chain ETH balance                 → e.g., 10 ETH
2. opentrade-cex   GET /account/summary                       → check CEX margin
3. opentrade-cex   PUT /leverage/current                      → set leverage
4. opentrade-cex   POST /orders                               → open short position
       {"symbol":"ETH/USDT:USDT","side":"sell","type":"market","quantity":10,"exchangeId":"binance"}
5. opentrade-cex   GET /positions                             → confirm hedge position
用户:"用CEX空仓对冲我的链上ETH持仓"
1. [opentrade-portfolio]  查看链上ETH余额                 → 例如10 ETH
2. opentrade-cex   GET /account/summary                       → 查看CEX保证金
3. opentrade-cex   PUT /leverage/current                      → 设置杠杆
4. opentrade-cex   POST /orders                               → 开空仓
       {"symbol":"ETH/USDT:USDT","side":"sell","type":"market","quantity":10,"exchangeId":"binance"}
5. opentrade-cex   GET /positions                             → 确认对冲持仓

Workflow F: DEX Discovery + CEX Execution

工作流F:DEX发现 + CEX执行

User: "Find trending tokens and trade on CEX"
1. [opentrade-token]      Search trending tokens                     → discover hot tokens
2. [opentrade-market]     Check on-chain trading activity            → smart money signals
3. opentrade-cex   GET /market/metadata                       → check if listed on CEX
4. If CEX listed → opentrade-cex POST /orders                 → trade on CEX (lower fees)
   If not listed → [opentrade-dex-swap]                              → trade on DEX
用户:"找到热门代币并在CEX交易"
1. [opentrade-token]      搜索热门代币                     → 发现热门代币
2. [opentrade-market]     查看链上交易活动            → 聪明钱信号
3. opentrade-cex   GET /market/metadata                       → 查看是否在CEX上线
4. 如果已在CEX上线 → opentrade-cex POST /orders                 → 在CEX交易(手续费更低)
   如果未在CEX上线 → [opentrade-dex-swap]                              → 在DEX交易

Workflow G: Cross-Venue Portfolio Overview

工作流G:跨场所资产组合概览

User: "Show me all my assets across CEX and DEX"
1. opentrade-cex   GET /account/summary                       → CEX total balance
2. opentrade-cex   GET /account/spots                         → CEX spot assets
3. opentrade-cex   GET /positions                             → CEX open positions
4. [opentrade-portfolio]  Get on-chain wallet balances               → DEX holdings
5. Combine and present unified portfolio report
用户:"展示我在CEX和DEX的所有资产"
1. opentrade-cex   GET /account/summary                       → CEX总余额
2. opentrade-cex   GET /account/spots                         → CEX现货资产
3. opentrade-cex   GET /positions                             → CEX未平仓持仓
4. [opentrade-portfolio]  获取链上钱包余额               → DEX持仓
5. 合并并展示统一的资产组合报告

Operation Flow

操作流程

Step 1: Identify Intent

步骤1:识别意图

User wants to...Action
Check CEX market price
GET /market/ticker
View K-line / chart data
GET /market/klines
Check account balance
GET /account/summary
or
GET /account/spots
Place a buy/sell order
POST /orders
Modify an existing order
PUT /orders/edit
Cancel an order
DELETE /orders/:orderId
View open orders
GET /orders/open
View closed orders
GET /orders/closed
Check current positions
GET /positions
Close a position
POST /positions/close
Set leverage
PUT /leverage/current
Check leverage / margin
GET /leverage/current
,
GET /margin/mode
View trade history
GET /trades/history
Manage wallet agents
POST/GET/PUT /walletagent/*
用户想要...操作
查看CEX市场价格
GET /market/ticker
查看K线/图表数据
GET /market/klines
查看账户余额
GET /account/summary
GET /account/spots
下买/卖订单
POST /orders
修改现有订单
PUT /orders/edit
取消订单
DELETE /orders/:orderId
查看未成交订单
GET /orders/open
查看已完成订单
GET /orders/closed
查看当前持仓
GET /positions
平仓
POST /positions/close
设置杠杆
PUT /leverage/current
查看杠杆/保证金
GET /leverage/current
GET /margin/mode
查看交易历史
GET /trades/history
管理钱包代理
POST/GET/PUT /walletagent/*

Step 2: Collect Parameters

步骤2:收集参数

  • Missing exchangeId → ask user which exchange (e.g.,
    binance
    ,
    bybit
    ,
    okx
    ,
    hyperliquid
    )
  • Missing symbol → ask user which trading pair; format as CCXT standard (e.g.,
    BTC/USDT
    for spot,
    BTC/USDT:USDT
    for perpetual)
  • Missing side → ask user: buy or sell?
  • Missing order type → suggest
    market
    for immediate execution,
    limit
    for price control
  • Missing quantity → ask user; for futures, help calculate based on notional value and leverage
  • Missing price → required for limit orders; call
    GET /market/ticker
    to show current price as reference
  • Missing leverage → check current setting with
    GET /leverage/current
    ; suggest 1x-10x for beginners
  • 缺少exchangeId → 询问用户要使用哪个交易所(例如
    binance
    bybit
    okx
    hyperliquid
  • 缺少symbol → 询问用户要交易的交易对;格式遵循CCXT标准(现货用
    BTC/USDT
    ,永续合约用
    BTC/USDT:USDT
  • 缺少side → 询问用户:买还是卖?
  • 缺少订单类型 → 建议立即成交用
    market
    市价单,价格控制用
    limit
    限价单
  • 缺少数量 → 询问用户;期货交易可以根据名义价值和杠杆帮助计算
  • 缺少价格 → 限价单必填;调用
    GET /market/ticker
    展示当前价格作为参考
  • 缺少杠杆 → 调用
    GET /leverage/current
    查看当前设置;建议新手使用1x-10x杠杆

Step 3: Execute & Display

步骤3:执行并展示

  • Run the API call
  • Parse JSON response
  • Display human-readable summary with prices, quantities, P&L in friendly format
  • For order creation: show order ID, pair, side, type, quantity, price, status
  • For positions: show pair, side, entry/mark price, P&L, leverage
  • For account: show total/available balance, unrealized P&L
  • 运行API调用
  • 解析JSON返回结果
  • 以友好的格式展示人类可读的摘要,包含价格、数量、盈亏
  • 订单创建场景:展示订单ID、交易对、方向、类型、数量、价格、状态
  • 持仓场景:展示交易对、方向、开仓/标记价格、盈亏、杠杆
  • 账户场景:展示总/可用余额、未实现盈亏

Step 4: Suggest Next Steps

步骤4:建议后续操作

Just completedSuggest
Checked ticker1. Place an order 2. View K-line for trend analysis
Checked balance1. Place an order 2. Check positions
Placed order1. Check open orders 2. View positions 3. Set stop-loss
Order filled1. View positions 2. Set take-profit/stop-loss
Position opened1. Monitor with ticker 2. Set stop-loss order 3. Close position
Position closed1. Check realized P&L in trade history 2. Check updated balance
Set leverage1. Place an order 2. Check position limits
Present conversationally — never expose endpoint paths to the user.
刚刚完成的操作建议操作
查看了行情1. 下单 2. 查看K线做走势分析
查看了余额1. 下单 2. 查看持仓
提交了订单1. 查看未成交订单 2. 查看持仓 3. 设置止损
订单已成交1. 查看持仓 2. 设置止盈/止损
开仓成功1. 通过行情监控 2. 设置止损单 3. 平仓
平仓成功1. 在交易历史中查看已实现盈亏 2. 查看更新后的余额
设置了杠杆1. 下单 2. 查看持仓限制
以对话的形式呈现——切勿向用户暴露端点路径。

Risk Engine Notes

风险引擎说明

All risk-controlled endpoints (marked with "Risk: Yes" in Command Index) pass through a 4-layer risk engine before execution:
RuleNameTriggerDefault Threshold
1Price Deviation CheckLimit ordersMax 10% deviation from market price
2Position Size LimitOrder creation, position closeSingle: 20% of balance, Total: 80% of balance
3Rate LimitAll risk-controlled endpoints30 requests per minute
4Balance CheckOrder creationMin 5% balance reserve
What happens when risk check fails:
  • The API returns an error with a description of which rule was triggered
  • The order/action is NOT executed
  • Display the reason to the user clearly (e.g., "Order rejected: price deviates 15% from market price, max allowed is 10%")
  • Suggest corrective action (adjust price, reduce quantity, wait and retry, etc.)
Risk engine behavior:
  • Rules are checked in priority order (rate limit → price deviation → position limit → balance check)
  • First failure stops the chain — remaining rules are not checked
  • The risk engine uses a fail-open strategy: if market data or Redis is unavailable, the check passes (prioritizing availability)
所有受风控的端点(在命令索引中标记为"受风控:是")在执行前都会经过四层风险引擎检查:
规则编号规则名称触发场景默认阈值
1价格偏差检查限价单与市场价格最大偏差10%
2持仓规模限制订单创建、平仓单笔订单:余额的20%,总持仓:余额的80%
3速率限制所有受风控的端点每分钟最多30次请求
4余额检查订单创建至少保留5%的余额
风险检查失败的处理:
  • API会返回错误,说明触发了哪条规则
  • 订单/操作不会执行
  • 清晰地向用户展示失败原因(例如:"订单被拒绝:价格与市场价格偏差15%,最大允许偏差为10%")
  • 建议纠正措施(调整价格、减少数量、等待后重试等)
风险引擎行为:
  • 规则按优先级顺序检查(速率限制 → 价格偏差 → 持仓限制 → 余额检查)
  • 首次失败就会终止检查流程——不会检查剩余规则
  • 风险引擎采用故障开放策略:如果市场数据或Redis不可用,检查会通过(优先保障可用性)

Input / Output Examples

输入/输出示例

User says: "What's the BTC price on Binance?"
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/market/ticker?symbol=BTC/USDT&exchangeId=binance" -H "$AUTH_HEADER"
用户说:"Binance上的BTC价格是多少?"
bash
curl -s "$BASE_URL/open/trader/newsliquid/v1/market/ticker?symbol=BTC/USDT&exchangeId=binance" -H "$AUTH_HEADER"

→ BTC/USDT: $67,890.50 (Bid: $67,889 | Ask: $67,891)

→ BTC/USDT: $67,890.50(买一价: $67,889 | 卖一价: $67,891)


**User says:** "Buy 0.01 BTC at $65,000"

```bash
curl -s -X POST "$BASE_URL/open/trader/newsliquid/v1/orders" \
  -H "$AUTH_HEADER" -H "Content-Type: application/json" \
  -d '{"symbol":"BTC/USDT:USDT","side":"buy","type":"limit","quantity":0.01,"price":65000,"exchangeId":"binance"}'

**用户说:"以$65,000的价格买0.01 BTC"**

```bash
curl -s -X POST "$BASE_URL/open/trader/newsliquid/v1/orders" \
  -H "$AUTH_HEADER" -H "Content-Type: application/json" \
  -d '{"symbol":"BTC/USDT:USDT","side":"buy","type":"limit","quantity":0.01,"price":65000,"exchangeId":"binance"}'

→ Order placed! Buy 0.01 BTC @ $65,000 (Limit) — ID: 123456789

→ 订单已提交!以$65,000(限价)买入0.01 BTC — ID: 123456789


**User says:** "Close my BTC position"

```bash
curl -s -X POST "$BASE_URL/open/trader/newsliquid/v1/positions/close" \
  -H "$AUTH_HEADER" -H "Content-Type: application/json" \
  -d '{"symbol":"BTC/USDT:USDT","side":"long","quantity":0,"exchangeId":"binance"}'

**用户说:"平掉我的BTC持仓"**

```bash
curl -s -X POST "$BASE_URL/open/trader/newsliquid/v1/positions/close" \
  -H "$AUTH_HEADER" -H "Content-Type: application/json" \
  -d '{"symbol":"BTC/USDT:USDT","side":"long","quantity":0,"exchangeId":"binance"}'

→ Position closed! Realized P&L: +$25.00

→ 持仓已平仓!已实现盈亏:+$25.00


**User says:** "Set my ETH leverage to 20x"

```bash
curl -s -X PUT "$BASE_URL/open/trader/newsliquid/v1/leverage/current" \
  -H "$AUTH_HEADER" -H "Content-Type: application/json" \
  -d '{"symbol":"ETH/USDT:USDT","leverage":20,"exchangeId":"binance"}'

**用户说:"把我的ETH杠杆设置为20倍"**

```bash
curl -s -X PUT "$BASE_URL/open/trader/newsliquid/v1/leverage/current" \
  -H "$AUTH_HEADER" -H "Content-Type: application/json" \
  -d '{"symbol":"ETH/USDT:USDT","leverage":20,"exchangeId":"binance"}'

→ Leverage updated! ETH/USDT:USDT: 20x

→ 杠杆已更新!ETH/USDT:USDT: 20x

undefined
undefined

Edge Cases

边缘情况处理

  • Risk engine rejects order: Display the rejection reason clearly. Common causes: price too far from market (>10%), position too large, rate limited, insufficient balance. Suggest the user adjust parameters and retry.
  • Insufficient balance: Check balance with
    GET /account/summary
    first. For futures, consider leverage — required margin = order value / leverage.
  • Rate limited: If 30+ requests in 1 minute, wait 60 seconds before retrying. Inform the user about the cooldown.
  • Invalid trading pair: Call
    GET /market/metadata
    to verify the symbol exists on the exchange.
  • Position mode conflict: Cannot switch position mode while holding open positions. Close all positions first.
  • Leverage change with open positions: Some exchanges restrict leverage changes when positions are open. Close positions or reduce size first.
  • Order quantity precision: Use
    GET /market/metadata
    to check
    amountMin
    and
    costMin
    . Ensure order meets minimum requirements.
  • Minimum notional: Orders below the minimum cost (e.g., $5
    costMin
    ) will be rejected by the exchange.
  • Network error: Retry once, then prompt user to try again later.
  • Region restriction (error code 50125 or 80001): Do NOT show the raw error code to the user. Instead, display:
    Service is not available in your region. Please switch to a supported region and try again.
  • 风险引擎拒绝订单:清晰展示拒绝原因。常见原因:价格与市场价偏差过大(>10%)、持仓规模过大、触发速率限制、余额不足。建议用户调整参数后重试。
  • 余额不足:先调用
    GET /account/summary
    检查余额。期货交易可考虑杠杆——所需保证金 = 订单价值 / 杠杆。
  • 触发速率限制:如果1分钟内请求超过30次,等待60秒后再重试。告知用户冷却时间。
  • 无效交易对:调用
    GET /market/metadata
    验证交易对在该交易所是否存在。
  • 持仓模式冲突:持有未平仓持仓时无法切换持仓模式。先平掉所有持仓。
  • 有未平仓持仓时修改杠杆:部分交易所有持仓时限制修改杠杆。先平仓或减少持仓规模。
  • 订单数量精度问题:调用
    GET /market/metadata
    查看
    amountMin
    costMin
    ,确保订单满足最低要求。
  • 最低名义价值限制:低于最低成本(例如
    costMin
    为5美元)的订单会被交易所拒绝。
  • 网络错误:重试一次,然后提示用户稍后再试。
  • 区域限制(错误码50125或80001):不要向用户展示原始错误码,而是展示:
    您所在的区域暂不支持该服务,请切换到支持的区域后重试。

Amount Display Rules

金额展示规则

  • CEX amounts use standard units (e.g.,
    0.1 BTC
    ,
    100 USDT
    ) — NOT minimal units like DEX
  • Always show currency symbol alongside amounts
  • Format large numbers with commas (e.g.,
    $67,500.50
    )
  • Show P&L with sign and color hint: positive (+$250.00), negative (-$100.00)
  • Show percentage changes with sign (e.g., +1.89%, -0.52%)
  • Leverage shown as multiplier (e.g., 10x, 20x)
  • CEX金额使用标准单位(例如
    0.1 BTC
    100 USDT
    )—— 不像DEX那样使用最小单位
  • 金额旁始终展示币种符号
  • 大额数字用逗号分隔(例如
    $67,500.50
  • 盈亏展示带符号和颜色提示:正数(+$250.00),负数(-$100.00)
  • 涨跌幅展示带符号(例如+1.89%、-0.52%)
  • 杠杆展示为倍数(例如10x、20x)

Global Notes

全局说明

  • All endpoints require
    Authorization: Bearer <token>
    header
  • Supported exchanges:
    binance
    ,
    bybit
    ,
    okx
    ,
    hyperliquid
    ,
    aster
  • Trading pair format follows CCXT standard:
    BTC/USDT
    for spot,
    BTC/USDT:USDT
    for USDT perpetual contracts
  • The API routes through the CEX gateway with built-in risk controls — trades execute server-side
  • No private keys or transaction signing involved — this is CEX trading via API
  • CEX uses standard amount units (e.g.,
    0.1 BTC
    ), unlike DEX which uses minimal units (wei/lamports)
  • Numeric values in request bodies use native types (numbers, not strings):
    "quantity": 0.01
    ,
    "price": 65000.00
  • Risk-controlled endpoints may reject requests — always display the rejection reason to the user
  • Query parameters go in the URL, body parameters go in JSON request body
  • Wallet Agent feature only supports
    aster
    and
    hyperliquid
    exchanges
  • Each API request consumes 1 quota unit (shown in
    usage
    field of response)
  • Success response:
    {"success": true, "data": {...}, "usage": {"cost": 1, "quota": 99}}
  • Error response (upstream):
    {"success": false, "code": "INVALID_REQUEST", "error": "message"}
  • Error response (gateway):
    {"code": 400, "message": "error message", "error": "details"}
  • The skill uses the same
    OPEN_TOKEN
    as all other opentrade skills — no additional configuration needed
  • 所有端点都需要
    Authorization: Bearer <token>
    请求头
  • 支持的交易所:
    binance
    bybit
    okx
    hyperliquid
    aster
  • 交易对格式遵循CCXT标准:现货用
    BTC/USDT
    ,USDT永续合约用
    BTC/USDT:USDT
  • API通过内置风控的CEX网关路由——交易在服务端执行
  • 不涉及私钥或交易签名——这是通过API实现的CEX交易
  • CEX使用标准金额单位(例如
    0.1 BTC
    ),不像DEX使用最小单位(wei/lamports)
  • 请求体中的数值使用原生类型(数字,不是字符串):
    "quantity": 0.01
    "price": 65000.00
  • 受风控的端点可能会拒绝请求——始终向用户展示拒绝原因
  • 查询参数放在URL中,请求体参数放在JSON请求体中
  • 钱包代理功能仅支持
    aster
    hyperliquid
    交易所
  • 每个API请求消耗1个配额单位(在返回结果的
    usage
    字段中展示)
  • 成功响应
    {"success": true, "data": {...}, "usage": {"cost": 1, "quota": 99}}
  • 上游错误响应
    {"success": false, "code": "INVALID_REQUEST", "error": "message"}
  • 网关错误响应
    {"code": 400, "message": "error message", "error": "details"}
  • 本技能与其他所有opentrade技能使用相同的
    OPEN_TOKEN
    ——无需额外配置