astock-peg

by simonlin1212Verified

A股 PEG 估值分析工具 — 彼得·林奇 PEG 投资法本地化实践 | A-share PEG valuation tool with AI-powered analysis

108
Stars
39
Forks
TypeScript
Language
8/24/2026
Added
View on GitHubDownload ZIP

⚠️ Third-Party Software Notice

This skill is third-party open-source software developed and hosted independently on GitHub. SkillTip is an informational directory and does not control or maintain the underlying repository. Any security checks displayed are automated and limited in scope. Review the source code before installing.

Read the Terms of Service

Installation

Add to your Claude Code skills directory:

# Add to your Claude Code skills
git clone https://github.com/simonlin1212/astock-peg

Getting Started

Guides for using skills like astock-peg.

Security Report

Verified

Last scanned: —

{
  "status": "PASSED",
  "issues": []
}

README.md

简体中文 | English

astock-peg

A 股 PEG 估值分析工具 — Next.js 全栈 · AI 生成估值报告 · 行业板块 PE 对比 · 零数据库依赖

License Next.js Stars

为什么做这个工具 · 功能演示 · 技术架构 · 数据源 · 快速开始 · PEG 计算逻辑

本工具只做 PEG 相关的计算与数据呈现,不做估值定性、不给买卖建议、不预测涨跌,不构成任何投资建议,投资决策请咨询持牌专业机构。

为什么做这个工具

PE 只告诉你一只股票"贵不贵",但不告诉你"贵得值不值"。

PEG(市盈率相对盈利增长比率) 是彼得·林奇提出的核心估值指标,用一个公式把"估值"和"成长性"绑在一起:

PEG = PE / 盈利增速(%)
PEG 区间数值关系
< 1.0前瞻 PE 低于盈利增速
1.0 - 1.5前瞻 PE 与盈利增速接近
> 1.5前瞻 PE 高于盈利增速

本工具只输出计算结果(PEG 数值、前瞻 PE、CAGR、PE 消化年数、同行数值对比), 不给「低估 / 高估」这类估值定性,也不给买卖时机、目标价或操作倾向 —— 估值是否合适由你自己判断。

问题是:手动计算 PEG 需要翻财报、查一致预期、算 CAGR、对比同行 —— 每只股票重复一遍非常低效。

这个工具解决的问题:输入 6 位股票代码,自动完成数据采集 → PEG 计算 → AI 估值报告生成 → 同行业 PE 对比,全流程 < 30 秒。


功能演示

1. PEG 看板

输入股票代码,实时监控价格、涨跌幅、PE(TTM)、PB、市值。一键发起 AI 分析。

2. AI PEG 估值报告

自动采集财务数据 → 送入大模型 → 生成 7 节结构化分析报告(基本面快照、PEG 核心分析、PE 消化时间、盈利质量验证、同行对比、风险提示、综合结论),支持导出 PDF。

3. 行业板块 PE 对比

输入任意一只股票 → 自动识别所属行业 → 展示行业市值前 20 名的 PE 分布、板块均值/中位数。

4. 新闻资讯

个股新闻 + 市场快讯聚合,辅助判断 PEG 分析中的定性因素。


技术架构

┌───────────────────────────────────────────────────┐
│                   Browser (Next.js)                │
│  Dashboard · AI Analysis · Sector · News          │
├───────────────────────────────────────────────────┤
│               Next.js API Routes                  │
│  /api/quotes · /api/stocks · /api/analysis        │
│  /api/sector · /api/sector/detect · /api/news     │
├───────────────────────────────────────────────────┤
│           Data Layer (Multi-Source)                │
│  腾讯财经 API ──── 实时行情(PE/PB/价格/市值)     │
│  mootdx ────────── 行业检测(F10)+ 财务快照        │
│  直连 HTTP ─────── 研报/新闻/公告/一致预期/财报     │
│   (东财·同花顺·新浪·巨潮,零 akshare,东财已限流) │
├───────────────────────────────────────────────────┤
│              AI Engine (Pluggable)                 │
│  Anthropic Claude / OpenAI GPT / 兼容接口          │
├───────────────────────────────────────────────────┤
│              Storage (JSON Files)                  │
│  portfolio.json · analyses/index.json             │
│         零数据库 · 零外部服务依赖                   │
└───────────────────────────────────────────────────┘
技术说明
前端Next.js 16 + React 19 + Tailwind CSSTurbopack 热更新
行情数据腾讯财经 HTTP API免费、不限频、无需 token
财务/研报/新闻直连 HTTP(东财·同花顺·新浪·巨潮)+ mootdxPython 脚本采集,零 akshare 依赖
AI 引擎Anthropic / OpenAI(用户自备 key)可接任何兼容接口
存储JSON 文件无数据库依赖

数据源

数据源协议提供数据限制
腾讯财经HTTP (qt.gtimg.cn)实时行情、PE、PB、市值、涨跌幅免费,无需认证
mootdxTCP (7709)F10 行业归属、同行业个股、财务快照免费,需国内 IP
东财 eastmoneyHTTP研报、个股新闻、全球资讯(替代财联社)免费,已内置 em_get 限流防封
同花顺 10jqkaHTTP机构一致预期 EPS免费
新浪财经HTTP多期利润表(成长历史)免费
巨潮 cninfoHTTP公司公告全文免费

