← Back to Skills Marketplace
haiyangchenbj

InvAssistant

by haiyangchen · GitHub ↗ · v2.1.0 · MIT-0
cross-platform ✓ Security Clean
319
Downloads
1
Stars
0
Active Installs
5
Versions
Install in OpenClaw
/install invassistant
Description
Investment portfolio management system covering A-shares (A股), US stocks (美股), and HK stocks (港股). A-shares: Three-condition entry system (引擎评分≥80 + 价格≤目标 +...
README (SKILL.md)

\r \r

InvAssistant v1.4 — 投资组合管理系统\r

\r 跨市场投资组合管理:A股三条件建仓系统 + 美股三红线信号系统 + 港股减持策略。\r \r 策略版本: v1.4(2026-04-23 月度复盘优化)\r 配置文件: my_portfolio.json(A股+港股) / invassistant-config.json(美股信号)\r \r ---\r \r

一、A股策略体系(v1.4)\r

\r

1.1 三条件建仓系统\r

\r 三条件是交叉验证过滤器,全部满足才允许建仓:\r \r | 条件 | 指标 | 标准 | 数据源 |\r |------|------|------|--------|\r | ① 引擎评分 | 选股引擎核心池评分 | ≥80分 + 连续3日在榜 | 每日引擎扫描 |\r | ② 价格到位 | 当前价 ≤ 目标价 | 静态目标价或动态目标价 | 实时行情 |\r | ③ MA20企稳 | 20日均线走平或拐头 | MA20 delta ≥ -0.05 | K线计算 |\r \r

1.2 v1.4 优化规则\r

\r

规则1:弹性窗口(Elastic Window)\r

  • 触发:2/3条件满足,且第三个偏差≤10%\r
  • 动作:可半仓试探(计划首笔股数×50%)\r
  • 偏差定义:\r
    • 引擎78-79分 → 视为≤10%偏差(门槛80)\r
    • 价格超目标≤5% → 偏差内\r
    • MA20 delta在[-0.05, 0] → 接近走平\r \r

规则2:动态目标价(Dynamic Target)\r

  • 公式实际目标 = min(静态目标价, MA20 × 0.95)\r
  • 更新频率:每周盘后更新一次\r
  • 当MA20持续下行导致动态价远低于静态价时,以动态价为准\r \r

规则3:A股韧性降级(Resilience Downgrade)\r

  • 触发:VIX>25 或外围单日跌>2%,但A股当日跌幅\x3C0.5%\r
  • 动作:防守等级从"观望"降为"正常",不因外围恐慌延迟满足条件的建仓\r
  • 确认:连续2个交易日A股韧性确认后生效,单日不算\r \r

规则4:引擎+动量双轨(Engine + Momentum Dual-Track)\r

  • 78-80分区间:额外检查20日涨幅\r
    • 20日涨幅>8% + 引擎≥78 → 恢复跟踪(纳入弹性窗口评估)\r
    • 引擎86分但20日跌幅>5% → 提示"高分低动量",谨慎建仓时机\r \r

规则5:财报季规则(Earnings Season)\r

  • 冻结期:财报发布前3个交易日冻结该标的建仓,已有持仓不受影响\r
  • 财报后决策树:\r
    • 营收+净利双超预期 → 解冻 + 正常三条件\r
    • 营收达标+净利小幅低于预期(\x3C5%) → 解冻但首笔减半\r
    • 营收或净利大幅低于预期(>10%) → 冻结延长1周\r
    • 重大意外(商誉减值等) → 降级或移除精选层\r \r

规则6:周五风险清单(Friday Risk Checklist)\r

  • 每周五盘后检查:周末地缘事件、政策窗口、外围异动预期、持仓财报日历、仓位暴露度\r \r

1.3 A股组合结构\r

\r | 层级 | 占比 | 说明 |\r |------|------|------|\r | 底仓ETF | ~40% | 宽基ETF + 红利ETF |\r | 精选观察 | ~30%预算 | 引擎筛出的候选标的,三条件验证 |\r | 存量持仓 | 视情况 | 历史持仓的退出/减仓管理 |\r | 机动资金 | ~5% | 特大错杀机会专用 |\r | 永久现金 | ~20% | 不动 |\r \r

1.4 调仓纪律\r

\r 触发调仓:\r

  • 连续2周跌出核心池(\x3C75分) → 研究替换\r
  • 新风险标记(毛利率恶化等) → 查财报确认\r
  • 季报低于预期 → 按财报决策树执行\r
  • 单只止损 -8% → 强制\r \r 不触发:\r
  • 排名小波动(3→5名)\r
  • 新标的进核心池 → 只观察\r
  • 分数波动1-2分 → 忽略\r \r ---\r \r

二、美股策略体系(三条红线)\r

\r

2.1 三条红线入场系统\r

\r 三条红线是过滤条件(Filter),全部通过才允许建仓:\r \r

红线1:情绪释放型下跌(最关键)\r

  • 单日跌幅 ≥ 4%(可配置)\r
  • 连续 3 个交易日下跌(可配置)\r
  • 没有情绪释放 → 没有入场理由\r \r

红线2:技术止跌信号(严格标准)\r

  • 放量下跌后缩量(量能萎缩至前日 70% 以下)\r
  • 均线强承接 = 下影线 + 收涨 + (放量 120%+ 或 强反弹 ≥ 1.5%)\r
  • 完整 Higher Low 结构(低点A → 反弹 → 低点B > A → 2日确认)\r \r

红线3:市场未进入系统性风险\r

  • QQQ/SPX 未连续 3 日暴跌\r
  • VIX \x3C 25(可配置)\r \r

2.2 退出信号系统\r

\r 按优先级从高到低:\r \r | 优先级 | 类型 | 条件 | 动作 |\r |--------|------|------|------|\r | 🔴 CRITICAL | 止损清仓 | 浮亏超止损线 | 立即清仓 |\r | 🟠 HIGH | 止盈减仓 | 浮盈达阶梯 | 分批减仓(20%→1/3, 40%→1/3, 80%→底仓) |\r | 🟠 HIGH | 趋势破位 | 连续N日\x3CMA50+拐头 | 减仓50% |\r | 🟡 MEDIUM | 动量衰竭 | 量价背离/MACD顶背离 | 减仓1/3 |\r | ⚫ OVERRIDE | 系统性风险 | VIX≥30恐慌/≥40极端 | 非核心减半/全组合50% |\r \r

2.3 策略类型\r

\r | 类型 | 说明 |\r |------|------|\r | redline | 三红线建仓 |\r | hold | 永久持有 |\r | pullback | 回调加仓 |\r | satellite | 卫星仓不动 |\r \r ---\r \r

三、港股策略\r

\r

3.1 公司股票激励减持策略\r

  • 来源:公司股票激励(中银国际账户)\r
  • 策略框架:折中方案 — 先减后持\r
  • 减持触发:反弹至短期均线附近时分批减持\r
  • 止损线:设定硬性止损价,不打折\r \r

3.2 港股观察池\r

  • 观察池标的通过技术信号(缩量企稳、收回短期均线、周线止跌等)筛选\r
  • 具体标的维护在 my_portfolio.json 中\r \r ---\r \r

四、硬性规则\r

\r

以下规则不可违反,优先级高于一切。\r \r

  1. 信号优先级不可逆转:止损 > 止盈 > 趋势破位 > 动量衰竭\r
  2. A股三条件是过滤器:全部通过才建仓,弹性窗口也需2/3+偏差内\r
  3. 美股三红线是过滤器:全部通过才建仓,不存在"两条差不多"\r
  4. 未成交 ≠ 已建仓:portfolio.json 必须反映真实持仓状态\r
  5. 不编造数据:所有价格、指标必须来自实时数据源\r
  6. HOLD 标的只在系统性风险时干预:VIX \x3C 30 不生成卖出信号\r
  7. 财报冻结期严格执行:发布前3日不新建仓\r
  8. 每次盘前报告必须基于 my_portfolio.json 交叉验证持仓状态\r \r ---\r \r

五、工作流程\r

\r

盘前分析流程(A股 + 港股)\r

\r

  1. 读取 my_portfolio.json 确认持仓状态\r
  2. 获取隔夜外围市场数据(美股收盘、VIX、纳指)\r
  3. 获取 A 股开盘前数据(集合竞价、北向资金预期)\r
  4. 对精选观察层逐只检查三条件状态\r
  5. 对存量持仓检查止损/减仓信号\r
  6. 生成盘前策略报告(含操作建议优先级)\r \r

美股信号检查流程\r

\r

全组合检查\r

python scripts/portfolio_checker.py\r
```\r
\r
#### 单标的详细分析\r
```bash\r
python scripts/portfolio_checker.py --detail TSLA\r
```\r
\r
#### 检查并推送\r
```bash\r
python scripts/portfolio_checker.py --push\r
```\r
\r
### 输出格式\r
\r
**A股盘前报告**包含:\r
- 外围市场概览(美股/VIX/汇率)\r
- 精选层三条件逐只状态表\r
- 弹性窗口触发评估\r
- 存量持仓信号\r
- 今日操作建议(优先级排序)\r
\r
**美股信号报告**包含:\r
- 三红线逐条判定 + 退出信号检查\r
- 系统性风险评估\r
- 全组合自检五问汇总\r
\r
---\r
\r
## 六、配置文件说明\r
\r
### my_portfolio.json(A股+港股主配置)\r
\r
```\r
├── 策略总览(资金分配)\r
├── 精选观察层(三条件标的 + 弹性窗口参数)\r
├── 存量持仓(减仓计划)\r
├── 底仓ETF(定投进度)\r
├── 机动资金\r
├── 永久现金\r
├── 港股持仓(减持计划)\r
├── 港股观察池\r
└── 调仓纪律(v1.4规则)\r
```\r
\r
### invassistant-config.json(美股信号配置)\r
\r
```\r
├── portfolio.watchlist(标的 + 策略类型 + 退出参数)\r
├── portfolio.systemic_risk_exit(系统性风险参数)\r
├── adapters(推送渠道:企微/钉钉/飞书)\r
├── commands(指令映射)\r
└── output(输出目录)\r
```\r
\r
---\r
\r
## 七、失败处理\r
\r
| 失败场景 | 处理方式 |\r
|----------|----------|\r
| 配置文件不存在 | 执行 `python scripts/init_config.py` 生成默认配置 |\r
| 数据源 API 限流 | 重试3次(间隔3-5秒),仍失败跳过标注 `⚠️ 数据获取失败` |\r
| 数据不足(\x3C20交易日) | 跳过技术指标,标注 `⚠️ 数据不足` |\r
| cost_basis 未配置 | 跳过止盈止损,标注 `ℹ️ 未配置成本价` |\r
| 推送渠道失败 | 重试1次,不阻断其他渠道 |\r
\r
---\r
\r
## 八、数据源优先级\r
\r
| 数据类型 | 首选 | 备选 |\r
|----------|------|------|\r
| A股K线/技术指标 | westock-data skill | AKShare |\r
| A股资金流/筹码/分时 | westock-data skill | NeoData |\r
| 选股引擎扫描 | AKShare | — |\r
| VIX/美股行情 | Yahoo Finance | NeoData |\r
| 北向资金 | NeoData | AKShare |\r
| 港股行情 | Yahoo Finance | — |\r
\r
---\r
\r
## 九、Notion 同步\r
\r
策略和每日分析同步到 Notion Trading Strategy 页面:\r
- **策略更新**:`_update_notion_v14.py`(版本迭代时运行)\r
- **每日分析**:`_notion_daily_analysis.py`(盘前盘后自动写入)\r
- **页面结构**:Trading Strategy → A股策略 / 风险控制 / 每日分析 等子页面\r
Usage Guidance
This skill appears to implement the trading-signal and portfolio-checking features it documents. Before installing: (1) Review the send_wecom/send_dingtalk/send_feishu scripts and only supply webhook URLs you control/trust — those endpoints will receive your portfolio data and any generated reports. (2) Keep invassistant-config.json and my_portfolio.json private (they may contain cost_basis, position sizes, and webhook secrets). (3) If you set INVASSISTANT_CONFIG, point it to a secure file; do not point it at system files. (4) Run it in an environment where you are comfortable with Python network access (it fetches data from Yahoo Finance and sends to configured webhooks). (5) If you plan to expose an outgoing webhook receiver to trigger checks from chat platforms, host that receiver securely (validate requests) as documented. If you want extra assurance, inspect the push adapter scripts locally to confirm they post only to configured webhooks and do not include hard-coded external endpoints.
Capability Analysis
Type: OpenClaw Skill Name: invassistant Version: 2.1.0 The InvAssistant skill is a professional investment portfolio management system that implements complex trading strategies (A-share 'Three-condition' and US 'Three Red Lines' systems). The provided Python scripts (scripts/portfolio_checker.py, scripts/redline_engine.py, etc.) perform legitimate technical analysis using market data fetched from Yahoo Finance and generate signal reports. The skill includes notification adapters for WeChat Work, DingTalk, and Feishu, which use user-provided webhook URLs for alerts. There is no evidence of data exfiltration, malicious execution, or prompt injection; the requested permissions (execute_command, write_to_file) are appropriately used to run the internal analysis scripts and manage local configuration and output files.
Capability Assessment
Purpose & Capability
Name/description match the code and runtime behavior: the repository contains data fetcher (Yahoo Finance), engines for entry/exit logic, portfolio checker, and push adapters for WeCom/DingTalk/Feishu. Required binary is only python3 and no unrelated credentials or platform SDKs are requested.
Instruction Scope
SKILL.md and the scripts instruct the agent to read/write local config files (invassistant-config.json / my_portfolio.json), fetch market data, run the python checker, and optionally push reports to webhooks. That scope matches the purpose. Note: the skill is allowed to execute commands and write files (to create configs and save outputs) — this is expected but means the skill can modify files inside the skill workspace and will read any config path you set via INVASSISTANT_CONFIG.
Install Mechanism
No custom install spec; dependency installation is standard Python via requirements.txt (requests, pandas). No downloads from arbitrary or opaque URLs were found.
Credentials
No required environment variables are declared by the skill. Optional credentials are webhook URLs and secrets for push adapters (WeCom/DingTalk/Feishu) stored in config or env vars as documented — these are appropriate for a push-capable reporting skill. There are no requests for unrelated secrets (cloud provider keys, SSH keys, etc.).
Persistence & Privilege
always is false and the skill does not request elevated or permanent platform-wide privileges. It does not modify other skills. It may persist its own config and output files in the skill directory, which is normal for this functionality.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install invassistant
  3. After installation, invoke the skill by name or use /invassistant
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v2.1.0
v2.1.0: Upgrade to v1.4 strategy - add A-share 3-condition system (elastic window, dynamic target, resilience downgrade, momentum dual-track, earnings rules), HK stock strategy, remove specific tickers from SKILL.md, add Q2 2026 strategy doc
v2.0.1
Move trigger keywords to read_when; clean up description
v2.0.0
V2: dual-config (my_portfolio.json > invassistant-config.json), modular scripts/, V2 entry point, hard rules, failure handling, exit engine.
v1.1.0
No changes detected in this version. - Version 1.1.0 was released with no file changes compared to the previous version.
v1.0.0
initial-release
Metadata
Slug invassistant
Version 2.1.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 5
Frequently Asked Questions

What is InvAssistant?

Investment portfolio management system covering A-shares (A股), US stocks (美股), and HK stocks (港股). A-shares: Three-condition entry system (引擎评分≥80 + 价格≤目标 +... It is an AI Agent Skill for Claude Code / OpenClaw, with 319 downloads so far.

How do I install InvAssistant?

Run "/install invassistant" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is InvAssistant free?

Yes, InvAssistant is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does InvAssistant support?

InvAssistant is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created InvAssistant?

It is built and maintained by haiyangchen (@haiyangchenbj); the current version is v2.1.0.

💬 Comments