# fund-analyzer **Repository Path**: hejsky/fund-analyzer ## Basic Information - **Project Name**: fund-analyzer - **Description**: 基金计算程序,基金是基于股票等综合元素计算的收益,所有我想综合基金包含的股票和行业信息等 根据提供的基金编号一个或多个,大概计算分析出这些基金今天的涨、跌比例或百分比 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-10 - **Last Updated**: 2026-06-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 基金估算分析器 一个轻量、独立的基金当日涨跌幅**估算**工具。基于基金最新一期披露的重仓股,按持仓比例对股票当日实时涨跌幅做加权平均,得到基金估算涨跌幅。 > ⚠️ **免责声明**:本工具仅供学习和参考,**不构成任何投资建议**。基金实际涨跌幅以基金公司/销售渠道最终公布数据为准。 ## ✨ 功能 - 🔍 输入 1 个或多个基金编号,一键估算今日涨跌幅 - 📊 4 类图表:重仓股占比饼图、行业环形图、估算 vs 实际对比、最新净值 - 💡 自动生成简单投资建议(强势 / 稳健 / 观望 / 风险) - 🏭 行业分布聚合 + 集中度提示 - 📰 基金相关动态聚合 - 💾 5 分钟本地 SQLite 缓存 - 🛡️ 多数据源自动容错降级 ## 🏗️ 技术栈(全国产) | 层 | 选型 | |---|---| | 后端 | FastAPI + Uvicorn | | 前端框架 | Vue 3 + Vite + TypeScript | | UI 组件库 | TDesign Vue(腾讯) | | 图表库 | ECharts(百度) | | HTTP 客户端 | Axios | ## 📁 项目结构 ``` fund-analyzer/ ├── backend/ # FastAPI 后端 │ ├── main.py # 入口(含 CORS 配置) │ ├── api/ │ │ └── fund.py # 路由:/api/analyze、/api/clear-cache │ └── requirements.txt ├── frontend/ # Vue 3 前端 │ ├── package.json │ ├── vite.config.ts # dev 代理 /api → 8000 │ ├── index.html │ └── src/ │ ├── main.ts │ ├── App.vue │ ├── views/ │ │ └── Home.vue │ ├── components/ # 输入区、对比表、详情、4 个 ECharts 图 │ ├── api/fund.ts │ ├── utils/format.ts │ └── types/index.ts ├── services/ # 业务逻辑(前后端共用) │ ├── data_source.py │ ├── calculator.py │ ├── analyzer.py │ ├── suggestion.py │ ├── cache.py │ └── utils.py ├── tests/ # pytest 单元测试(125 个) ├── config.py └── requirements.txt ``` ## 🚀 启动 需要 Python 3.10+ 和 Node.js 18+。 ### 1. 后端(端口 8000) ```powershell cd d:\gitee\fund-analyzer .\.venv\Scripts\python.exe -m pip install -r requirements.txt -r backend\requirements.txt .\.venv\Scripts\python.exe -m uvicorn backend.main:app --reload --port 8000 ``` 接口文档:[http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs) ### 2. 前端(端口 5173) ```powershell cd d:\gitee\fund-analyzer\frontend npm install npm run dev ``` 浏览器自动打开 [http://localhost:5173](http://localhost:5173) ## 📝 使用示例 1. 在输入框输入基金编号(多个用逗号或空格分隔),如:`000001, 161725, 110011` 2. 点击「分析」按钮 3. 查看顶部对比表 + 各基金详情图表 > 股票代码(如 `601991` 大唐发电)不是基金,会被软提示但仍会提交,由后端给出准确错误。 ## 🔧 数据源 - **东财天天基金**(主要):`fundgz.1234567.com.cn` / `fundf10.eastmoney.com` / `push2.eastmoney.com` - **新浪财经**(备用):`hq.sinajs.cn` 所有接口均为公开数据,无需注册/Key。 ## 🧪 测试 ```powershell cd d:\gitee\fund-analyzer .\.venv\Scripts\python.exe -m pytest tests/ ``` 当前 125 个测试全部通过(业务逻辑 + FastAPI 端点)。 ## 📄 License MIT