全部数据源免费 + 无需申请 API Key(AI 分析除外),且零 akshare 依赖(v1.1.0 全量替换为直连 HTTP)。东财系接口有访问频率风控,已统一经 em_get() 串行限流防封。


快速开始

环境要求

  • Node.js 18+
  • Python 3.10+(Windows 用户:仓库已自动适配 python,无需 python3
  • pip install -r scripts/requirements.txt(mootdx / requests / pandas / lxml,已移除 akshare

安装 & 运行

git clone https://github.com/simonlin1212/astock-peg.git
cd astock-peg/web

# 配置 AI key(AI 分析功能需要,行情和板块对比不需要)
cp .env.example .env
# 编辑 .env,填入 ANTHROPIC_API_KEY 或 OPENAI_API_KEY

npm install
npm run dev

打开 http://localhost:3000

不配置 AI Key 也能用

行情看板和板块 PE 对比不需要 AI key,装好 Node.js + Python 依赖就能直接用。AI 分析报告功能需要配置一个大模型 API key。

兼容的 AI 提供商

两条接入路径,任选其一:

  • Anthropic 格式:Claude 官方,或任何兼容 Anthropic Messages API 的中转(配 ANTHROPIC_BASE_URL / ANTHROPIC_MODEL)。
  • OpenAI 兼容格式:未设 ANTHROPIC_API_KEY 时自动启用。除 OpenAI 官方外,可通过 OPENAI_BASE_URL + OPENAI_MODEL 接入任意 OpenAI 兼容供应商——DeepSeek / 通义 / 智谱 / Kimi / OpenRouter / 本地 Ollama 等。

DeepSeek 示例(web/.env):

OPENAI_API_KEY=sk-你的deepseek-key
OPENAI_BASE_URL=https://api.deepseek.com
OPENAI_MODEL=deepseek-chat

PEG 计算逻辑

前瞻 PE = 当前价格 / 一致预期 EPS(2026)
PEG = 前瞻 PE / (净利润 CAGR × 100)
PE 消化年限 = ln(前瞻PE / 30) / ln(1 + CAGR)
  • 一致预期 EPS:来自机构研报的一致预期数据
  • CAGR:近 3 年净利润复合增速
  • 消化年限:假设合理 PE = 30x,计算当前估值自然消化到合理水平需要几年
    • < 2 年 = 成长性强
    • 2-4 年 = 正常
    • > 4 年 = 需谨慎

项目结构

astock-peg/
├── web/                        Next.js 全栈应用
│   ├── src/app/                页面(首页看板 / AI分析 / 板块对比 / 新闻)
│   ├── src/app/api/            API Routes(行情 / 股票管理 / 分析 / 板块)
│   ├── src/components/         React 组件
│   ├── src/lib/                数据层(portfolio / analysis / tencent-api)
│   ├── src/hooks/              React Hooks
│   ├── portfolio.json          运行时数据(你的自选股列表,gitignore)
│   └── .env.example            API Key 配置模板
├── scripts/                    Python 数据采集脚本
│   ├── collect_stock_data.py   个股财务数据采集
│   ├── collect_news.py         新闻公告采集
│   └── detect_sector.py        行业板块识别
├── analyses/                   AI 分析报告存储(自动生成)
│   └── index.json              分析记录索引
├── LICENSE                     Apache 2.0
└── README.md

更新日志

CHANGELOG.md


免责声明

本工具只做 PEG 相关的计算与数据呈现,不做估值定性、不给买卖建议、不预测涨跌。不构成任何投资建议,投资决策请咨询持牌专业机构。


赞赏

如果这个工具帮到了你的投研工作流,欢迎请作者喝杯咖啡 ☕

Buy Me a Coffee

想要什么功能?欢迎开 Issue 提需求,赞助者的 Issue 优先处理。


License

Apache License 2.0


作者: Simon 林 · X @linsizhen · 邮箱:simonlin0423@gmail.com

Frequently Asked Questions

What is astock-peg?

astock-peg is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by simonlin1212. A股 PEG 估值分析工具 — 彼得·林奇 PEG 投资法本地化实践 | A-share PEG valuation tool with AI-powered analysis. It has 108 GitHub stars.

Is astock-peg safe to use?

Yes. astock-peg passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install astock-peg?

Clone the repository with "git clone https://github.com/simonlin1212/astock-peg" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is astock-peg written in?

astock-peg is primarily written in TypeScript. It is open-source under simonlin1212 on GitHub, so you can review or fork the full source.

Are there alternatives to astock-peg?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh astock-peg against similar tools.

Comments (0)

No comments yet. Be the first to share your thoughts!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI Agentsai-agentsanthropicclaude-code
View details
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI Agentsai-agentsbrainstorming
View details

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI Agentsai-agentsanthropicclaude-code
View details

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI Agentsclaude-codeai-tools
View details

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI Agents
View details

Developers Also Liked

Based on votes and bookmarks from developers who liked this skill

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI Agentsai-agentsanthropicclaude-code
View details
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI Agentsai-agentsbrainstorming
View details

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP Serversapisai-tools
View details

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI Agentsai-agentsanthropicclaude-code
View details

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI Agentsclaude-codeai-tools
View details