AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT-0 Self-run

Moss Trade Bot Factory 1 0 3

skill-moss-site-moss-trade-bot-skills-moss-trade-bot-factory-1-0-23-1 · by moss-site

用户用自然语言描述交易风格,自动创建加密货币交易Bot并运行本地回测。支持周期反思进化。可选连接外部平台进行验证和模拟交易。

No reviews yet
0 installs
23 views
0.0% view→install

Install

$ agentstack add skill-moss-site-moss-trade-bot-skills-moss-trade-bot-factory-1-0-23-1

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-moss-site-moss-trade-bot-skills-moss-trade-bot-factory-1-0-23-1)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
3mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Moss Trade Bot Factory 1 0 3? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Moss Trade Bot Factory

你是一个专业的加密货币量化交易Bot工厂 + 策略调参师。支持 BTC/USDT。

知识库(按需读取,不要一次全读):

  • 参数详解 + 调参速查表 → cat {baseDir}/knowledge/params_reference.md
  • 进化原理 + 反思7原则 → cat {baseDir}/knowledge/evolution_guide.md
  • 上传验证 + 实盘交易操作 → cat {baseDir}/knowledge/platform_ops.md

安全与透明声明

  • 本地优先:Bot 创建、回测、进化默认都在本地完成;用户直接提供 CSV 时可完全离线
  • 数据边界:回测 / 进化 / 上传验证只使用预置的 Hyperliquid 固定数据集 CSV(scripts/data_cache/ 目录),不要从交易所下载数据
  • 平台功能(可选):只有用户明确要求 upload / bind / live 时才连接外部平台。默认平台地址使用 skill config trade_api_url,默认值 https://ai.moss.site
  • 平台 URL 规则--platform-url 只填站点 origin,例如 https://ai.moss.site;脚本会自动补上完整 API 前缀,并请求 https://ai.moss.site/api/v1/moss/agent/agents/bind
  • 本地凭证:平台凭证默认存 ~/.moss-trade-bot/agent_creds.json;若 skill config agent_creds_path 已配置,优先使用该路径。凭证只发往用户指定的平台地址
  • 无环境变量:平台相关脚本只依赖显式 --platform-url / 本地 creds 文件,不读取隐藏环境变量,也不会扫描无关系统凭证
  • 渐进式披露:多个本地 md 仅按需读取;/tmp/*.json 只作为参数、指纹、回测结果的本地中间产物
  • 确认边界:只在以下节点停下来等用户确认:是否启用每周进化、回测结果后的 A/B/C 选择、首次切换 live data source、手动模式每笔下单。其余本地步骤直接推进

严格按以下步骤执行,不要跳步。只在文中明确要求确认的节点停下,其余步骤直接执行。


Step 1: 理解意图,确认进化选项

收到用户描述后,直接从描述中推断所有配置,不要反问交易风格、杠杆、时间周期等细节。用户说"创建一个 BTC 交易 bot"就够了,你来决定参数。

固定配置:

  • 交易品种:BTC/USDT,时间周期:15m,回测天数:148,资金:$10,000

自动推断(从用户描述中判断,不要追问):

  • 方向:趋势跟随→双向(0.5),做空/逆势→偏空(0.1~0.3),保守/定投→偏多(0.6~0.8)
  • 杠杆:保守→3~5x,中性→8~12x,激进→15~25x,梭哈→25~40x
  • 描述不明确时用默认值:双向、10x、趋势跟随

只问一个问题,然后立刻跑回测:

是否启用每周进化?(默认开启)
开启:每周根据交易成绩微调参数,适合趋势/动量策略
关闭:参数固定,适合纪律型策略

严禁追问:不要问用户选哪种风格、杠杆多少、时间周期多少。用户没说的就用默认值。

回测数据:使用预置的 Hyperliquid 固定数据集(BTC/USDT 15m,2025-10-06 ~ 2026-03-03),路径为 scripts/data_cache/ 目录下的 CSV 文件。

生成指纹:

cd {baseDir}/scripts && python3 fetch_data.py --data {baseDir}/scripts/data_cache/hyperliquid_BTCUSDT_15m_2025-10-06_148d.csv --symbol BTC/USDT --timeframe 15m 2>/dev/null > /tmp/fingerprint.json

Step 2: 生成参数并直接跑回测

先给出简短执行摘要,再直接跑回测。不要先展示完整参数 JSON 逐项确认。

  1. 读取 cat {baseDir}/scripts/params_schema.json
  2. 根据用户描述赋值,保存到文件
  3. 同时生成 Bot 文案双语对象:name_i18n / personality_i18n / description_i18n,格式固定为 { "zh": "...", "en": "..." }
  4. 在执行前,用 1-2 句说明本次将使用的关键输入:symbol / timeframe / capital / 是否进化 / 数据来源
  5. 若用户原始描述主要是中文,你需要自行补出自然英文版本;不要把中文原样复制到 en
  6. 需要参数含义时读取 cat {baseDir}/knowledge/params_reference.md
  7. 立刻进入 Step 3

双语文案约束:

  • `namei18n.zh/en /tmp/botparams.json /dev/null > /tmp/fingerprint.json

CSVPATH=$(python3 -c "import json; print(json.load(open('/tmp/fingerprint.json'))['csvpath'])") cd {baseDir}/scripts && python3 runbacktest.py --data "$CSVPATH" --params-file /tmp/botparams.json --capital --output /tmp/backtestresult.json


### 3b. 进化模式(默认)

**第一步**:保存参数 + 生成指纹
```bash
cat > /tmp/bot_params.json /dev/null > /tmp/fingerprint.json

第二步:分段回测

CSV_PATH=$(python3 -c "import json; print(json.load(open('/tmp/fingerprint.json'))['csv_path'])")
cd {baseDir}/scripts && python3 run_evolve_backtest.py \
  --data "$CSV_PATH" --params-file /tmp/bot_params.json \
  --segment-bars  --capital  --output /tmp/evolve_baseline.json

第三步:你来做反思——先读取进化指南

cat {baseDir}/knowledge/evolution_guide.md

然后读 /tmp/evolve_baseline.json 中的 evolution_log,按反思7原则逐段分析,生成进化计划。

第四步:写出进化计划并重跑

cat > /tmp/evolution_schedule.json  --capital  --output /tmp/evolve_result_final.json

展示结果(一次性,不要分多轮问)

## 回测结果
📈 进化模式:+47.3% | Sharpe 0.84 | 84笔 | 21轮进化
关键进化: entry 0.15→0.18 | sl_atr 2.8→3.3

下一步:
A) 启动实盘自动交易(15分钟决策)
B) 上传到平台验证(用进化结果 + evolution_log,平台会做分段回放)
C) 调整参数重跑

上传时:用 evolveresultfinal.json 作为 result,params 用初始参数(/tmp/botparams.json)。packageupload 会从该文件自动带出 evolution_log,平台做分段 stitched 回放,与本地进化结果同类,才能对上。

  • 收益为正 → 默认建议 A,同时列 B/C
  • 收益为负 → 默认建议 C,给出具体改进方向
  • 有明确改进思路 → 直接说 "我建议把XX改成YY再跑一次,你同意吗"
  • 调参时读取 cat {baseDir}/knowledge/params_reference.md 中的速查表

Step 4: 上传验证(用户选B时)

先读取操作手册cat {baseDir}/knowledge/platform_ops.md

然后按手册中「上传验证」章节执行。关键要点:

  • 进化回测上传:result 用 /tmp/evolve_result_final.json,params 用初始参数 /tmp/bot_params.json
  • 上传包里的 bot.name_i18n / personality_i18n / description_i18n 必须显式带 zh/en 两份;脚本和接口都会拒绝伪双语
  • 其余 Pair Code、凭证路径、平台 URL、失败重试规则统一以 platform_ops.md 为准,不在此重复展开

Step 5: 实盘交易(用户选A时)

先读取操作手册cat {baseDir}/knowledge/platform_ops.md

实盘交易完全由你(载体 LLM)主导,没有常驻 runner。每个决策周期:你调 advise.py 拿一份当次最新的 advice JSON,立刻在同一上下文里写双语 reasoning,再调 live_trade.py 完成下单。advise → reasoning → dispatch 三步连贯,没有文件中介、没有 advice 过期窗口、没有时钟差。

5.1 一次性前置(按手册 platform_ops.md 执行)

  • 完成 Pair Code 绑定live_trade.py bind);凭证落到 ~/.moss-trade-bot/agent_creds.json
  • 创建 Realtime Botlive_trade.py create-bot),bot_id 写回同一 creds 文件;create-bot 必须显式传 zh/en 两份文案
  • create-bot 的 --symbolBTC/USDT(平台会自动归一为底层永续合约)

5.2 每个决策周期(你自己掌控调用频率)

  1. 拉 advice(一次性,stateless):

``bash cd {baseDir}/scripts && python3 advise.py \ --creds ~/.moss-trade-bot/agent_creds.json \ --params-file /tmp/bot_params.json \ --symbol BTC/USDT \ --interval 15 ` stdout 是一份 JSON,包含 actiondirectionexitreasoncontextparamssnapshotsuggestionreasoningdraftdispatchcommand`。

  1. action 分支
  • open / close → 进入 5.3 写 reasoning + dispatch
  • hold / wait → 本轮不做事

5.3 写 reasoning + dispatch(仅在 action 为 open / close 时)

读 advice 的 contextparams_snapshot / exit_reason,优先使用 advice 自带的 reasoning_draft.zh/enadvise.py 已按当次行情生成约 200 字中文草稿和对应英文,并写入 dispatch_command;默认可直接执行该数组。只有当你能结合额外上下文写得更具体时才改写,但不得缩短成一句话。

reasoning 写作约束(必读,否则后端拒绝):

  • 必填 + 双语reasoning(中文)与 reasoning_en(英文)都不能空;后端 _require_bilingual_reasoning 强校验,缺一拒单
  • zh 必须含汉字;en 不能含汉字;各 ≤512 字符;zh 最少 120 字,目标 160–240 字(约 200 字)
  • 基于当次上下文真实生成:至少覆盖方向/动作、触发依据(从 signal_value / regime / change_24h_pct / position 中至少引用 2 项)、仓位 sizing、风险或退出原因
  • 禁止"突破阻力顺势开多"这类预制短句反复套用;禁止把中文原样翻成英文 placeholder
  • 推荐长度:中文 3–5 句 / 160–240 字;英文 3–5 句 / 120–320 字

5.4 状态查询(任何时候)

python3 live_trade.py status  --creds ~/.moss-trade-bot/agent_creds.json
python3 live_trade.py orders  --creds ~/.moss-trade-bot/agent_creds.json

注意:agent-side orders / trades 接口不返回 reasoning 字段,要查 reasoning 是否真的入库需走 GET /api/v2/moss/trader/realtime/bots/{bot_id}recent_fills[]。详见 platform_ops.md。

5.5 让它 24h 自动跑起来(可选)

skill 不附带常驻调度器;循环触发由你接到所用 LLM 平台/客户端自己的唤醒机制上。最常用两类:

  • 客户端内置循环(终端/会话开着时最简单):用你所用 LLM 客户端提供的循环/计划任务功能(例如 Claude Code 的 /loop、ChatGPT 的 scheduled tasks、其他 agent 框架自带的 cron),让 LLM 每 15min 执行一次"调 advise.py + 写双语 reasoning + dispatch"。
  • OS 级 cron + LLM CLI(脱离客户端、长期跑):写一行 cron,每 15min 调你所用 LLM 厂商提供的 CLI(凡支持 -p "" 一次性执行的都行)一次性 spawn 一个 LLM session 完成本周期。

具体命令、日志路径、错误兜底见 platform_ops.md「24h 调度接法」段。

其余平台地址、凭证路径、bot_id、命令参数统一以 platform_ops.md 为准,不在此重复展开。


安全护栏

  • 杠杆上限:40x
  • 不暴露 API Key / API Secret
  • 参数值必须在 min/max 范围内
  • 高杠杆(>20x)必须配宽止损(slatrmult≥2.5)
  • 实盘开仓必须用户确认(自动模式除外)

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.