by simonlin1212
A股 PEG 估值分析工具 — 彼得·林奇 PEG 投资法本地化实践 | A-share PEG valuation tool with AI-powered analysis
# Add to your Claude Code skills
git clone https://github.com/simonlin1212/astock-pegLast scanned: 7/25/2026
{
"issues": [],
"status": "PASSED",
"scannedAt": "2026-07-25T06:19:53.598Z",
"npmAuditRan": true,
"pipAuditRan": true,
"promptInjectionRan": true
}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 103 GitHub stars.
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.
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).
astock-peg is primarily written in TypeScript. It is open-source under simonlin1212 on GitHub, so you can review or fork the full source.
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.
No comments yet. Be the first to share your thoughts!
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 秒。
输入股票代码,实时监控价格、涨跌幅、PE(TTM)、PB、市值。一键发起 AI 分析。
自动采集财务数据 → 送入大模型 → 生成 7 节结构化分析报告(基本面快照、PEG 核心分析、PE 消化时间、盈利质量验证、同行对比、风险提示、综合结论),支持导出 PDF。
输入任意一只股票 → 自动识别所属行业 → 展示行业市值前 20 名的 PE 分布、板块均值/中位数。
个股新闻 + 市场快讯聚合,辅助判断 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 CSS | Turbopack 热更新 |
| 行情数据 | 腾讯财经 HTTP API | 免费、不限频、无需 token |
| 财务/研报/新闻 | 直连 HTTP(东财·同花顺·新浪·巨潮)+ mootdx | Python 脚本采集,零 akshare 依赖 |
| AI 引擎 | Anthropic / OpenAI(用户自备 key) | 可接任何兼容接口 |
| 存储 | JSON 文件 | 无数据库依赖 |
| 数据源 | 协议 | 提供数据 | 限制 |
|---|---|---|---|
| 腾讯财经 | HTTP (qt.gtimg.cn) | 实时行情、PE、PB、市值、涨跌幅 | 免费,无需认证 |
| mootdx | TCP (7709) | F10 行业归属、同行业个股、财务快照 | 免费,需国内 IP |
| 东财 eastmoney | HTTP | 研报、个股新闻、全球资讯(替代财联社) | 免费,已内置 em_get 限流防封 |
| 同花顺 10jqka | HTTP | 机构一致预期 EPS | 免费 |
| 新浪财经 | HTTP | 多期利润表(成长历史) | 免费 |
| 巨潮 cninfo | HTTP | 公司公告全文 | 免费 |
全部数据源免费 + 无需申请 API Key(AI 分析除外),且零 akshare 依赖(v1.1.0 全量替换为直连 HTTP)。东财系接口有访问频率风控,已统一经 em_get() 串行限流防封。
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
行情看板和板块 PE 对比不需要 AI key,装好 Node.js + Python 依赖就能直接用。AI 分析报告功能需要配置一个大模型 API key。
两条接入路径,任选其一:
ANTHROPIC_BASE_URL / ANTHROPIC_MODEL)。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
前瞻 PE = 当前价格 / 一致预期 EPS(2026)
PEG = 前瞻 PE / (净利润 CAGR × 100)
PE 消化年限 = ln(前瞻PE / 30) / ln(1 + CAGR)
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
如果这个工具帮到了你的投研工作流,欢迎请作者喝杯咖啡 ☕
想要什么功能?欢迎开 Issue 提需求,赞助者的 Issue 优先处理。
作者: Simon 林 · 抖音「Simon林」 · 公众号「硅基世纪」
A PEG (Price/Earnings-to-Growth) valuation analysis tool for China A-shares, inspired by Peter Lynch's investment methodology.
git clone https://github.com/simonlin1212/astock-peg.git
cd astock-peg/web
cp .env.example .env # Fill in your AI API key
npm install && npm run dev
Prerequisites: Node.js 18+, Python 3.10+ (Windows auto-detected, no python3 needed), pip install -r scripts/requirements.txt (akshare removed in v1.1.0)
Forward PE = Current Price / Consensus EPS (2026)
PEG = Forward PE / (Net Profit CAGR × 100)
PE Digestion Years = ln(Forward PE / 30) / ln(1 + CAGR)
This tool is for educational and research purposes only. It does not constitute investment advice. Please consult licensed professionals for investment decisions.
Apache 2.0
Author: Simon Lin · TikTok @simonlin121212 · Douyin "Simon林" · WeChat Official Account "硅基世纪"