每日备份 2026-03-27

This commit is contained in:
OpenClaw Backup
2026-03-27 23:38:45 +08:00
parent 4f11cd7b03
commit d09281e48c
827 changed files with 6991 additions and 148648 deletions
@@ -0,0 +1,94 @@
# Financial Metrics Reference
Use these formulas and interpretations consistently. Metric availability may differ across US/CN/HK data providers.
## 1. Profitability
1. Gross Margin
- Formula: `(Revenue - COGS) / Revenue * 100%`
- Use: Pricing power and production efficiency.
2. Operating Margin
- Formula: `Operating Income / Revenue * 100%`
- Use: Core operating efficiency.
3. Net Margin
- Formula: `Net Income / Revenue * 100%`
- Use: End-to-end profitability quality.
4. ROE
- Formula: `Net Income / Average Equity * 100%`
- Use: Equity capital efficiency.
5. ROIC
- Formula: `NOPAT / Invested Capital * 100%`
- Use: Capital allocation quality across debt and equity.
## 2. Growth
1. Revenue Growth (YoY / QoQ)
- Formula: `(Current Revenue - Prior Revenue) / Prior Revenue * 100%`
2. EPS Growth
- Formula: `(Current EPS - Prior EPS) / Prior EPS * 100%`
3. Multi-year CAGR
- Formula: `(Ending / Beginning)^(1/Years) - 1`
## 3. Valuation
1. P/E (Trailing / Forward)
- Formula: `Price / EPS`
2. PEG
- Formula: `P/E / Earnings Growth Rate`
3. P/B
- Formula: `Price / Book Value Per Share`
4. P/S
- Formula: `Market Cap / Revenue`
5. EV
- Formula: `Market Cap + Total Debt - Cash`
6. EV/EBITDA
- Formula: `EV / EBITDA`
7. EV/Sales
- Formula: `EV / Revenue`
## 4. Leverage and Liquidity
1. Debt-to-Equity
- Formula: `Total Debt / Total Equity`
2. Interest Coverage
- Formula: `EBIT / Interest Expense`
3. Current Ratio
- Formula: `Current Assets / Current Liabilities`
4. Quick Ratio
- Formula: `(Current Assets - Inventory) / Current Liabilities`
## 5. Cash Flow Quality
1. Free Cash Flow (FCF)
- Formula: `Operating Cash Flow - Capital Expenditures`
2. FCF Yield
- Formula: `FCF Per Share / Price * 100%`
3. Cash Conversion
- Formula: `FCF / Net Income`
## 6. Interpretation Guidance
1. Always compare metrics against:
- Company historical range
- Sector and direct peers
- Current macro regime
2. Avoid single-metric conclusions.
3. Flag where accounting standards or reporting cadence reduce cross-market comparability.
@@ -0,0 +1,75 @@
# Fundamental Analysis Reference
Use this framework in both `daily` and `full_report` modes. Keep outputs concise unless full report is requested.
## 1. Business Quality
Assess:
1. Moat quality:
- Brand, network effects, switching costs, cost advantage, IP/regulatory barriers.
2. Management quality:
- Capital allocation discipline, communication quality, execution consistency.
3. Business model durability:
- Revenue concentration, customer concentration, geographic risk, pricing power.
## 2. Financial Health
Focus areas:
1. Profitability trend:
- Gross, operating, net margin direction.
2. Growth quality:
- Revenue and earnings growth consistency, segment contribution quality.
3. Balance sheet:
- Debt burden, liquidity, refinancing risk, cash buffer.
4. Cash flow quality:
- OCF consistency, FCF conversion, capex intensity.
## 3. Valuation Lens
Use multiple perspectives:
1. Relative multiples:
- P/E, PEG, P/B, P/S, EV/EBITDA, EV/Sales.
2. Historical range context:
- Current valuation vs own history.
3. Peer context:
- Premium/discount vs direct peers and rationale.
## 4. Risk Framework
Map risks by category:
1. Company-specific:
- Product concentration, customer concentration, execution risk, governance issues.
2. Market/macro:
- Rate sensitivity, FX exposure, commodity sensitivity, policy risk.
3. Event risk:
- Earnings, regulatory approvals, legal actions, financing events.
## 5. Market-Specific Notes (US/CN/HK)
1. Data depth may vary by market and language.
2. Prefer exchange filings and official disclosure portals in each market.
3. Align accounting period labels and fiscal calendars before comparison.
4. Flag where metric comparability is limited.
## 6. Output Guidance
For daily mode, include:
- 2-3 key fundamental drivers
- 1-2 valuation signals
- top downside risks
For full report mode, include full multi-year trend tables and peer comparison.
@@ -0,0 +1,99 @@
# Metrics Definition
Use these definitions consistently across all reports.
## 1. Core Error Metrics
Let:
- `pred` = predicted close for target session
- `actual` = official actual close for that session
Compute:
- Absolute Error (AE): `|pred - actual|`
- Absolute Percentage Error (APE): `|pred - actual| / actual * 100%`
## 2. Hit Criteria
Report two hit criteria in parallel:
- Strict hit: `APE <= 1%`
- Loose hit: `APE <= 2%`
These thresholds are the default correctness criteria for predicted close price.
## 3. Rolling Accuracy Windows
For each window `W` (1d, 3d, 7d, 30d, custom):
- `strict_accuracy_W = strict_hits_W / n_W`
- `loose_accuracy_W = loose_hits_W / n_W`
Where `n_W` is number of valid forecast/actual pairs in that window.
## 4. Optional Direction Accuracy
Let direction be sign of close-to-close return.
- Direction hit if predicted direction equals realized direction.
- `direction_accuracy_W = direction_hits_W / n_W`
Use only when direction labels are explicitly available.
## 5. Forecast Correctness Score (Optional)
For a single forecast, you may map APE to a score:
- `correctness_score = max(0, 100 - 50 * APE_percent)`
Examples:
- `APE = 0.8%` -> score `60`
- `APE = 1.5%` -> score `25`
- `APE >= 2.0%` -> score `0` (or near 0)
## 6. Sample Size and Insufficient Data Rules
1. Never pad missing samples.
2. If `n_W = 0`, output `N/A` for the window.
3. If `0 < n_W < target_window_size`, output partial result and annotate as partial.
4. Always display `n_W` beside each window metric.
## 7. Adjustment and Comparability Rules
1. Prefer adjusted price series when corporate actions materially affect comparability.
2. If non-adjusted close is used, state it explicitly.
3. Keep forecast and actual on the same price basis.
## 8. Improvement Trend Metrics
Track whether forecast quality is improving over time:
1. `delta_APE_7d_vs_prev7d`
- Difference between current 7-day average APE and previous 7-day average APE.
2. `delta_strict_hit_rate_7d`
- Change in strict hit rate versus previous 7-day block.
3. `trend_label`
- `improving`, `stable`, or `degrading` based on combined delta signals.
## 9. Reporting Format (Minimum)
Every report should include:
1. Prior-session review row:
- `prev_pred_close_t1`, `prev_actual_close_t1`, `AE`, `APE`, strict/loose hit status
2. Rolling table with at least:
- 1d, 3d, 7d, 30d, optional custom
- strict accuracy, loose accuracy, optional direction accuracy
- sample size `n`
3. One-line interpretation:
- whether model performance is improving, stable, or degrading
4. Improvement block:
- what changed from review
- what will be adjusted in next run
@@ -0,0 +1,33 @@
# Minimal Compatibility Mode
Use this mode when Python scripts are unavailable or model capability is limited.
## Goal
Maximize success rate and correctness with minimal token and logic complexity.
## Rules
1. Read at most 3 recent reports for the same ticker.
2. Use minimal sources:
- one official disclosure source
- one reliable market data source (Yahoo Finance acceptable)
3. Keep output short and deterministic.
4. Still include one self-improvement action from prior misses.
## Minimal Output Schema
- `recommendation`: Buy/Hold/Sell/Watch
- `pred_close_t1`: point estimate
- `prev_pred_close_t1`: if available, else `N/A`
- `prev_actual_close_t1`: if available, else `N/A/pending`
- `AE`, `APE`: if available, else `N/A`
- `improvement_actions`: exactly 1 item
- `status`: `ok|pending_data|blocked`
## Minimal Source Checklist
1. Official disclosure page (exchange/regulator/IR)
2. Market quote page (for example Yahoo Finance quote)
If the two sources conflict on critical values, set confidence to `Low`.
@@ -0,0 +1,99 @@
# Report Template (Strict)
Use this template exactly. Keep key names unchanged for downstream parsing.
```markdown
---
version: 1
run_date: <YYYY-MM-DD>
run_time_local: <YYYY-MM-DD HH:mm TZ>
mode: <daily|daily_minimal|full_report>
ticker: <TICKER>
exchange: <EXCHANGE>
market: <TEXT>
report_dir: <working_directory>/daily-stock-analysis/reports/
output_file: <YYYY-MM-DD-TICKER-analysis.md or -vN.md>
report_versioning_mode: <overwrite|new_version>
history_window_days: <N>
recommendation: <Buy|Hold|Sell|Watch>
recommendation_triggers: <ENTRY/EXIT/INVALIDATION SUMMARY>
pred_close_t1: <NUMBER>
pred_range_t1: <LOW-HIGH or N/A>
pred_confidence: <High|Medium|Low>
pred_assumptions: <SHORT TEXT>
prev_pred_close_t1: <NUMBER or N/A>
prev_actual_close_t1: <NUMBER or pending or N/A>
AE: <NUMBER or N/A>
APE: <PERCENT or N/A>
strict_hit: <true|false|N/A>
loose_hit: <true|false|N/A>
acc_1d_strict: <PERCENT or N/A>
acc_1d_loose: <PERCENT or N/A>
acc_3d_strict: <PERCENT or N/A>
acc_3d_loose: <PERCENT or N/A>
acc_7d_strict: <PERCENT or N/A>
acc_7d_loose: <PERCENT or N/A>
acc_30d_strict: <PERCENT or N/A>
acc_30d_loose: <PERCENT or N/A>
acc_custom_strict: <PERCENT or N/A>
acc_custom_loose: <PERCENT or N/A>
improvement_actions:
- <ACTION_1>
- <ACTION_2 or N/A>
- <ACTION_3 or N/A>
status: <ok|pending_data|blocked>
status_note: <SHORT TEXT>
---
# Daily Stock Analysis - <TICKER> (<EXCHANGE>)
## 1) Market Snapshot
- Last/Close: <VALUE>
- Session Range: <LOW-HIGH>
- Volume/Volatility: <SUMMARY>
- Thesis: <BULLISH/NEUTRAL/BEARISH + concise rationale>
## 2) Recommendation
- Recommendation: <Buy/Hold/Sell/Watch>
- Trigger Conditions: <ENTRY/EXIT/INVALIDATION>
- Risk Controls: <SHORT TEXT>
## 3) Next Trading Day Prediction
- Point Forecast: <pred_close_t1>
- Range: <pred_range_t1>
- Confidence: <pred_confidence>
- Assumptions: <pred_assumptions>
## 4) Prior Forecast Review
- Previous Forecast: <prev_pred_close_t1>
- Actual Close: <prev_actual_close_t1>
- AE / APE: <AE> / <APE>
- Attribution: <WHY HIT OR MISS>
## 5) Rolling Accuracy
| Window | Strict | Loose |
|---|---:|---:|
| 1d | <acc_1d_strict> | <acc_1d_loose> |
| 3d | <acc_3d_strict> | <acc_3d_loose> |
| 7d | <acc_7d_strict> | <acc_7d_loose> |
| 30d | <acc_30d_strict> | <acc_30d_loose> |
| Custom | <acc_custom_strict> | <acc_custom_loose> |
## 6) Self-Improvement Actions for Next Run
1. <ACTION_1>
2. <ACTION_2 or N/A>
3. <ACTION_3 or N/A>
## 7) Sources (with timestamp)
- <SOURCE_1>
- <SOURCE_2>
- <SOURCE_3>
## 8) Disclaimer
This content is for research and informational purposes only and does not constitute investment advice or a return guarantee. Markets are risky; invest with caution.
```
@@ -0,0 +1,48 @@
# Search Query Templates (Concise)
Use these templates with search engines and `site:` filters.
Detailed source list is in `references/sources.md`.
## 1) Identity and Listing
- `<COMPANY> ticker symbol exchange`
- `<TICKER> exchange listing market`
## 2) Official Filings and Disclosures
- `<TICKER> official filings latest`
- `<COMPANY> investor relations latest release`
- `site:sec.gov <TICKER> 10-Q OR 10-K OR 8-K`
- `site:hkexnews.hk <TICKER> announcement`
- `site:sse.com.cn <TICKER> 公告`
- `site:szse.cn <TICKER> 公告`
## 3) Market Data and Price Context
- `site:finance.yahoo.com <TICKER> quote`
- `<TICKER> latest close open high low volume`
- `<TICKER> 52 week range market cap`
## 4) News and Analyst Context
- `site:reuters.com <TICKER> earnings guidance`
- `site:bloomberg.com <TICKER> stock news`
- `<TICKER> analyst rating target price`
## 5) Technical Context
- `<TICKER> RSI MACD moving average`
- `<TICKER> support resistance trend`
## 6) Macro Context (if used in thesis)
- `<MARKET> benchmark index today`
- `<MARKET> central bank policy rate outlook`
- `US 10Y yield today`
## Data Quality Rules
1. Prefer Tier-1 official sources first.
2. Cross-check critical values with two independent sources.
3. Record source URL and timestamp in report.
@@ -0,0 +1,27 @@
# Security and Privacy Rules
These rules are mandatory for both script mode and compatibility mode.
## Scope Control
1. Operate only under `working_directory`.
2. Do not read, move, or write files outside `working_directory`.
3. Do not follow symlinks when scanning report files.
## Data Minimization
1. Read only report files matching:
- `YYYY-MM-DD-<TICKER>-analysis.md`
- `YYYY-MM-DD-<TICKER>-analysis-vN.md`
2. Parse only required metadata fields.
3. Cap historical reads:
- script mode default: 5 files
- compatibility mode: 3 files
## Script Safety
1. Scripts are local-file utilities only; no network calls.
2. Migration is explicit and non-destructive:
- move only user-confirmed files
- skip when target already exists
3. If a safety check fails, return `blocked` with reason.
@@ -0,0 +1,104 @@
# Authoritative Information Sources
Use search engines with `site:` filters to prioritize authoritative sources.
## Source Priority
1. Tier 1 (Primary / official)
- Exchange and regulator disclosures
- Company investor-relations pages
- Official macro data publishers
2. Tier 2 (High-quality financial media/data)
- Yahoo Finance, Reuters, Bloomberg, WSJ, CNBC, MarketWatch
3. Tier 3 (Supporting context)
- TradingView, StockCharts, sector/ETF summaries
For critical values (close price, earnings, guidance, major filings), cross-check with at least two independent sources.
## Tier 1: Exchange and Regulatory Sources
### Global baseline
- Company Investor Relations pages
- Official exchange announcements for the ticker listing venue
### United States
- SEC EDGAR: [https://www.sec.gov/edgar/searchedgar/companysearch](https://www.sec.gov/edgar/searchedgar/companysearch)
- Nasdaq company pages: [https://www.nasdaq.com](https://www.nasdaq.com)
- NYSE company pages: [https://www.nyse.com](https://www.nyse.com)
### Hong Kong
- HKEXnews: [https://www.hkexnews.hk](https://www.hkexnews.hk)
### Mainland China
- SSE disclosures: [https://www.sse.com.cn/disclosure/](https://www.sse.com.cn/disclosure/)
- SZSE disclosures: [https://www.szse.cn/disclosure/](https://www.szse.cn/disclosure/)
### Japan
- JPX: [https://www.jpx.co.jp/english/](https://www.jpx.co.jp/english/)
- TDnet (Timely Disclosure): [https://www.release.tdnet.info/](https://www.release.tdnet.info/)
### United Kingdom
- London Stock Exchange RNS: [https://www.londonstockexchange.com/news](https://www.londonstockexchange.com/news)
### Europe (multi-country)
- Euronext news/disclosures: [https://live.euronext.com/en/markets](https://live.euronext.com/en/markets)
## Tier 2: High-Quality Financial Data and News
- Yahoo Finance: [https://finance.yahoo.com](https://finance.yahoo.com)
- Reuters Markets: [https://www.reuters.com/markets/](https://www.reuters.com/markets/)
- Bloomberg Markets: [https://www.bloomberg.com/markets](https://www.bloomberg.com/markets)
- WSJ Markets: [https://www.wsj.com/market-data](https://www.wsj.com/market-data)
- CNBC Markets: [https://www.cnbc.com/markets/](https://www.cnbc.com/markets/)
- MarketWatch: [https://www.marketwatch.com](https://www.marketwatch.com)
- Morningstar (supporting valuation context): [https://www.morningstar.com](https://www.morningstar.com)
## Tier 1 Macro Data (for market regime context)
### United States
- U.S. Treasury rates: [https://home.treasury.gov](https://home.treasury.gov)
- Federal Reserve (FRED): [https://fred.stlouisfed.org](https://fred.stlouisfed.org)
- BLS: [https://www.bls.gov](https://www.bls.gov)
- BEA: [https://www.bea.gov](https://www.bea.gov)
### Global
- IMF Data: [https://www.imf.org/en/Data](https://www.imf.org/en/Data)
- World Bank Data: [https://data.worldbank.org](https://data.worldbank.org)
- ECB: [https://www.ecb.europa.eu](https://www.ecb.europa.eu)
- BoE: [https://www.bankofengland.co.uk](https://www.bankofengland.co.uk)
- BoJ: [https://www.boj.or.jp/en/](https://www.boj.or.jp/en/)
## Technical/Charting Support (Tier 3)
- TradingView: [https://www.tradingview.com](https://www.tradingview.com)
- StockCharts: [https://stockcharts.com](https://stockcharts.com)
## Search Engine Patterns
Use search engines with domain filters:
- `site:finance.yahoo.com <TICKER> quote`
- `site:reuters.com <TICKER> earnings`
- `site:sec.gov <TICKER> 10-Q`
- `site:hkexnews.hk <TICKER> announcement`
- `site:sse.com.cn <TICKER> 公告`
- `site:szse.cn <TICKER> 公告`
- `site:investor.<company-domain> earnings release`
## Minimum Source Set Per Run
At least include:
1. One Tier-1 disclosure source
2. One Tier-2 market data source (Yahoo Finance is acceptable baseline)
3. One Tier-2/Tier-1 news source
4. One macro source if macro is cited in thesis
## Compatibility Mode Minimum Source Set
When running in minimal compatibility mode, use:
1. One Tier-1 disclosure source
2. One Tier-2 market data source (Yahoo Finance acceptable)
@@ -0,0 +1,77 @@
# Technical Analysis Reference
Use technical analysis as a decision support layer, not as a standalone certainty signal.
## 1. Trend Framework
1. Moving averages:
- 20/50/200-period moving averages as baseline trend map.
- Bullish regime: price above key moving averages with supportive slope.
- Bearish regime: price below key moving averages with negative slope.
2. Trend strength:
- Confirm with higher highs/higher lows (uptrend) or lower highs/lower lows (downtrend).
## 2. Momentum Framework
1. RSI:
- Overbought > 70, oversold < 30.
- Use divergence vs price as an early warning, not a standalone trigger.
2. MACD:
- Track line/signal crossovers and histogram trend.
- Prefer signals aligned with broader trend.
## 3. Volatility and Structure
1. ATR context:
- Use ATR expansion/contraction to assess regime change risk.
2. Bollinger context:
- Squeeze can precede expansion.
- Band walk can persist in strong trends.
## 4. Support and Resistance
Map levels from:
- Recent swing highs/lows
- Volume clusters
- Moving-average confluence
- Psychological round numbers
Use level breaks with volume confirmation where possible.
## 5. Volume Confirmation
1. Breakout quality improves with volume expansion.
2. Weak volume breakouts carry higher failure risk.
3. Divergence between price trend and volume trend can signal exhaustion.
## 6. Multi-Timeframe Alignment
1. Use higher timeframe (weekly/daily) for primary bias.
2. Use lower timeframe (daily/intraday where available) for timing.
3. Do not let lower timeframe noise override higher timeframe structure without strong evidence.
## 7. Signal Quality Rules
1. Require at least two independent confirmations before strong directional calls.
2. Mark low-confidence calls when indicators conflict.
3. Define invalidation level for every directional view.
## 8. Market-Specific Notes (US/CN/HK)
1. Liquidity and session structure differ by market.
2. Gap behavior and close auction effects may vary.
3. Technical indicator reliability can degrade during event-driven sessions.
## 9. Daily Output Guidance
At minimum provide:
- Trend state (bullish/neutral/bearish)
- 2-3 key levels
- RSI/MACD summary
- volume confirmation status
- invalidation condition
@@ -0,0 +1,104 @@
# Workflow (Command-First)
Use this sequence exactly.
## 0) Choose Execution Mode
Use `script` mode by default.
Switch to `compatibility` mode when:
- `python3` is unavailable, or
- model capability is low and deterministic minimal output is preferred.
## 1) Resolve Instrument
- Resolve `ticker`, `exchange`, `market`, and next valid trading day.
- If ticker is ambiguous, stop and ask user.
## 2) Plan Files and History
Run:
```bash
python3 {baseDir}/scripts/report_manager.py plan \
--workdir <working_directory> \
--ticker <TICKER> \
--run-date <YYYY-MM-DD> \
--versioning auto \
--history-limit 5
```
Use returned JSON fields:
- `selected_output_file`
- `requires_user_choice`
- `history_files`
- `legacy_files`
If `requires_user_choice=true`, ask user `overwrite` vs `new_version`.
Read only `history_files` returned by script (default max 5).
## 3) Legacy Compatibility (Optional Migration)
- Read legacy files from `legacy_files` for review history.
- If user agrees to migrate, run:
```bash
python3 {baseDir}/scripts/report_manager.py migrate \
--workdir <working_directory> \
--file <ABS_PATH_1> --file <ABS_PATH_2>
```
Security: only process files under `working_directory`.
## 4) Collect New Data
- Use `references/sources.md` tier priority.
- Use `references/search_queries.md` templates.
- For critical values, cross-check with at least 2 sources.
## 5) Compute Accuracy via Script
Run:
```bash
python3 {baseDir}/scripts/calc_accuracy.py \
--workdir <working_directory> \
--ticker <TICKER> \
--windows 1,3,7,30 \
--history-limit 60
```
Use script output to fill rolling accuracy fields.
## 6) Generate Report
- Render with `references/report_template.md`.
- Keep all required frontmatter keys.
- Include `improvement_actions`.
## 7) Persist and Return
- Save to `selected_output_file` from step 2.
- Return summary + absolute file path + pending/blocked status.
## 8) Recommended Operation
Use recurring weekday schedule to stabilize review windows and success rate.
## Compatibility Mode (Fallback)
When scripts cannot run:
1. Manually locate report files only under `working_directory`.
2. Read at most 3 recent same-ticker reports.
3. Collect minimal sources:
- one official disclosure source
- one reliable market data source
4. Produce minimal output:
- recommendation
- `pred_close_t1`
- prior review metrics (if available)
- one `improvement_action`
5. Save report in canonical reports directory using standard filename rules.