amazingdata统一数据平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Lxy 65dd83bb37
feat: 初始化代码
2 months ago
backend feat: 初始化代码 2 months ago
database feat: 初始化代码 2 months ago
frontend feat: 初始化代码 2 months ago
.env.example feat: 初始化代码 2 months ago
.gitignore feat: 初始化代码 2 months ago
Dockerfile.backend feat: 初始化代码 2 months ago
Dockerfile.frontend feat: 初始化代码 2 months ago
README.md feat: 初始化代码 2 months ago
docker-compose.yml feat: 初始化代码 2 months ago
nginx.conf feat: 初始化代码 2 months ago

README.md

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# AmazingData 数据服务平台

基于 AmazingData SDK 的企业级数据服务平台,提供股票、期货 K 线数据获取和实时订阅服务。

功能特性

1. 单只品种查询

  • 输入:品种代码(股票/期货)、交易日、周期、保存路径
  • 输出JSON 格式数据保存到指定目录

2. 批量股票获取

  • 输入:股票代码列表、交易日列表、保存路径
  • 输出:以每个交易日为文件名的 JSON 数据

3. 批量期货获取

  • 输入:期货品种代码、交易日列表、保存路径
  • 输出:以每个交易日为文件名的 JSON 数据

4. 实时订阅(股票)

  • 输入:股票代码、订阅周期、保存路径
  • 输出:按时间命名的实时数据文件

5. 实时订阅(期货)

  • 输入:期货代码、订阅周期、保存路径
  • 输出:按时间命名的实时数据文件

6. 批量品种订阅

  • 支持同时订阅多个品种
  • 支持多周期订阅

技术栈

  • 后端: FastAPI + SQLAlchemy + MySQL
  • 前端: Vue 3 + Vite + Element Plus
  • 数据源: AmazingData SDK
  • 部署: Docker + Docker Compose

快速开始

环境要求

  • Python 3.11+
  • Node.js 18+
  • MySQL 8.0+
  • AmazingData SDK

本地开发

1. 后端

\\ash cd amazingdata_platform

创建虚拟环境

python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate

安装依赖

pip install -r backend/requirements.txt

配置环境变量

cp .env.example .env

编辑 .env 文件

启动服务

uvicorn backend.main:app --reload --port 8000 \\

2. 前端

\\ash cd frontend

安装依赖

npm install

启动开发服务器

npm run dev \\

Docker 部署

\\ash

构建并启动

docker-compose up -d

查看日志

docker-compose logs -f

停止

docker-compose down \\

项目结构

\\ amazingdata_platform/ ├── backend/ # 后端服务 │ ├── api/ # API 路由 │ │ ├── auth.py # 认证接口 │ │ ├── historical.py # 历史数据接口 │ │ ├── realtime.py # 实时订阅接口 │ │ ├── batch.py # 批量操作接口 │ │ ├── cache.py # 缓存管理接口 │ │ └── settings.py # 系统配置接口 │ ├── auth/ # 认证模块 │ ├── models/ # 数据模型 │ ├── services/ # 业务逻辑 │ ├── config.py # 配置 │ └── main.py # 主应用 ├── frontend/ # 前端应用 │ ├── src/ │ │ ├── api/ # API 请求 │ │ ├── router/ # 路由 │ │ ├── stores/ # 状态管理 │ │ └── views/ # 页面组件 │ └── package.json ├── database/ # 数据库 │ └── init.sql # 初始化脚本 ├── docker-compose.yml # Docker 配置 ├── Dockerfile.backend # 后端 Dockerfile ├── Dockerfile.frontend # 前端 Dockerfile └── nginx.conf # Nginx 配置 \\

API 文档

启动服务后访问 \http://localhost:8000/docs\ 查看 Swagger API 文档。

主要接口

接口 方法 描述
/api/v1/auth/login\ POST 用户登录
/api/v1/historical/single\ POST 获取单只品种数据
/api/v1/historical/batch-stocks\ POST 批量获取股票数据
/api/v1/historical/batch-futures\ POST 批量获取期货数据
/api/v1/realtime/subscribe\ POST 创建实时订阅
/api/v1/realtime/tasks\ GET 获取订阅任务列表
/api/v1/realtime/stop/{id}\ POST 停止订阅任务
/api/v1/batch/execute\ POST 执行批量任务
/api/v1/batch/tasks\ GET 获取批量任务列表
/api/v1/cache/list\ GET 获取缓存文件列表
/api/v1/cache/stats\ GET 获取缓存统计
/api/v1/settings/amazing-data/config\ GET 获取 AmazingData 配置
/api/v1/settings/test-connection\ POST 测试连接

使用示例

获取单只股票数据

\\ash curl -X POST http://localhost:8000/api/v1/historical/single
-H
Content-Type: application/json\
-d '{ \code: \000001.SZ, \trading_day: \20260407, \period: \day, \save_path: ./data/single
}' \\

创建实时订阅

\\ash curl -X POST http://localhost:8000/api/v1/realtime/subscribe
-H \Content-Type: application/json\
-d '{ \codes: [\ag2605.SHF], \periods: [\min1, \min5], \save_path: ./data/realtime, \duration: 3600 }' \\

默认账号

  • 管理员: admin / admin123
  • 普通用户: user / user123

许可证

MIT License