Skip to content

RequiemG/ETF

Repository files navigation

ETF Tracking 项目启动说明

环境要求

  1. Python 3.x - 用于运行爬虫脚本

    • 需要安装依赖: pip install requests
  2. Java 17+ - 用于运行SpringBoot后端

  3. Node.js 18+ - 用于运行前端项目

快速启动

1. 安装依赖

# Python依赖
cd crawler
pip install requests

# 前端依赖
cd ../frontend
npm install

2. 启动后端

cd backend
mvn spring-boot:run

后端将在 http://localhost:8080 启动

3. 启动前端

cd frontend
npm run dev

前端将在 http://localhost:3000 启动

项目结构

ETFTracking/
├── backend/           # SpringBoot后端
│   ├── src/
│   │   └── main/
│   │       ├── java/com/etf/tracking/
│   │       │   ├── controller/    # REST API控制器
│   │       │   ├── service/       # 业务逻辑
│   │       │   ├── mapper/         # 数据访问层
│   │       │   └── entity/         # 实体类
│   │       └── resources/
│   │           ├── application.yml # 配置文件
│   │           └── schema.sql      # 数据库初始化
│   └── pom.xml
├── frontend/          # React前端
│   ├── src/
│   │   ├── components/  # 组件
│   │   ├── pages/       # 页面
│   │   ├── services/    # API服务
│   │   └── types/      # TypeScript类型
│   └── package.json
├── crawler/           # Python爬虫
│   └── etf_crawler.py  # 爬虫脚本
└── data/              # 数据库文件
    └── etf.db         # SQLite数据库

功能说明

ETF管理

  • 添加/编辑/删除ETF
  • 查看ETF列表

数据爬取

  • 爬前一天: 一键爬取所有ETF的前一天数据
  • 爬指定时段: 选择ETF和日期范围进行爬取

数据展示

  • 行情走势图: 展示成交量和涨跌幅
  • 规模份额图: 展示基金规模和总份额变化
  • 历史数据表: 查看所有历史数据

API接口

方法 路径 说明
GET /api/etf 获取ETF列表
POST /api/etf 添加/更新ETF
DELETE /api/etf/{id} 删除ETF
GET /api/etf/{code}/data 获取ETF历史数据
POST /api/etf/crawl/yesterday 爬前一天数据
POST /api/etf/crawl/range 爬取指定时间段
GET /api/crawl/logs 获取爬取日志

注意事项

  1. 首次启动会自动创建SQLite数据库
  2. 上交所API可能有访问频率限制,爬取时请适度
  3. 历史行情数据只支持最近一天,其他数据需要从上交所补充

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors