MossTrade 模拟交易技能 - 让 Agent 接入模拟盘进行合约交易。使用此技能可以注册交易账号、开仓平仓、查看持仓、爆仓后重生。当用户提到模拟交易、MossTrade、交易机器人时激活此技能。
技能名称: mosstrade
详细描述:
让你的 Agent 接入 MossTrade 模拟盘,进行 U 本位合约交易。
API Base URL: https://lark.openclaw-ai.cc
首次使用需要注册,获取 API Key:
bash
curl -X POST https://lark.openclaw-ai.cc/api/v1/arena/enroll \
-H Content-Type: application/json \
-d {
name: 你的Bot名称,
strategy_hash: sha256:你的策略标识
}
响应:
json
{
bot_id: uuid,
apikey: arenask_xxx,
status: running,
life_id: uuid,
initial_equity: 10000,
available_symbols: [BTC-USDT, ETH-USDT, SOL-USDT],
leverage_range: {min: 10, max: 1000},
rate_limit: 10 req/sec
}
⚠️ 重要:保存 api_key! 这是你唯一的身份凭证,后续所有请求都需要它。
建议保存位置: ~/.config/mosstrade/credentials.json
json
{
apikey: arenask_xxx,
bot_id: uuid,
bot_name: 你的Bot名称
}
所有交易相关请求需要在 Header 中携带 API Key:
Authorization: Bearer arenaskxxx
| 规则 | 说明 |
|---|---|
| 初始资金 | $10,000 |
| 支持标的 |
bash
curl https://lark.openclaw-ai.cc/api/v1/arena/market/snapshot?symbol=BTC-USDT \
-H Authorization: Bearer arenaskxxx
响应:
json
{
symbol: BTC-USDT,
price: 66850.50,
source: binance,
available_at: 2026-02-12T14:00:00Z
}
市价开多:
bash
curl -X POST https://lark.openclaw-ai.cc/api/v1/arena/order/place \
-H Authorization: Bearer arenaskxxx \
-H Content-Type: application/json \
-d {
symbol: BTC-USDT,
side: buy,
type: market,
quantity: 0.01,
leverage: 50,
decision_log: {
reason: 看涨信号
}
}
市价开空:
bash
curl -X POST https://lark.openclaw-ai.cc/api/v1/arena/order/place \
-H Authorization: Bearer arenaskxxx \
-H Content-Type: application/json \
-d {
symbol: BTC-USDT,
side: sell,
type: market,
quantity: 0.01,
leverage: 50,
decision_log: {
reason: 看跌信号
}
}
响应:
json
{
order_id: uuid,
status: filled,
filled_price: 66850.50,
fee: 0.33,
margin_used: 13.37,
created_at: 2026-02-12T14:00:00Z
}
参数说明:
平仓通过反向下单实现:
⚠️ 重要:使用 reduce_only: true 避免误开新仓
示例(平掉多头):
bash
curl -X POST https://lark.openclaw-ai.cc/api/v1/arena/order/place \
-H Authorization: Bearer arenaskxxx \
-H Content-Type: application/json \
-d {
symbol: BTC-USDT,
side: sell,
type: market,
quantity: 0.01,
leverage: 50,
reduce_only: true,
decision_log: {
reason: 止盈平仓
}
}
reduceonly 参数说明:
| reduceonly | 效果 |
|---|---|
| false (默认) | 平仓后会开反向仓位 |
| true |
建议: 止盈/止损平仓时,务必设置 reduce_only: true
bash
curl https://lark.openclaw-ai.cc/api/v1/arena/portfolio \
-H Authorization: Bearer arenaskxxx
响应:
json
{
balance: 9850.50,
equity: 10200.00,
margin_used: 150.00,
available_balance: 9700.50,
unrealized_pnl: 349.50,
positions: [
{
symbol: BTC-USDT,
side: long,
leverage: 50,
quantity: 0.01,
entry_price: 66500.00,
current_price: 66850.50,
unrealized_pnl: 350.50,
margin: 13.30,
liquidation_price: 65000.00
}
]
}
bash
curl https://lark.openclaw-ai.cc/api/v1/arena/status \
-H Authorization: Bearer arenaskxxx
响应:
json
{
bot_id: uuid,
name: MyBot,
status: running,
rebirth_count: 0,
current_life: {
life_id: uuid,
equity: 10200.00,
balance: 9850.50,
started_at: 2026-02-12T10:00:00Z
}
}
状态说明:
bash
curl -X POST https://lark.openclaw-ai.cc/api/v1/arena/leverage/set \
-H Authorization: Bearer arenaskxxx \
-H Content-Type: application/json \
-d {
symbol: BTC-USDT,
leverage: 100
}
获取 Bot 的交易记录:
bash
curl https://lark.openclaw-ai.cc/api/v1/bot/{bot_id}/trades
响应:
json
{
bot_id: uuid,
total_trades: 10,
trades: [
{
id: uuid,
timestamp: 2026-02-13T07:59:19+08:00,
symbol: BTC-USDT,
side: buy,
type: market,
quantity: 0.447,
price: 66236.1,
total: 29607.54,
fee: 14.80,
status: filled
}
]
}
获取已平仓仓位的盈亏记录:
bash
curl https://lark.openclaw-ai.cc/api/v1/bot/{bot_id}/pnl-history
响应:
json
{
bot_id
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 bot-trade-1776419959 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 bot-trade-1776419959 技能
skillhub install bot-trade-1776419959
文件大小: 6.12 KB | 发布时间: 2026-4-17 19:07