| name | stock_emotion_cycle_analysis |
| description | Use this standalone stock strategy skill for 情绪周期 (emotion_cycle) analysis. Accept one or more A-share stock codes, Chinese stock names, US stock tickers, or Hong Kong stock codes, collect market/news data, and produce a Codex-readable Markdown report focused on the 情绪周期 strategy. Source strategy: ~/daily_stock_analysis/strategies/emotion_cycle.yaml. |
情绪周期 Stock Analysis Skill
This skill is a strategy-specific variant of stock_ai_analysis. It uses the same bundled analyzer structure. User config, generated prompts, reports, and final reports for this strategy live under:
~/.stock_analysis/emotion_cycle/
Downloaded market-data caches are shared across strategies under ~/.stock_analysis/cache/ so users do not need to fetch the same data repeatedly.
Strategy Source
- Source file:
~/daily_stock_analysis/strategies/emotion_cycle.yaml
- Strategy id:
emotion_cycle
- Display name: 情绪周期
- Category: framework
- Aliases: 情绪, 情绪周期
- Required source tools: get_daily_history, get_realtime_quote, analyze_trend, search_stock_news
- Summary: 基于市场情绪、换手率与量价结构,识别情绪低点(恐慌底)与情绪高点(狂热顶),逆情绪布局。
Workflow
- Work only inside this skill directory. Do not import, inspect, or depend on files outside it during normal analysis.
- The script creates and reads user config at
~/.stock_analysis/emotion_cycle/.env. Always run config check first:
python scripts/analyze.py --check-config
- First-run hard rule: if
--check-config shows CONFIG_CREATED: yes, explicitly tell the user initialization config is required before any analysis. Do not run --stocks in the same turn.
- Incomplete-config hard rule: if required capability keys are missing for the user request, stop and ask the user to complete configuration using
references/configuration.md before running analysis. Never run partial/incomplete analysis.
- Ask for stock codes, names, or tickers if not supplied. Accept
600487, 北方华创, AAPL, 00700.HK, or mixed input like 北方华创,600487,AAPL,00700.HK.
- Only after configuration is complete, run analysis:
python scripts/analyze.py --stocks <codes>
Use --no-llm for data-only smoke runs.
Use --send-email only after the user confirms email delivery.
Use --no-email for validation runs when EMAIL_ENABLED=true.
- Open the latest prompt files under
~/.stock_analysis/emotion_cycle/prompts/, use the current Codex agent to generate the final analysis, and write that analysis to a Markdown file under ~/.stock_analysis/emotion_cycle/final_reports/.
- The final analysis must apply the strategy rules below. Do not return a generic stock report when this skill is invoked.
- Send email only from a finalized current-agent report:
python scripts/analyze.py --send-final-report ~/.stock_analysis/emotion_cycle/final_reports/<report>.md
If a generated base report exists, merge the final analysis back into the original report before sending:
python scripts/analyze.py --send-final-report ~/.stock_analysis/emotion_cycle/final_reports/<report>.md --base-report ~/.stock_analysis/emotion_cycle/reports/<base_report>.md
Strategy Rules
情绪周期策略(Sentiment Cycle Strategy)
核心哲学:市场参与者的情绪在"恐慌→悲观→怀疑→希望→乐观→兴奋→贪婪→狂热"
之间循环。聪明钱在恐慌底部布局,在狂热顶部离场。
情绪阶段量化指标
第一步:换手率分析(情绪热度核心指标)
使用 get_daily_history 和 get_realtime_quote:
- 换手率 < 0.5%/日:市场冷淡,无人关注,潜在底部区域(贪婪时买入别人的恐慌)。
- 换手率 0.5%~2%:正常交投,情绪平稳。
- 换手率 2%~5%:活跃,市场开始关注,不宜追高。
- 换手率 > 5%:高热度,游资/散户涌入,警惕情绪顶。
- 换手率 > 10%(日均):极度过热,通常为短期顶部。
第二步:连续换手率走势
使用 get_daily_history 计算近 20 日换手率走势:
- 由高向低(持续降温)+ 成交量萎缩 → 情绪退潮,耐心等待。
- 由低向高(加速升温)+ 成交量陡增 → 情绪启动,可介入。
- 突然单日暴量(换手率超过前期5倍)→ 往往是主力出货,需警惕。
第三步:新闻情绪面分析
使用 search_stock_news 搜索近期新闻,分析情绪倾向:
- 新闻集中出现"利好兑现、业绩超预期、涨停板、机构推荐"等 → 情绪可能过热。
- 新闻集中出现"业绩下滑、利空、跌破支撑" → 悲观情绪可能造就底部。
- 散户论坛/社交媒体情绪极端负面 → 反向指标,可能接近底部。
第四步:均线收缩与波动率
使用 analyze_trend:
- MA5/MA10/MA20 三线粘合(均线收缩)→ 蓄势,方向待定,情绪冷淡。
- 波动率降至低位(ATR 萎缩)→ 情绪极度低迷,蓄势爆发前兆。
情绪底部特征(买入区)
满足以下3项以上:
✅ 近20日換手率处于近一年低位
✅ 成交量持续萎缩,低于近60日均量50%以上
✅ 近期新闻以低调、中性或负面为主
✅ 股价在MA20附近或以下,但未出现恐慌性暴跌
✅ 机构持仓稳定或小幅增加(如有数据)
情绪顶部特征(减仓区)
满足以下3项以上:
⚠️ 近5日换手率 > 近20日均值的2倍
⚠️ 成交量脉冲式放大(单日)
⚠️ 新闻以利好兑现、机构目标价大幅上调、散户追捧为主
⚠️ 股价偏离MA5超过8%(高乖离率)
⚠️ MACD 出现顶背离
输出要求
- 当前情绪阶段判断:冷淡底部 / 平稳 / 升温介入 / 过热警惕 / 狂热顶部。
- 当前换手率与近一年换手率均值对比。
- 是否满足情绪底部或顶部特征(列出满足条项)。
- 给出逆情绪操作建议(大众恐慌我贪婪,大众贪婪我谨慎)。
评分调整建议:
- 情绪底部特征满足3项以上:
sentiment_score +14
- 情绪底部特征满足全部5项:
sentiment_score +20
- 情绪顶部特征满足3项以上:
sentiment_score -12
- 情绪顶部特征满足全部5项:
sentiment_score -20
- 情绪平稳区间:不调整基础分
Guardrails
- Never print real API keys, passwords, webhook URLs, or tokens.
- Ask before overwriting an existing
~/.stock_analysis/emotion_cycle/.env value.
- Ask before sending email. Do not enable
EMAIL_ENABLED=true unless the user explicitly wants automatic delivery.
- Do not block the user on optional keys. Offer a skip path and explain the consequence.
- Required-capability keys are not optional. If missing, stop and ask for config instead of running degraded analysis.
- First run always requires an explicit initialization prompt to the user before analysis.
- Never run partial or incomplete functionality; this is mandatory.
- Explain failures by impact: blocking, fallback succeeded, or data-quality degradation.
- Do not call local Hermes or other local agent CLIs from this skill. The current Codex agent is responsible for reading generated prompt files and writing the final analysis.
- Reports and emails must contain the strategy analysis result, not raw prompt context.
Bundled Resources
scripts/analyze.py: deterministic entry point.
scripts/stock_agent/: self-contained helper functions for config, data, search, LLM, and report rendering.
scripts/stock_agent/data.py: strategy-local data extraction code that reuses the shared ~/.stock_analysis/cache/ directory to avoid duplicate downloads across strategies.
assets/env.example: template copied to ~/.stock_analysis/emotion_cycle/.env on first run.
requirements.txt: Python dependency list.
references/configuration.md: API-key setup details for this strategy folder.
references/reporting.md: report and interface-status interpretation.