Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By quantskillsGPL-3.0In 1 marketplace
Applies entry-date and open-price rules for take-profit, stop-loss, forced exits, and single-name position caps.
Claude loads one when your task matches it, or you run it by name.
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
当需要对 A 股和期货持仓做自动止盈止损与仓位管理时,使用此 skill。支持次日高开止盈(+5%)、次日低开止损(-3%)、持仓满 2 交易日强平、单票名义仓位上限(>10%)减仓,输出标准 8 字段调仓指令。
本版本为对 52/100 验收版的增强修复,全面落地 6 项缺陷改进(E1–E6),v2 已升级为混合型 BUILD——
production/trade.parquet提供本地交易日历缓存,agent 侧新增inspect_calendar()/refresh_calendar()自主决策 API。 v3 追加:新增check_date_coverage(start_date, end_date=None)一键查询 API——agent 拿到任意日期或回测区间,一次调用即返回「是否在日历覆盖范围内 + 缺口 + 扩展建议 + 可直接执行的 refresh 命令」。
其他 agent 拉取本 skill 后,按 3 步即可产出交易决策:
# 装依赖
pip install panda_data pyarrow
# 配置 panda_data 凭据(写入 ~/.zshrc 或 ~/.bashrc 后 source)
export PANDA_USERNAME=<your_username>
export PANDA_PASSWORD=<your_password>
production/trade.parquet已随仓库发布(971 交易日 / ~18.5KB),开箱可用;若需扩展范围再运行python3 scripts/build_calendar.py。
import sys
sys.path.insert(0, "/path/to/skill-b11-auto-stop-loss-take-profit/scripts")
from build import run
order = run({
"code": "600036",
"entry_price": 10.0,
"entry_date": "2026-06-19", # 周五入场
"current_qty": 800,
"open_price": 10.55, # 次日 +5.5%
"today": "2026-06-22", # 周一(交易日次日)
"total_equity": 1_000_000, # ⭐ 必传:总权益作为仓位比分母
})
# → {"code": "600036", "action": "sell", "target_qty": 0, "qty_change": -800,
# "reason": "[B11]次日高开止盈 ...", ...}
批量调用只需传 list:run([pos1, pos2, ...]) 返回同长度 list。
from build import check_date_coverage, refresh_calendar
# 拿到未知日期先问 —— 一次调用拿齐范围/覆盖/建议/命令
r = check_date_coverage("2020-01-15") # 或区间 check_date_coverage("2020-01-15", "2029-06-01")
if not r["in_range"]:
# r 已算好建议参数,agent 直接传给 refresh_calendar
refresh_calendar(force=True,
years_back=r["suggested_years_back"],
years_forward=r["suggested_years_forward"])
# 之后再调 run(...) 即可
| 平台 | 集成方式 |
|---|---|
| Python agent(最通用) | 上面 Step 2 三行代码,或 python3 scripts/build.py |
| Claude Code | cp -R . ~/.claude/skills/skill-b11-auto-stop-loss-take-profit;/skill-b11-... 触发 |
| Cursor | .cursor/tools.json 注册(INSTALL.md § Cursor) |
| OpenAI Codex | 函数工具 JSON schema(INSTALL.md § Codex) |
| Hermes / OpenClaw | YAML 配置(INSTALL.md § Hermes / § OpenClaw) |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
code | str | ✅ | A股(600036/sh600036)或期货(IF2406/rb2410) |
entry_price | float | ✅ | 入场价 |
entry_date | str | ✅ | 入场日 YYYY-MM-DD |
current_qty | int | ✅ | 当前持仓(A股股数 / 期货手数) |
open_price | float | ✅ | 今日开盘价 |
today | str | ✅ | 当前日 YYYY-MM-DD(须 ≥ entry_date) |
total_equity | float | ✅ | 总权益(仓位比分母),≤0 时返回 hold |
multiplier | float | ⭕️ | 期货合约乘数;A股忽略;未知期货品种必传 |
{
"code": "600036",
"pnl_pct": 0.055, # 浮盈亏(小数)
"current_qty": 800,
"time": "2026-06-22",
"action": "sell", # "sell" / "hold"(不产生 buy)
"qty_change": -800, # 负=卖出,0=不动
"target_qty": 0,
"reason": "[B11]次日高开止盈 ...",
}
| 现象 | 排查 |
|---|---|
RuntimeError: 需要 panda_data | pip install panda_data pyarrow |
RuntimeError: 需要 PANDA_USERNAME / PANDA_PASSWORD | 配置 env 后 source ~/.zshrc |
ValueError: 未知期货品种 | 传 multiplier 参数覆盖 |
ValueError: 缺少字段: total_equity | v2 必传总权益 |
| 全部返回 hold,reason 含"总权益非正" | 传入的 total_equity ≤ 0 |
| 回测日期不在日历范围内 | check_date_coverage() → 按建议 refresh_calendar(force=True, ...) |
panda_data 的 SH 交易所),港美股暂不支持;仅支持多头持仓。├── SKILL.md ← 技能设计书(含 metadata / 决策规则 / Agent 更新 SOP)
├── README.md ← 本文件
├── README.en.md ← English version
├── LICENSE ← GPL-3.0-only
├── INSTALL.md ← 多平台安装指南(5 平台)
├── requirements.txt ← 依赖声明(panda_data 硬依赖 + pyarrow)
├── scripts/
│ ├── build.py ← 主入口(run / validate_input / check_date_coverage / inspect_calendar / refresh_calendar)
│ ├── test.py ← 自测脚本(68 用例)
│ ├── build_calendar.py ← 独立初始化:拉取交易日历 → 写 production/trade.parquet
│ └── _verify_prod.py ← 生产路径验证(panda_data 实测)
├── references/
│ └── api_guide.md ← 接口调用文档(含增强变更清单 + Agent 更新 SOP)
└── production/
└── trade.parquet ← 交易日历缓存(今天-3年 → 今天+1年,snappy 压缩,~18.5KB)
# 一:初始化交易日历缓存(首次使用必做,需 PANDA_USERNAME/PANDA_PASSWORD)
python3 scripts/build_calendar.py
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
b11-auto-stop-loss-take-profit@quantskills is listed by quantskills/registry — review the source before installing
npx claudepluginhub quantskills/registry --plugin b11-auto-stop-loss-take-profitPlugins from other owners that cover similar ground