Skip to content

feat: upgrade from health-check tool to investment research system#15

Merged
ShuhaoQing merged 6 commits intomainfrom
feat/investment-research-system
Apr 8, 2026
Merged

feat: upgrade from health-check tool to investment research system#15
ShuhaoQing merged 6 commits intomainfrom
feat/investment-research-system

Conversation

@ShuhaoQing
Copy link
Copy Markdown
Owner

@ShuhaoQing ShuhaoQing commented Apr 8, 2026

Summary

Transforms haoInvest from a stock "health check" tool into a full investment research system across 5 phases:

  • Data expansion: migrated data dir to project-local .haoinvest/, expanded eastmoney financial fields (37→ALL columns), multi-period data (8 quarters)
  • Stock screening: integrated eastmoney xuangu API (market screen) and sector capital flow (market sector-flow)
  • Thesis tracking: full lifecycle management (add/list/show/invalidate/realize/review) with guardrails integration for overdue review alerts
  • Knowledge base: Obsidian vault templates + updated SKILL.md workflows (zero custom code, leverages obsidian-cli skill)
  • Analysis depth: financial trends module, PE/PB percentile in peer comparison, volume-weighted signal confidence
  • Skill reference files: A-share analysis framework, valuation guide, position management, screening workflow

Changes (27 files, +1468/-124)

Area Key files
Data sources eastmoney.py (screening, sector flow, expanded fields)
Models models.py (ThesisStatus, InvestmentThesis, expanded BasicInfo)
Persistence db.py (investment_theses table + CRUD)
Analysis trends.py (new), peer.py (percentiles), signals.py (volume voting), registry.py (8 modules)
CLI market.py (screen, sector-flow), portfolio.py (thesis subcommands)
Guardrails alerts.py (thesis review alerts)
Skills SKILL.md (workflows), references/ (4 framework files)
Config config.py (project-local data dir)

Test plan

  • pytest — 346 passed, 15 deselected (integration)
  • ruff check . — clean
  • ruff format --check . — clean
  • Manual: uv run haoinvest market screen --pe-max 20 --roe-min 15
  • Manual: uv run haoinvest portfolio thesis add 600519 1500 "test"
  • Manual: uv run haoinvest analyze run 600519 --modules trends

🤖 Generated with Claude Code

Shuhao Qing and others added 6 commits April 8, 2026 16:01
Phase 0: Migrate data directory from ~/.haoinvest/ to project-local
.haoinvest/ for easier IDE browsing. Existing DB copied over.

Phase 1a: Expand eastmoney RPT_LICO_FN_CPD from 6 fields to ALL (37),
adding dividend yield, revenue/profit growth, EPS, BPS, cash flow
per share. These were already in the API response but not extracted.

Phase 1b: Support multi-period financial data (periods parameter)
for historical trend analysis across quarterly reports.

Phase 1c: Create skill reference files in references/ directory:
- a-share-analysis-framework.md (5-dimension analysis for A-shares)
- valuation-guide.md (relative valuation, industry-specific PE/PB)
- position-management.md (add/reduce/rotate decision framework)
- stock-screening-workflow.md (top-down screening with strategies)

Phase 1d: Simplify hardcoded valuation judgments — code now outputs
data-focused labels (PE/PB values) instead of absolute verdicts.
Deep interpretation delegated to Claude via reference files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add screen_stocks() via eastmoney xuangu API with filters (PE, PB, ROE,
market cap, dividend yield) and sector_flow() via push2 endpoint (beta).
New CLI commands: `market screen` and `market sector-flow`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add InvestmentThesis model, DB table + CRUD, and CLI commands (add, list,
show, invalidate, realize, review). Guardrails alerts now check for
overdue thesis reviews and prefer structured theses over journal entries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Create vault directory structure with note templates (个股/政策).
Update SKILL.md with screening, thesis, and Obsidian workflows.
Add reference files and command docs for new Phase 2-3 features.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ignals

- Add `trends` analysis module: multi-period financial data (ROE, revenue
  growth, profit margin, EPS across 8 quarters)
- Add PE/PB percentile within sector peers for relative valuation
- Volume confirmation now votes (+1) in signal aggregation when anomaly
  detected, boosting confidence for volume-confirmed signals

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add json.loads exception handling in thesis CLI (friendly error message)
- Fix config.py docstring (data/ → .haoinvest/)
- Add THESIS_REVIEW AlertType instead of reusing GAIN_REVIEW
- Unify get_financial_indicators return type to always list[dict]
- Use bisect for O(log n) percentile calculation in peer comparison
- Add _project_root() fallback warning log
- Add screen_stocks PE exclusion note in docstring
- Remove redundant datetime import in alerts.py
- Add tests: thesis CRUD (7 tests), thesis review alerts (3 tests)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ShuhaoQing ShuhaoQing merged commit aceebf2 into main Apr 8, 2026
1 check passed
@ShuhaoQing ShuhaoQing deleted the feat/investment-research-system branch April 8, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant