| name | stock_ma_golden_cross_analysis |
| description | Use this standalone stock strategy skill for 均线金叉 (ma_golden_cross) 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/ma_golden_cross.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/ma_golden_cross/
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/ma_golden_cross.yaml
- Strategy id:
ma_golden_cross
- Display name: 均线金叉
- Category: trend
- Aliases: 均线金叉, 金叉
- Required source tools: get_daily_history, analyze_trend
- 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/ma_golden_cross/.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/ma_golden_cross/prompts/, use the current Codex agent to generate the final analysis, and write that analysis to a Markdown file under ~/.stock_analysis/ma_golden_cross/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/ma_golden_cross/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/ma_golden_cross/final_reports/<report>.md --base-report ~/.stock_analysis/ma_golden_cross/reports/<base_report>.md
Strategy Rules
均线金叉(MA Golden Cross Strategy)
信号判定标准:
-
金叉检测(关联理念2:趋势交易):
- 使用
analyze_trend 检查均线排列和 MACD 状态。
- 主信号:MA5 在最近 3 个交易日内上穿 MA10。
- 强信号:MA10 上穿 MA20(更慢但更可靠)。
- 检查 MACD 状态是否为金叉或零轴上方金叉。
-
量能确认(关联理念3:效率优先):
- 金叉日成交量应高于 5 日均量。
- 使用
get_daily_history 验证。
- 金叉日量比 > 1.2 为积极信号。
-
趋势背景:
- 盘整后金叉:最强信号。
- 上升趋势中金叉:延续信号。
- 深度下跌中金叉:弱信号,需更多确认。
-
价格位置(关联理念1:严进策略):
- 价格应在交叉均线附近或上方。
- 乖离率 < 5% — 避免追高延迟入场。
评分调整:
- MA5 × MA10 金叉配合量能:sentiment_score +10
- MA10 × MA20 金叉:sentiment_score +8
- MACD 零轴上方金叉:额外 +5
- 在
ma_analysis 和 buy_reason 中注明"均线金叉"。
- 理想买点设在交叉均线水平附近。
Guardrails
- Never print real API keys, passwords, webhook URLs, or tokens.
- Ask before overwriting an existing
~/.stock_analysis/ma_golden_cross/.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/ma_golden_cross/.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.