| name | love_stock_deep_wide |
| description | Use this standalone deep-wide stock analysis skill whenever the user wants broad stock analysis for one or more A-share stock codes, Chinese stock names, US stock tickers, or HK stock codes. It guides market-data/news/email setup, runs the bundled stock analysis script, and produces a Markdown report with interface status, a required top-of-report market-wide recap and next-session trading plan, plus a required technical-method table that evaluates the stock across trend, volume, range, event, theme, sentiment, growth, Chan theory, wave theory, and other built-in methods. Use when the user wants stock analysis without relying on external project code, other skills, or separate LLM provider configuration. |
Love Stock Deep Wide
Workflow
- Work only inside this skill directory for bundled code and references. Do not import, inspect, or depend on files outside it. User-specific runtime files must live only under
~/.stock_analysis/; never create report drafts, temporary handoff directories, or generated artifacts in the current repository or skill directory.
- Python dependencies must be installed into the same Python environment used to run
scripts/analyze.py. On first setup or when an interface reports a missing package, run from this skill directory:
python -m pip install -r requirements.txt
python -c "import fitz; print(fitz.__doc__.splitlines()[0])"
fitz is provided by the PyMuPDF package and is required for official announcement PDF parsing.
3. The script creates and reads user config at ~/.stock_analysis/.env. Always run config check first:
python scripts/analyze.py --check-config
- First-run hard rule: if
--check-config shows CONFIG_CREATED: yes, you must 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 (for example
TUSHARE_TOKEN for A-share/HK/US market data and Chinese name lookup), stop and ask the user to complete configuration using references/configuration.md before running analysis. Never run partial/incomplete analysis.
- If keys are missing, ask the user the configuration questions from
references/configuration.md. Each question must say whether it can be skipped and what degrades if skipped.
- 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. The script collects data and writes per-stock prompt files under
~/.stock_analysis/prompts/ for the current Codex agent. Do not call local Hermes, shell-based agents, external LLM CLIs, or rule templates to generate the long-form stock analysis inside the script:
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.
Market-wide data collection is Tushare-first. For A-share reports, fetch broad indices, market breadth, and sector ranking from Tushare before falling back to Tencent/AkShare. Sector ranking must prefer named sector data; if ths_index name mapping is incomplete, try Tushare industry money-flow interfaces before AkShare, and never show raw sector codes such as 883999.TI as a main-line sector in the report body. For A-share official events, fetch recent CNInfo announcements and parse selected important PDF disclosures with PyMuPDF when available; use these official filings ahead of generic news when judging event-driven, expectation repricing, growth quality, and risk. For HK/US reports, try Tushare daily/index-style data first, then fall back to Yahoo/AkShare proxies where Tushare is unavailable or permission-limited. The final report must explain degraded market modules in the appendix instead of hiding fallback behavior.
Market data timing rules:
- A-share broad index, breadth, and sector modules are daily-data based. Before 18:00 local time, the script intentionally starts from the previous trading day because same-day daily bars and breadth are often incomplete. After 18:00, it starts from the current trading day and falls back to earlier trading days until data exists.
- During market hours, individual stock quotes may be realtime or near-realtime, while market-wide daily modules may still be previous-close data. Always state the
trade_date shown in the market context, for example 大盘日频数据截至 2026-05-27 when the report is generated on 2026-05-28 before the daily market data is complete.
- After market close but before upstream daily data is updated, the report may still use the previous trading day's market-wide modules. Do not imply that market breadth or sector rankings are live intraday data unless the data source explicitly provided live breadth/sector data.
- Open the latest prompt files under
~/.stock_analysis/prompts/, use the current Codex agent to generate the final analysis, and write that analysis to a Markdown file under ~/.stock_analysis/final_reports/. If the final analysis is only a section-level patch for --base-report, write that patch file under ~/.stock_analysis/final_reports/ as well and include a top-level ## 大盘整体分析 section before any ## <stock code> <stock name> sections; the merge command will replace the base report's market section and each stock's ### 分析 section. Do not create generated_reports/, draft Markdown, or any other transient report files in the skill directory, repository root, or current working directory. The final report must begin with the required 大盘整体分析 module and include the required 技术手法分析 chapter defined below when it is a standalone final report. The raw prompt files are local working artifacts; do not include raw prompts in email bodies. If the user asks how to read interface status, use references/reporting.md.
- Send email only from a finalized current-agent report:
python scripts/analyze.py --send-final-report ~/.stock_analysis/final_reports/<report>.md
If a generated base report exists, always merge the final analysis back into the original report before sending:
python scripts/analyze.py --send-final-report ~/.stock_analysis/final_reports/<report>.md --base-report ~/.stock_analysis/reports/<base_report>.md
This is the default sending path after running --stocks: do not send the standalone current-agent Markdown directly when a same-run base report exists. The actual email body must be the merged file written under ~/.stock_analysis/reports/ with the _final.md suffix, because that version preserves the base report's raw行情数据、技术指标、筹码、新闻、官方公告、接口明细 and replaces only the market section plus each stock's ### 分析 section.
When sending with --base-report, the email report must start with the market-wide section. The generated base report renders ## 大盘整体分析 before the stock summary; if using an older base report, make sure the section-level patch includes ## 大盘整体分析 so the final sent email contains a current market recap at the top.
The email sender uses multipart/alternative: a Markdown/plain-text part plus an HTML part converted from the same Markdown. Most mail clients display the HTML part.
Required Final Report Structure
Every finalized stock report must include these sections in this order unless the user explicitly asks for a narrower format:
# [股票代码/名称] - 深度宽表分析报告
## 大盘整体分析
## 核心结论
## 行情与数据状态
## 技术手法分析
## 基本面与催化
## 风险点
## 空仓者建议
## 持仓者建议
## 数据可信度
The 大盘整体分析 module must appear before the individual-stock 核心结论. It is produced by the current agent from available index, sector, flow, macro, news, and stock-region context. If direct market data is not present in the stock prompt, use available market/news clues and explicitly mark missing items as 数据不足; do not fabricate index levels, fund-flow amounts, or sector rankings.
Report layout quality rules:
- The final report should read as one clean article, not a raw data dump. Do not repeat the same
大盘整体分析, 行情数据, 技术指标, 新闻, or 接口状态 sections in multiple places.
- The report body and email body should describe data by business meaning, not vendor name. Do not write Tushare/AkShare/Yahoo/Tencent/SerpAPI/Tavily in the analytical body; keep provider names in
附录:接口状态.
- Do not include a second stock heading such as
## 600487 亨通光电 immediately under the title. Start with ## 大盘整体分析.
- Keep raw interface details in a final appendix only when sending or auditing. The main body should focus on conclusion, evidence, plan, and risk.
- Prefer compact tables for comparison and short paragraphs for decisions. Avoid long bullet lists that restate the same price/MA facts more than once.
Required Market-Wide Analysis Module
First infer the stock's primary market:
- A-share: six-digit mainland codes such as
600487, 000001, 300750, or Chinese A-share names.
- HK: codes ending in
.HK or Hong Kong stock names.
- US: US tickers such as
AAPL, NVDA, SPY, or US index/ETF context.
- Mixed input: include one market-wide subsection per involved market, then synthesize one cross-market posture.
Use the matching blueprint below. The goal is not to predict prices; the goal is to decide whether tomorrow deserves active trading, what directions deserve attention, and which individual-stock signals are more trustworthy under the market background.
A-Share Three-Part Recap
Use this structure for A-share stocks:
- 指数趋势: Review Shanghai Composite, Shenzhen Component, ChiNext, or available broad indices. Judge whether indices are rising together, diverging, range-bound, or turning defensive. Watch volume expansion/contraction and key support/resistance.
- 资金情绪: Review turnover, up/down breadth, limit-up/limit-down structure, high-position stock divergence, and whether risk appetite is warming or fading.
- 主线板块: Identify leading and lagging sectors. Prioritize sectors with event catalysts, internal leader stocks, and continuing breadth. If leading sectors collapse or laggards spread, lower risk appetite.
HK Three-Part Recap
Use this structure for Hong Kong stocks:
- 恒指/恒科/国企指数: Judge whether Hang Seng Index, Hang Seng Tech, and HSCEI are directionally aligned, diverging, or turning defensive; check volume and key levels when available.
- 南向资金: Review southbound flow direction/scale, HKD liquidity/rate pressure, mainland policy expectations, market breadth, and leadership concentration.
- 科技/金融/地产等板块: Review whether technology/platform, financial, property, consumer, and defensive factors are rotating or strengthening.
US Market State Strategy
Use this structure for US stocks:
- SPX/NDX/DJI 趋势: Judge whether S&P 500, Nasdaq/Nasdaq 100, and Dow are aligned. Separate broad-market beta from Nasdaq/AI-led concentration.
- 宏观利率/美元: Review Treasury yield, USD, inflation/Fed-policy narrative, and whether macro pressure supports risk-on or risk-off.
- 行业主题轮动: Identify whether AI, semiconductor, software, megacap tech, financials, energy, defensives, or small caps are leading or lagging.
Market Decision Output
Inside ## 大盘整体分析, always output these subsections:
### 市场三段式复盘
-
### 明日交易决策
- Answer exactly these five questions:
明天要不要交易: choose one of 积极交易, 选择性交易, 轻仓观察, 不主动交易.
明天重点看什么方向: list 1-5 directions, or write 无明确主线.
哪些个股信号更可信: explain what kind of individual-stock signals should be trusted more under this market background.
明日预案: provide conditional bullets using 如果...则....
避免临盘决策: define concrete pre-market conditions for acting or standing aside.
-
### 大盘对个股信号的加权
- Explain how the market background changes confidence in the individual stock's technical-method table:
- If market is strong, sector is strong, and sentiment is strong, continuation after breakout/pullback is more credible.
- If market is volume-down, sentiment retreating, or main themes breaking down, reduce confidence in isolated single-stock signals.
- If market data is insufficient, do not force an aggressive stance; prefer
轻仓观察 or conditional confirmation.
The 技术手法分析 chapter is mandatory. It must be a Markdown table, not prose-only commentary. The table must contain one row per method in the list below. Do not say that the row comes from another skill or ask another skill to do the work; this skill is self-contained and must apply the rules directly from the prompt data and available market/news fields.
Use this table schema exactly:
| 技术手法 | 当前结论 | 操作建议 | 关键原因 | 风险/失效条件 | 置信度 |
|---|
Allowed 当前结论 labels: 强匹配, 部分匹配, 不匹配, 反向风险, 数据不足.
Allowed 操作建议 labels: 买入/加仓, 低吸观察, 持有, 观望, 减仓/止盈, 回避.
Allowed 置信度 labels: 高, 中, 低. If key fields are missing, use 数据不足 and 低, then state the missing field in 关键原因.
Built-In Technical Methods
Apply all methods below inside the 技术手法分析 table. Keep each row concise but evidence-based; cite actual values when available, such as current price, MA5/MA10/MA20, volume ratio, turnover, support/resistance, PE/PB, drawdown, recent high/low, and news catalysts.
| 技术手法 | 判断规则 | 正向信号 | 反向信号 |
|---|
| 默认多头趋势 | Check MA5/MA10/MA20 order, MA20 slope, price versus MA20, and volume on breakout or rebound. | MA5 >= MA10 >= MA20, MA20 rising, price holds MA20, breakout has volume. | Price breaks MA20, MA5 below MA10, volume rises on decline, high-distance chase. |
| 缩量回踩 | Requires uptrend first, then pullback to MA5 within about 1% or MA10 within about 2%, with volume below 70% of 5-day average. | Pullback holds MA5/MA10, volume contracts, no major bad news. | Pullback breaks MA20, volume expands on decline, profit ratio or chip structure deteriorates. |
| 放量突破 | Identify resistance from recent highs/range top, then verify close above resistance with volume ratio above 2.0 or volume above 2x 5-day average. | Strong close above resistance, sector resonance, post-breakout deviation under 5%. | Breakout without volume, close falls back under resistance, PE/valuation bubble risk. |
| 均线金叉 | Check recent MA5 crossing above MA10, MA10 crossing above MA20, and MACD golden cross or zero-axis strength. | Cross occurs near price, volume ratio above 1.2, consolidation background. | Cross appears after a large rally, deep downtrend false cross, price far above moving averages. |
| 底部放量 | Look for 20-day drawdown above 15%, bear trend background, then a high-volume stabilizing candle. | Volume ratio above 3, bullish candle, price holds recent low, average chip cost near current price. | No prior decline, volume spike but close weak, continued bearish trend or bad fundamental catalyst. |
| 箱体震荡 | Use 60-120 day highs/lows to identify repeated resistance/support touches and current position within the box. | Near support within 5%, volume stabilizes, box width 5%-15% or wider. | Near resistance within 5%, box downside break, box width below 5%, false breakout risk. |
| 一阳夹三阴 | Inspect the provided recent daily K-line table first: latest 5 candles should show a big bullish candle, three small bearish/small candles staying inside the first candle range with shrinking volume, then bullish breakout. | Pattern complete and trend bullish. | Pattern incomplete, lows break first-day open, final bullish breakout absent. |
| 龙头策略 | Compare stock strength against sector, turnover, volume ratio, and sector catalyst. | Sector leads market, stock outperforms sector by about 2%+, turnover above 5%, volume ratio above 1.5. | Sector not resonating, stock lags peers, deviation above 10%, catalyst weak. |
| 热点题材 | Evaluate theme strength, sector breadth, real company linkage, relative strength, and news quality. | Theme in launch/spread phase, company has real exposure, stock stronger than sector. | Theme fading, concept-only linkage, regulatory/inquiry/clarification risk, high deviation chase. |
| 情绪周期 | Use turnover, volume pulse, news sentiment, MA compression, and volatility to classify cold, warming, overheated, or euphoric phase. | Cold bottom or warming phase with volume improvement and neutral/negative sentiment turning. | Turnover above 5%-10%, single-day volume pulse, good-news saturation, high deviation or MACD divergence. |
| 事件驱动 | Classify recent events as earnings, policy, order/product, capital operation, regulatory/risk; judge credibility, impact path, time window, and price reflection. | High-confidence positive event not fully reflected in price. | Negative event still unfolding, positive event already priced in, event timing unknown. |
| 预期重估 | Identify whether new hard/soft information changes expectations for earnings, policy, valuation center, industry cycle, or competition. | Positive expectation gap with technical confirmation and valuation support. | Expectation already realized by a large rally, negative expectation gap, core assumption invalidated. |
| 成长质量 | Check revenue, net profit, operating cash flow, ROE, valuation, and whether market trend confirms fundamentals. | Revenue/profit/cash flow/ROE improve together, industry cycle supports growth. | Revenue grows without profit, cash flow weak, high valuation with unverified growth. |
| 缠论 | Approximate structure using recent highs/lows, central range, trend segment, MACD divergence, and buy/sell point type. | Bottom divergence, first/second/third buy point, price leaves central range upward. | Top divergence, downtrend segment, no clear buy point, price falls back into central range. |
| 波浪理论 | Use 120-day structure to estimate impulse or corrective wave, Fibonacci retracement/extension, MACD/volume confirmation, and invalidation rules. | Wave 2 stabilizes at 38.2%-61.8%, early Wave 3 breakout, Wave 4 holds above Wave 1 area. | Late Wave 5 divergence, B-wave trap, C-wave decline, count confidence low. |
After the table, add a short paragraph named 综合技术结论 that reconciles conflicts. Prefer the methods with the clearest data support and lowest invalidation risk. If methods conflict, explain which evidence dominates; do not average all rows mechanically.
Guardrails
- Never print real API keys, passwords, webhook URLs, or tokens.
- Ask before overwriting an existing
~/.stock_analysis/.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 ask for or require external LLM URL/model/API-key settings.
- 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 analysis result, not raw prompt context.
- Do not invoke, import, inspect, or cite sibling strategy skills while producing the report. The method rules above are the complete built-in source for the
技术手法分析 chapter.
Bundled Resources
scripts/analyze.py: deterministic entry point.
scripts/stock_agent/: self-contained helper functions for config, data, search, LLM, and report rendering.
assets/env.example: template copied to ~/.stock_analysis/.env on first run.
requirements.txt: Python dependency list.
references/configuration.md: API-key setup details.
references/reporting.md: report and interface-status interpretation.