Skip to content

feat: enhanced fundamentals, sector browsing, batch support, peer comparison & report checklist#8

Merged
ShuhaoQing merged 8 commits intomainfrom
feat/enhanced-fundamentals
Apr 2, 2026
Merged

feat: enhanced fundamentals, sector browsing, batch support, peer comparison & report checklist#8
ShuhaoQing merged 8 commits intomainfrom
feat/enhanced-fundamentals

Conversation

@ShuhaoQing
Copy link
Copy Markdown
Owner

@ShuhaoQing ShuhaoQing commented Apr 2, 2026

Summary

  • Phase 1: Extended BasicInfo/FundamentalAnalysis with 12+ financial metrics (ROE, ROA, D/E, margins, cash flow, PEG). Added FinancialHealthAssessment with Chinese-language profitability/growth/leverage/cash flow ratings. Providers (AKShare + yfinance) extract new fields with proper normalization (ratios → percentages at provider level).
  • Phase 2: New market sector-list and market sector <name> commands for A-share industry board browsing via AKShare.
  • Phase 3: Batch support (comma-separated symbols) for market quote, analyze fundamental, and analyze technical — single symbol uses kv_output, multi uses tsv_output comparison table.
  • Phase 4: New analyze peer <symbol> for same-sector peer comparison (A-shares, uses sector constituent data directly without per-peer API calls).
  • Phase 5: Enhanced analyze report with 5-dimension buy-readiness checklist (估值/盈利能力/成长性/风险/技术面, 1-5 scale each). Sectioned Chinese output.
  • Phase 6: Rewrote SKILL.md from command reference to 6 intent-based agent workflows (stock analysis, investment direction, buy decision, stock comparison, portfolio checkup, decision review).
  • Review fixes: Normalized revenue_growth at provider level, added _bypass_proxy() to financial indicators API, added operating_cash_flow to StockReport, added batch CLI tests.

Test plan

  • pytest — 243 tests pass (non-integration)
  • ruff check . — all checks pass
  • ruff format --check . — all files formatted
  • Manual: uv run haoinvest analyze fundamental 600519 (A-share with new metrics)
  • Manual: uv run haoinvest analyze fundamental AAPL -m us (US stock)
  • Manual: uv run haoinvest market sector-list (sector browsing)
  • Manual: uv run haoinvest analyze report 600519 (full report + checklist)

🤖 Generated with Claude Code

Shuhao Qing and others added 8 commits April 2, 2026 23:26
Extend BasicInfo with ROE, ROA, debt-to-equity, revenue growth, margins,
current ratio, cash flow, and PEG ratio. Add FinancialHealthAssessment
model with multi-dimensional Chinese-labeled scoring (profitability,
growth, leverage, cash flow). USProvider extracts from yfinance ticker.info;
AKShareProvider fetches via stock_financial_analysis_indicator with graceful
fallback. CLI `analyze fundamental` now shows all metrics, with --verbose
for health assessment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add get_sector_list() and get_sector_constituents() to AKShareProvider
using AKShare's stock_board_industry_spot_em and stock_board_industry_cons_em
APIs. New CLI commands: `market sector-list` for industry board ranking,
`market sector <name>` for constituents with PE/PB/market cap. Enables
users to discover investment opportunities by sector.

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

All three commands now accept comma-separated symbols for side-by-side
comparison via TSV output. Single-symbol input retains original kv_output
behavior. Follows existing correlation command pattern for multi-symbol
parsing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
New `analyze peer <symbol>` command finds same-sector stocks via
AKShareProvider.get_sector_constituents() and presents a TSV comparison
table sorted by market cap. Uses sector constituent data directly to
avoid excessive API calls. US stocks return a 'not yet supported' message.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
New `analyze report` command generates a full multi-section analysis:
basic info, valuation, financial health, risk metrics, technical signals,
and a 5-dimension buy-readiness checklist (1-5 scoring per dimension).
Checklist covers: valuation, profitability, growth, risk, and technicals.
Produces recommendation: 建议关注/谨慎观望/建议回避.

Added ChecklistItem and BuyReadinessChecklist models. Enhanced StockReport
with all Phase 1 financial metrics and checklist field.

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

Rewrite SKILL.md from command reference to agent orchestration guide.
Six workflows: stock analysis, investment direction, buy decision,
stock comparison, portfolio checkup, and decision review. Each workflow
defines step-by-step CLI commands + agent interpretation guidelines.
Added teaching mode section for beginner-friendly explanations.

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

- Add _ratio_to_pct() in us_provider to normalize ratios at provider level
- Remove flawed ratio/pct heuristic from _assess_growth and _score_growth
- Add _bypass_proxy() around _akshare_financial_indicators API call
- Add operating_cash_flow to StockReport model and report passthrough
- Add batch CLI tests for market quote, analyze fundamental, analyze technical
- Fix test data to use percentage format (25.0 instead of 0.25)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
AKShare sector APIs use eastmoney push2 endpoints which are frequently
unreachable (IP bans, CDN issues). Add Sina Finance API as fallback:
- _sina_sector_list(): fetches industry board ranking from Sina
- _sina_sector_constituents(): fetches sector stocks with PE/PB/market cap
- Both sector methods now use _with_fallback() pattern

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ShuhaoQing ShuhaoQing merged commit 53e18c7 into main Apr 2, 2026
1 check passed
@ShuhaoQing ShuhaoQing deleted the feat/enhanced-fundamentals branch April 2, 2026 16:09
ShuhaoQing pushed a commit that referenced this pull request Apr 2, 2026
Add documentation for peer comparison, sector browsing, batch fundamental
analysis, and comprehensive report with buy-readiness checklist.
Expand analysis/ directory listing in CLAUDE.md project structure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ShuhaoQing added a commit that referenced this pull request Apr 2, 2026
## Summary
- Add peer comparison, sector browsing, batch fundamental, and
comprehensive report to README features list
- Add CLI examples for `analyze peer`, `analyze report`, `market
sector-list`, `market sector`, and batch `fundamental`
- Expand `analysis/` directory listing in CLAUDE.md project structure
with all module descriptions

## Test plan
- [x] Verify README CLI examples match actual command signatures
- [x] Verify CLAUDE.md project structure matches filesystem

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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