Initial commit

This commit is contained in:
2025-10-11 11:55:25 +08:00
parent 467dad8449
commit 8107dee8d3
2879 changed files with 610575 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
{
"permissions": {
"allow": [
"Bash(npm test:*)",
"Bash(xargs ls:*)",
"Bash(awk:*)",
"Bash(npm start)",
"Bash(python3:*)"
],
"deny": [],
"ask": []
}
}

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

42
.gitignore vendored Normal file
View File

@@ -0,0 +1,42 @@
node_modules
package-lock.json
yarn.lock
build
node_modules
# 依赖
node_modules/
/.pnp
.pnp.js
# 测试
/coverage
# 生产构建
/build
/dist
# 环境变量
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
# 日志
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# 编辑器
.vscode/
.idea/
*.swp
*.swo
*~
# macOS
.DS_Store
# Windows
Thumbs.db

3
.npmrc Normal file
View File

@@ -0,0 +1,3 @@
legacy-peer-deps=true
auto-install-peers=true
strict-peer-dependencies=false

91
CLAUDE.md Normal file
View File

@@ -0,0 +1,91 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
This is a hybrid React dashboard application with a Flask/Python backend. The project is built on the Argon Dashboard Chakra PRO template and includes financial/trading analysis features.
### Frontend (React + Chakra UI)
- **Framework**: React 18.3.1 with Chakra UI 2.8.2
- **Styling**: Tailwind CSS + custom Chakra theme
- **Build Tool**: React Scripts with custom Gulp tasks
- **Charts**: ApexCharts, ECharts, and custom visualization components
### Backend (Flask/Python)
- **Framework**: Flask with SQLAlchemy ORM
- **Database**: ClickHouse for analytics + MySQL/PostgreSQL
- **Features**: Real-time data processing, trading analysis, user authentication
- **Task Queue**: Celery for background processing
## Development Commands
### Frontend Development
```bash
npm start # Start development server (port 3000, proxies to localhost:5001)
npm run build # Production build with license headers
npm test # Run React test suite
npm run lint:check # Check ESLint rules
npm run lint:fix # Auto-fix ESLint issues
npm run install:clean # Clean install (removes node_modules and package-lock)
```
### Backend Development
```bash
python app_2.py # Start Flask server (main backend)
python simulation_background_processor.py # Background data processor
```
### Python Dependencies
Install from requirements.txt:
```bash
pip install -r requirements.txt
```
## Architecture
### Frontend Structure
- `src/layouts/` - Main layout components (Admin, Auth, Home)
- `src/views/` - Page components organized by feature (Dashboard, Company, Community, etc.)
- `src/components/` - Reusable UI components (Charts, Cards, Buttons, etc.)
- `src/theme/` - Chakra UI theme customization
- `src/routes.js` - Application routing configuration
- `src/contexts/` - React context providers
- `src/services/` - API service layer
### Backend Structure
- `app_2.py` - Main Flask application with routes and business logic
- `simulation_background_processor.py` - Background data processing service
- `wechat_pay.py` / `wechat_pay_config.py` - Payment integration
- `tdays.csv` - Trading days data
### Key Integrations
- ClickHouse for high-performance analytics queries
- Celery + Redis for background task processing
- Flask-SocketIO for real-time data updates
- Tencent Cloud services (SMS, etc.)
- WeChat Pay integration
## Configuration
### Proxy Setup
The React dev server proxies API calls to `http://localhost:5001` (see package.json).
### Environment Files
- `.env` - Environment variables for both frontend and backend
### Build Process
The build process includes custom Gulp tasks that add Creative Tim license headers to JS, CSS, and HTML files.
### Styling Architecture
- Tailwind CSS for utility classes
- Custom Chakra UI theme with extended color palette
- Component-specific SCSS files in `src/assets/scss/`
## Testing
- React Testing Library setup for frontend components
- Test command: `npm test`
## Deployment
- Build: `npm run build`
- Deploy: `npm run deploy` (builds the project)

13
ISSUE_TEMPLATE.md Normal file
View File

@@ -0,0 +1,13 @@
<!--
IMPORTANT: Please use the following link to create a new issue:
https://www.creative-tim.com/new-issue/argon-dashboard-chakra-pro
**If your issue was not created using the app above, it will be closed immediately.**
-->
<!--
Love Creative Tim? Do you need Angular, React, Vuejs or HTML? You can visit:
👉 https://www.creative-tim.com/bundles
👉 https://www.creative-tim.com
-->

Binary file not shown.

Binary file not shown.

11581
app.py Normal file

File diff suppressed because it is too large Load Diff

45
app/__init__.py Normal file
View File

@@ -0,0 +1,45 @@
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_cors import CORS
from datetime import datetime
import pytz
import os
# 创建Flask应用
app = Flask(__name__)
# 配置
config_name = os.environ.get('FLASK_ENV', 'development')
from config import config
app.config.from_object(config[config_name])
# 初始化扩展
db = SQLAlchemy(app)
CORS(app, resources={r"/api/*": {"origins": "*"}})
# 时区设置
def beijing_now():
"""获取北京时间"""
tz = pytz.timezone('Asia/Shanghai')
return datetime.now(tz)
# 导入模型
from app.models import *
# 创建数据库表
with app.app_context():
db.create_all()
# 注册路由
from app.routes import events, stocks, limitanalyse, calendar, industries
app.register_blueprint(events.bp)
app.register_blueprint(stocks.bp)
app.register_blueprint(limitanalyse.bp)
app.register_blueprint(calendar.bp)
app.register_blueprint(industries.bp)
if __name__ == '__main__':
print("=== Value Frontier React 架构启动 ===")
app.run(host='0.0.0.0', port=5001, debug=True)

Binary file not shown.

Binary file not shown.

Binary file not shown.

30
app/extensions.py Normal file
View File

@@ -0,0 +1,30 @@
# app/extensions.py
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_compress import Compress
from flask_cors import CORS
from clickhouse_driver import Client as Cclient
from sqlalchemy import create_engine
# Database instances
db = SQLAlchemy()
# Other extensions
login_manager = LoginManager()
compress = Compress()
cors = CORS()
# Database engines (如果仍然需要直接使用 engine)
engine = create_engine("mysql+pymysql://root:Zzl33818!@111.198.58.126:33060/stock", echo=False)
engine_med = create_engine("mysql+pymysql://root:Zzl33818!@111.198.58.126:33060/med", echo=False)
engine_2 = create_engine("mysql+pymysql://root:Zzl33818!@111.198.58.126:33060/valuefrontier", echo=False)
# ClickHouse client factory
def get_clickhouse_client():
return Cclient(
host='111.198.58.126',
port=18778,
user='default',
password='Zzl5588161!',
database='stock'
)

504
app/models.py Normal file
View File

@@ -0,0 +1,504 @@
from app import db
from datetime import datetime
import pytz
import json
def beijing_now():
"""获取北京时间"""
tz = pytz.timezone('Asia/Shanghai')
return datetime.now(tz)
class Post(db.Model):
"""帖子模型"""
id = db.Column(db.Integer, primary_key=True)
event_id = db.Column(db.Integer, db.ForeignKey('event.id'), nullable=False)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
# 内容
title = db.Column(db.String(200)) # 标题(可选)
content = db.Column(db.Text, nullable=False) # 内容
content_type = db.Column(db.String(20), default='text') # 内容类型:text/rich_text/link
# 时间
created_at = db.Column(db.DateTime, default=beijing_now)
updated_at = db.Column(db.DateTime, default=beijing_now, onupdate=beijing_now)
# 统计
likes_count = db.Column(db.Integer, default=0)
comments_count = db.Column(db.Integer, default=0)
view_count = db.Column(db.Integer, default=0)
# 状态
status = db.Column(db.String(20), default='active') # active/hidden/deleted
is_top = db.Column(db.Boolean, default=False) # 是否置顶
# 关系
user = db.relationship('User', backref='posts')
likes = db.relationship('PostLike', backref='post', lazy='dynamic')
comments = db.relationship('Comment', backref='post', lazy='dynamic')
class User(db.Model):
"""用户模型"""
id = db.Column(db.Integer, primary_key=True)
# 基础账号信息(注册时必填)
username = db.Column(db.String(80), unique=True, nullable=False) # 用户名
email = db.Column(db.String(120), unique=True, nullable=False) # 邮箱
password_hash = db.Column(db.String(128), nullable=False) # 密码哈希
email_confirmed = db.Column(db.Boolean, default=False) # 邮箱是否验证
# 账号状态
created_at = db.Column(db.DateTime, default=beijing_now) # 注册时间
last_seen = db.Column(db.DateTime, default=beijing_now) # 最后活跃时间
status = db.Column(db.String(20), default='active') # 账号状态 active/banned/deleted
# 个人资料(可选,后续在个人中心完善)
nickname = db.Column(db.String(30)) # 社区昵称
avatar_url = db.Column(db.String(200)) # 头像URL
banner_url = db.Column(db.String(200)) # 个人主页背景图
bio = db.Column(db.String(200)) # 个人简介
gender = db.Column(db.String(10)) # 性别
birth_date = db.Column(db.Date) # 生日
location = db.Column(db.String(100)) # 所在地
# 联系方式(可选)
phone = db.Column(db.String(20)) # 手机号
wechat_id = db.Column(db.String(80)) # 微信号
# 实名认证信息(可选)
real_name = db.Column(db.String(30)) # 真实姓名
id_number = db.Column(db.String(18)) # 身份证号(加密存储)
is_verified = db.Column(db.Boolean, default=False) # 是否实名认证
verify_time = db.Column(db.DateTime) # 实名认证时间
# 投资相关信息(可选)
trading_experience = db.Column(db.Integer) # 炒股年限
investment_style = db.Column(db.String(50)) # 投资风格
risk_preference = db.Column(db.String(20)) # 风险偏好
investment_amount = db.Column(db.String(20)) # 投资规模
preferred_markets = db.Column(db.String(200), default='[]') # 偏好市场 JSON
# 社区信息(系统自动更新)
user_level = db.Column(db.Integer, default=1) # 用户等级
reputation_score = db.Column(db.Integer, default=0) # 信用积分
contribution_point = db.Column(db.Integer, default=0) # 贡献点数
post_count = db.Column(db.Integer, default=0) # 发帖数
comment_count = db.Column(db.Integer, default=0) # 评论数
follower_count = db.Column(db.Integer, default=0) # 粉丝数
following_count = db.Column(db.Integer, default=0) # 关注数
# 创作者信息(可选)
is_creator = db.Column(db.Boolean, default=False) # 是否创作者
creator_type = db.Column(db.String(20)) # 创作者类型
creator_tags = db.Column(db.String(200), default='[]') # 创作者标签 JSON
# 系统设置
email_notifications = db.Column(db.Boolean, default=True) # 邮件通知
sms_notifications = db.Column(db.Boolean, default=False) # 短信通知
wechat_notifications = db.Column(db.Boolean, default=False) # 微信通知
notification_preferences = db.Column(db.String(500), default='{}') # 通知偏好 JSON
privacy_level = db.Column(db.String(20), default='public') # 隐私级别
theme_preference = db.Column(db.String(20), default='light') # 主题偏好
blocked_keywords = db.Column(db.String(500), default='[]') # 屏蔽关键词 JSON
# 手机号验证
phone_confirmed = db.Column(db.Boolean, default=False) # 手机是否验证
phone_confirm_time = db.Column(db.DateTime) # 手机验证时间
def __init__(self, username, email=None, password=None, phone=None):
self.username = username
if email:
self.email = email
if password:
self.set_password(password)
if phone:
self.phone = phone
def set_password(self, password):
from werkzeug.security import generate_password_hash
self.password_hash = generate_password_hash(password)
def check_password(self, password):
from werkzeug.security import check_password_hash
return check_password_hash(self.password_hash, password)
def update_last_seen(self):
self.last_seen = beijing_now()
db.session.commit()
def get_preferred_markets(self):
try:
return json.loads(self.preferred_markets)
except (json.JSONDecodeError, TypeError):
return []
def get_blocked_keywords(self):
try:
return json.loads(self.blocked_keywords)
except (json.JSONDecodeError, TypeError):
return []
def get_notification_preferences(self):
try:
return json.loads(self.notification_preferences)
except (json.JSONDecodeError, TypeError):
return {}
def get_creator_tags(self):
try:
return json.loads(self.creator_tags)
except (json.JSONDecodeError, TypeError):
return []
def set_preferred_markets(self, markets):
self.preferred_markets = json.dumps(markets)
def set_blocked_keywords(self, keywords):
self.blocked_keywords = json.dumps(keywords)
def set_notification_preferences(self, preferences):
self.notification_preferences = json.dumps(preferences)
def set_creator_tags(self, tags):
self.creator_tags = json.dumps(tags)
def to_dict(self):
return {
'id': self.id,
'username': self.username,
'email': self.email,
'nickname': self.nickname,
'avatar_url': self.avatar_url,
'bio': self.bio,
'created_at': self.created_at.isoformat() if self.created_at else None,
'last_seen': self.last_seen.isoformat() if self.last_seen else None,
'status': self.status,
'user_level': self.user_level,
'reputation_score': self.reputation_score,
'post_count': self.post_count,
'follower_count': self.follower_count,
'following_count': self.following_count
}
def __repr__(self):
return f'<User {self.username}>'
class Comment(db.Model):
"""评论"""
id = db.Column(db.Integer, primary_key=True)
post_id = db.Column(db.Integer, db.ForeignKey('post.id'), nullable=False)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
content = db.Column(db.Text, nullable=False)
parent_id = db.Column(db.Integer, db.ForeignKey('comment.id')) # 父评论ID,用于回复
created_at = db.Column(db.DateTime, default=beijing_now)
status = db.Column(db.String(20), default='active')
user = db.relationship('User', backref='comments')
replies = db.relationship('Comment', backref=db.backref('parent', remote_side=[id]))
class CommentLike(db.Model):
"""评论点赞记录基于session_id以兼容匿名点赞"""
__tablename__ = 'comment_like'
id = db.Column(db.Integer, primary_key=True)
comment_id = db.Column(db.Integer, db.ForeignKey('comment.id'), nullable=False)
session_id = db.Column(db.String(100), nullable=False)
created_at = db.Column(db.DateTime, default=beijing_now)
__table_args__ = (db.UniqueConstraint('comment_id', 'session_id'),)
class EventFollow(db.Model):
"""事件关注"""
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
event_id = db.Column(db.Integer, db.ForeignKey('event.id'), nullable=False)
created_at = db.Column(db.DateTime, default=beijing_now)
user = db.relationship('User', backref='event_follows')
__table_args__ = (db.UniqueConstraint('user_id', 'event_id'),)
class PostLike(db.Model):
"""帖子点赞"""
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
post_id = db.Column(db.Integer, db.ForeignKey('post.id'), nullable=False)
created_at = db.Column(db.DateTime, default=beijing_now)
user = db.relationship('User', backref='post_likes')
__table_args__ = (db.UniqueConstraint('user_id', 'post_id'),)
class Event(db.Model):
"""事件模型"""
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(200), nullable=False)
description = db.Column(db.Text)
# 事件类型与状态
event_type = db.Column(db.String(50))
status = db.Column(db.String(20), default='active')
# 时间相关
start_time = db.Column(db.DateTime, default=beijing_now)
end_time = db.Column(db.DateTime)
created_at = db.Column(db.DateTime, default=beijing_now)
updated_at = db.Column(db.DateTime, default=beijing_now)
# 热度与统计
hot_score = db.Column(db.Float, default=0)
view_count = db.Column(db.Integer, default=0)
trending_score = db.Column(db.Float, default=0)
post_count = db.Column(db.Integer, default=0)
follower_count = db.Column(db.Integer, default=0)
# 关联信息
related_industries = db.Column(db.JSON)
keywords = db.Column(db.JSON)
files = db.Column(db.JSON)
importance = db.Column(db.String(20))
related_avg_chg = db.Column(db.Float, default=0)
related_max_chg = db.Column(db.Float, default=0)
related_week_chg = db.Column(db.Float, default=0)
# 新增字段
invest_score = db.Column(db.Integer) # 超预期得分
expectation_surprise_score = db.Column(db.Integer)
# 创建者信息
creator_id = db.Column(db.Integer, db.ForeignKey('user.id'))
creator = db.relationship('User', backref='created_events')
# 关系
posts = db.relationship('Post', backref='event', lazy='dynamic')
followers = db.relationship('EventFollow', backref='event', lazy='dynamic')
related_stocks = db.relationship('RelatedStock', backref='event', lazy='dynamic')
historical_events = db.relationship('HistoricalEvent', backref='event', lazy='dynamic')
related_data = db.relationship('RelatedData', backref='event', lazy='dynamic')
related_concepts = db.relationship('RelatedConcepts', backref='event', lazy='dynamic')
@property
def keywords_list(self):
if isinstance(self.keywords, list):
return self.keywords
elif isinstance(self.keywords, str):
try:
return json.loads(self.keywords)
except (json.JSONDecodeError, TypeError):
return []
return []
def set_keywords(self, keywords):
if isinstance(keywords, list):
self.keywords = keywords
elif isinstance(keywords, str):
try:
self.keywords = json.loads(keywords)
except json.JSONDecodeError:
self.keywords = [keywords]
else:
self.keywords = []
class RelatedStock(db.Model):
"""相关标的模型"""
id = db.Column(db.Integer, primary_key=True)
event_id = db.Column(db.Integer, db.ForeignKey('event.id'))
stock_code = db.Column(db.String(20)) # 股票代码
stock_name = db.Column(db.String(100)) # 股票名称
sector = db.Column(db.String(100)) # 关联类型
relation_desc = db.Column(db.String(1024)) # 关联原因描述
created_at = db.Column(db.DateTime, default=beijing_now)
updated_at = db.Column(db.DateTime, default=beijing_now, onupdate=beijing_now)
correlation = db.Column(db.Float())
momentum = db.Column(db.String(1024)) #动量
class RelatedData(db.Model):
"""关联数据模型"""
id = db.Column(db.Integer, primary_key=True)
event_id = db.Column(db.Integer, db.ForeignKey('event.id'))
title = db.Column(db.String(200)) # 数据标题
data_type = db.Column(db.String(50)) # 数据类型
data_content = db.Column(db.JSON) # 数据内容(JSON格式)
description = db.Column(db.Text) # 数据描述
created_at = db.Column(db.DateTime, default=beijing_now)
class RelatedConcepts(db.Model):
"""关联数据模型"""
id = db.Column(db.Integer, primary_key=True)
event_id = db.Column(db.Integer, db.ForeignKey('event.id'))
concept_code = db.Column(db.String(20)) # 数据标题
concept = db.Column(db.String(100)) # 数据类型
reason = db.Column(db.Text) # 数据描述
image_paths = db.Column(db.JSON) # 数据内容(JSON格式)
created_at = db.Column(db.DateTime, default=beijing_now)
@property
def image_paths_list(self):
if isinstance(self.image_paths, list):
return self.image_paths
elif isinstance(self.image_paths, str):
try:
return json.loads(self.image_paths)
except (json.JSONDecodeError, TypeError):
return []
return []
def set_image_paths(self, image_paths):
if isinstance(image_paths, list):
self.image_paths = image_paths
elif isinstance(image_paths, str):
try:
self.image_paths = json.loads(image_paths)
except json.JSONDecodeError:
self.image_paths = [image_paths]
else:
self.image_paths = []
def get_first_image_path(self):
paths = self.image_paths_list
return paths[0] if paths else None
class EventHotHistory(db.Model):
"""事件热度历史记录"""
id = db.Column(db.Integer, primary_key=True)
event_id = db.Column(db.Integer, db.ForeignKey('event.id'))
score = db.Column(db.Float) # 总分
interaction_score = db.Column(db.Float) # 互动分数
follow_score = db.Column(db.Float) # 关注度分数
view_score = db.Column(db.Float) # 浏览量分数
recent_activity_score = db.Column(db.Float) # 最近活跃度分数
time_decay = db.Column(db.Float) # 时间衰减因子
created_at = db.Column(db.DateTime, default=beijing_now)
event = db.relationship('Event', backref='hot_history')
class EventTransmissionNode(db.Model):
"""事件传导节点模型"""
__tablename__ = 'event_transmission_nodes'
id = db.Column(db.Integer, primary_key=True)
event_id = db.Column(db.Integer, db.ForeignKey('event.id'), nullable=False)
node_type = db.Column(db.Enum('company', 'industry', 'policy', 'technology',
'market', 'event', 'other'), nullable=False)
node_name = db.Column(db.String(200), nullable=False)
node_description = db.Column(db.Text)
importance_score = db.Column(db.Integer, default=50)
stock_code = db.Column(db.String(20))
is_main_event = db.Column(db.Boolean, default=False)
created_at = db.Column(db.DateTime, default=beijing_now)
updated_at = db.Column(db.DateTime, default=beijing_now, onupdate=beijing_now)
# Relationships
event = db.relationship('Event', backref='transmission_nodes')
outgoing_edges = db.relationship('EventTransmissionEdge',
foreign_keys='EventTransmissionEdge.from_node_id',
backref='from_node', cascade='all, delete-orphan')
incoming_edges = db.relationship('EventTransmissionEdge',
foreign_keys='EventTransmissionEdge.to_node_id',
backref='to_node', cascade='all, delete-orphan')
__table_args__ = (
db.Index('idx_event_node_type', 'event_id', 'node_type'),
db.Index('idx_node_name', 'node_name'),
)
class EventTransmissionEdge(db.Model):
"""事件传导边模型"""
__tablename__ = 'event_transmission_edges'
id = db.Column(db.Integer, primary_key=True)
event_id = db.Column(db.Integer, db.ForeignKey('event.id'), nullable=False)
from_node_id = db.Column(db.Integer, db.ForeignKey('event_transmission_nodes.id'), nullable=False)
to_node_id = db.Column(db.Integer, db.ForeignKey('event_transmission_nodes.id'), nullable=False)
transmission_type = db.Column(db.Enum('supply_chain', 'competition', 'policy',
'technology', 'capital_flow', 'expectation',
'cyclic_effect', 'other'), nullable=False)
transmission_mechanism = db.Column(db.Text)
direction = db.Column(db.Enum('positive', 'negative', 'neutral', 'mixed'), default='neutral')
strength = db.Column(db.Integer, default=50)
impact = db.Column(db.Text)
is_circular = db.Column(db.Boolean, default=False)
created_at = db.Column(db.DateTime, default=beijing_now)
updated_at = db.Column(db.DateTime, default=beijing_now, onupdate=beijing_now)
# Relationship
event = db.relationship('Event', backref='transmission_edges')
__table_args__ = (
db.Index('idx_event_edge_type', 'event_id', 'transmission_type'),
db.Index('idx_from_to_nodes', 'from_node_id', 'to_node_id'),
)
class EventSankeyFlow(db.Model):
"""事件桑基流模型"""
__tablename__ = 'event_sankey_flows'
id = db.Column(db.Integer, primary_key=True)
event_id = db.Column(db.Integer, db.ForeignKey('event.id'), nullable=False)
# 流的基本信息
source_node = db.Column(db.String(200), nullable=False)
source_type = db.Column(db.Enum('event', 'policy', 'technology', 'industry',
'company', 'product'), nullable=False)
source_level = db.Column(db.Integer, nullable=False, default=0)
target_node = db.Column(db.String(200), nullable=False)
target_type = db.Column(db.Enum('policy', 'technology', 'industry',
'company', 'product'), nullable=False)
target_level = db.Column(db.Integer, nullable=False, default=1)
# 流量信息
flow_value = db.Column(db.Numeric(10, 2), nullable=False)
flow_ratio = db.Column(db.Numeric(5, 4), nullable=False)
# 传导机制
transmission_path = db.Column(db.String(500))
impact_description = db.Column(db.Text)
evidence_strength = db.Column(db.Integer, default=50)
# 时间戳
created_at = db.Column(db.DateTime, default=beijing_now)
updated_at = db.Column(db.DateTime, default=beijing_now, onupdate=beijing_now)
# 关系
event = db.relationship('Event', backref='sankey_flows')
__table_args__ = (
db.Index('idx_event_flow', 'event_id'),
db.Index('idx_source_target', 'source_node', 'target_node'),
)
class HistoricalEvent(db.Model):
"""历史事件模型"""
id = db.Column(db.Integer, primary_key=True)
event_id = db.Column(db.Integer, db.ForeignKey('event.id'))
title = db.Column(db.String(200))
content = db.Column(db.Text)
event_date = db.Column(db.DateTime)
relevance = db.Column(db.Integer) # 相关性
importance = db.Column(db.Integer) # 重要程度
related_stock = db.Column(db.JSON) # 保留JSON字段
created_at = db.Column(db.DateTime, default=beijing_now)
# 新增关系
stocks = db.relationship('HistoricalEventStock', backref='historical_event', lazy='dynamic',
cascade='all, delete-orphan')
class HistoricalEventStock(db.Model):
"""历史事件相关股票模型"""
__tablename__ = 'historical_event_stocks'
id = db.Column(db.Integer, primary_key=True)
historical_event_id = db.Column(db.Integer, db.ForeignKey('historical_event.id'), nullable=False)
stock_code = db.Column(db.String(20), nullable=False)
stock_name = db.Column(db.String(50))
relation_desc = db.Column(db.Text)
correlation = db.Column(db.Float, default=0.5)
sector = db.Column(db.String(100))
created_at = db.Column(db.DateTime, default=beijing_now)
__table_args__ = (
db.Index('idx_historical_event_stock', 'historical_event_id', 'stock_code'),
)

1
app/routes/__init__.py Normal file
View File

@@ -0,0 +1 @@
# 路由包初始化文件

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

121
app/routes/calendar.py Normal file
View File

@@ -0,0 +1,121 @@
from flask import Blueprint, request, jsonify
from datetime import datetime, timedelta
import json
bp = Blueprint('calendar', __name__, url_prefix='/api/v1/calendar')
@bp.route('/event-counts', methods=['GET'])
def get_event_counts():
"""获取事件数量统计"""
try:
year = request.args.get('year', '2027')
month = request.args.get('month', '10')
# 模拟事件数量数据
event_counts = []
for day in range(1, 32):
count = (day % 7) + 1 # 模拟每天1-7个事件
event_counts.append({
'date': f'{year}-{month.zfill(2)}-{day:02d}',
'count': count
})
return jsonify({
'success': True,
'data': event_counts
})
except Exception as e:
print(f"Error getting event counts: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/events', methods=['GET'])
def get_calendar_events():
"""获取日历事件"""
try:
year = request.args.get('year', '2027')
month = request.args.get('month', '10')
event_type = request.args.get('type', 'all')
# 模拟日历事件数据
events = []
for day in range(1, 32):
for i in range((day % 7) + 1):
event = {
'id': f'{year}{month.zfill(2)}{day:02d}{i}',
'title': f'事件{day}-{i+1}',
'date': f'{year}-{month.zfill(2)}-{day:02d}',
'type': ['政策', '技术', '产业', '公司'][i % 4],
'importance': ['', '', ''][i % 3],
'status': 'active'
}
events.append(event)
# 根据类型过滤
if event_type != 'all':
events = [e for e in events if e['type'] == event_type]
return jsonify({
'success': True,
'data': events
})
except Exception as e:
print(f"Error getting calendar events: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/events/<int:event_id>', methods=['GET'])
def get_calendar_event_detail(event_id):
"""获取日历事件详情"""
try:
# 模拟事件详情
event_detail = {
'id': event_id,
'title': f'事件{event_id}详情',
'description': f'这是事件{event_id}的详细描述',
'date': '2027-10-15',
'type': '政策',
'importance': '',
'status': 'active',
'related_stocks': [
{'code': '000001', 'name': '股票A'},
{'code': '000002', 'name': '股票B'}
],
'keywords': ['政策', '改革', '创新'],
'files': [
{'name': '报告.pdf', 'url': '/files/report.pdf'},
{'name': '数据.xlsx', 'url': '/files/data.xlsx'}
]
}
return jsonify({
'success': True,
'data': event_detail
})
except Exception as e:
print(f"Error getting calendar event detail: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
def get_event_class(count):
"""根据事件数量获取CSS类"""
if count == 0:
return 'no-events'
elif count <= 3:
return 'few-events'
elif count <= 6:
return 'medium-events'
else:
return 'many-events'
def parse_json_field(field_value):
"""解析JSON字段"""
if isinstance(field_value, str):
try:
return json.loads(field_value)
except (json.JSONDecodeError, TypeError):
return []
elif isinstance(field_value, (list, dict)):
return field_value
else:
return []

385
app/routes/events.py Normal file
View File

@@ -0,0 +1,385 @@
from flask import Blueprint, request, jsonify
from app import db
from app.models import Event, RelatedStock, RelatedConcepts, HistoricalEvent, EventTransmissionNode, EventTransmissionEdge, EventSankeyFlow
from datetime import datetime
import json
bp = Blueprint('events', __name__, url_prefix='/api/events')
@bp.route('/<int:event_id>', methods=['GET'])
def get_event_detail(event_id):
"""获取事件详情"""
try:
event = Event.query.get(event_id)
if not event:
return jsonify({'success': False, 'error': '事件不存在'}), 404
# 获取相关股票
related_stocks = RelatedStock.query.filter_by(event_id=event_id).all()
stocks_data = []
for stock in related_stocks:
stocks_data.append({
'id': stock.id,
'stock_code': stock.stock_code,
'stock_name': stock.stock_name,
'sector': stock.sector,
'relation_desc': stock.relation_desc,
'correlation': stock.correlation,
'momentum': stock.momentum,
'created_at': stock.created_at.isoformat() if stock.created_at else None
})
# 获取相关概念
related_concepts = RelatedConcepts.query.filter_by(event_id=event_id).all()
concepts_data = []
for concept in related_concepts:
concepts_data.append({
'id': concept.id,
'concept_code': concept.concept_code,
'concept': concept.concept,
'reason': concept.reason,
'image_paths': concept.image_paths_list,
'created_at': concept.created_at.isoformat() if concept.created_at else None
})
event_data = {
'id': event.id,
'title': event.title,
'description': event.description,
'event_type': event.event_type,
'status': event.status,
'start_time': event.start_time.isoformat() if event.start_time else None,
'end_time': event.end_time.isoformat() if event.end_time else None,
'created_at': event.created_at.isoformat() if event.created_at else None,
'updated_at': event.updated_at.isoformat() if event.updated_at else None,
'hot_score': event.hot_score,
'view_count': event.view_count,
'trending_score': event.trending_score,
'post_count': event.post_count,
'follower_count': event.follower_count,
'related_industries': event.related_industries,
'keywords': event.keywords_list,
'files': event.files,
'importance': event.importance,
'related_avg_chg': event.related_avg_chg,
'related_max_chg': event.related_max_chg,
'related_week_chg': event.related_week_chg,
'invest_score': event.invest_score,
'expectation_surprise_score': event.expectation_surprise_score,
'related_stocks': stocks_data,
'related_concepts': concepts_data
}
return jsonify({
'success': True,
'data': event_data
})
except Exception as e:
print(f"Error getting event detail: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/<int:event_id>/stocks', methods=['GET'])
def get_related_stocks(event_id):
"""获取事件相关股票"""
try:
stocks = RelatedStock.query.filter_by(event_id=event_id).all()
stocks_data = []
for stock in stocks:
stocks_data.append({
'id': stock.id,
'stock_code': stock.stock_code,
'stock_name': stock.stock_name,
'sector': stock.sector,
'relation_desc': stock.relation_desc,
'correlation': stock.correlation,
'momentum': stock.momentum,
'created_at': stock.created_at.isoformat() if stock.created_at else None
})
return jsonify({
'success': True,
'data': stocks_data
})
except Exception as e:
print(f"Error getting related stocks: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/<int:event_id>/stocks', methods=['POST'])
def add_related_stock(event_id):
"""添加相关股票"""
try:
data = request.get_json()
if not data:
return jsonify({'success': False, 'error': '请提供数据'}), 400
# 检查事件是否存在
event = Event.query.get(event_id)
if not event:
return jsonify({'success': False, 'error': '事件不存在'}), 404
# 创建新的相关股票记录
new_stock = RelatedStock(
event_id=event_id,
stock_code=data['stock_code'],
stock_name=data.get('stock_name', ''),
sector=data.get('sector', ''),
relation_desc=data['relation_desc'],
correlation=data.get('correlation', 0.5),
momentum=data.get('momentum', '')
)
db.session.add(new_stock)
db.session.commit()
return jsonify({
'success': True,
'message': '相关股票添加成功',
'data': {
'id': new_stock.id,
'stock_code': new_stock.stock_code,
'stock_name': new_stock.stock_name,
'sector': new_stock.sector,
'relation_desc': new_stock.relation_desc,
'correlation': new_stock.correlation,
'momentum': new_stock.momentum
}
})
except Exception as e:
db.session.rollback()
print(f"Error adding related stock: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/stocks/<int:stock_id>', methods=['DELETE'])
def delete_related_stock(stock_id):
"""删除相关股票"""
try:
stock = RelatedStock.query.get(stock_id)
if not stock:
return jsonify({'success': False, 'error': '相关股票不存在'}), 404
db.session.delete(stock)
db.session.commit()
return jsonify({
'success': True,
'message': '相关股票删除成功'
})
except Exception as e:
db.session.rollback()
print(f"Error deleting related stock: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/<int:event_id>/concepts', methods=['GET'])
def get_related_concepts(event_id):
"""获取事件相关概念"""
try:
concepts = RelatedConcepts.query.filter_by(event_id=event_id).all()
concepts_data = []
for concept in concepts:
concepts_data.append({
'id': concept.id,
'concept_code': concept.concept_code,
'concept': concept.concept,
'reason': concept.reason,
'image_paths': concept.image_paths_list,
'created_at': concept.created_at.isoformat() if concept.created_at else None
})
return jsonify({
'success': True,
'data': concepts_data
})
except Exception as e:
print(f"Error getting related concepts: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/<int:event_id>/historical', methods=['GET'])
def get_historical_events(event_id):
"""获取历史事件"""
try:
historical_events = HistoricalEvent.query.filter_by(event_id=event_id).all()
events_data = []
for event in historical_events:
events_data.append({
'id': event.id,
'title': event.title,
'content': event.content,
'event_date': event.event_date.isoformat() if event.event_date else None,
'relevance': event.relevance,
'importance': event.importance,
'related_stock': event.related_stock,
'created_at': event.created_at.isoformat() if event.created_at else None
})
return jsonify({
'success': True,
'data': events_data
})
except Exception as e:
print(f"Error getting historical events: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/<int:event_id>/expectation-score', methods=['GET'])
def get_expectation_score(event_id):
"""获取超预期得分"""
try:
event = Event.query.get(event_id)
if not event:
return jsonify({'success': False, 'error': '事件不存在'}), 404
return jsonify({
'success': True,
'data': {
'invest_score': event.invest_score,
'expectation_surprise_score': event.expectation_surprise_score
}
})
except Exception as e:
print(f"Error getting expectation score: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/<int:event_id>/follow', methods=['POST'])
def toggle_event_follow(event_id):
"""关注/取消关注事件"""
try:
# 这里需要用户认证,暂时返回成功
return jsonify({
'success': True,
'message': '关注状态更新成功'
})
except Exception as e:
print(f"Error toggling event follow: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/<int:event_id>/transmission', methods=['GET'])
def get_transmission_chain(event_id):
"""获取事件传导链"""
try:
# 获取传导节点
nodes = EventTransmissionNode.query.filter_by(event_id=event_id).all()
nodes_data = []
for node in nodes:
nodes_data.append({
'id': node.id,
'node_type': node.node_type,
'node_name': node.node_name,
'node_description': node.node_description,
'importance_score': node.importance_score,
'stock_code': node.stock_code,
'is_main_event': node.is_main_event
})
# 获取传导边
edges = EventTransmissionEdge.query.filter_by(event_id=event_id).all()
edges_data = []
for edge in edges:
edges_data.append({
'id': edge.id,
'from_node_id': edge.from_node_id,
'to_node_id': edge.to_node_id,
'transmission_type': edge.transmission_type,
'transmission_mechanism': edge.transmission_mechanism,
'direction': edge.direction,
'strength': edge.strength,
'impact': edge.impact,
'is_circular': edge.is_circular
})
return jsonify({
'success': True,
'data': {
'nodes': nodes_data,
'edges': edges_data
}
})
except Exception as e:
print(f"Error getting transmission chain: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/<int:event_id>/sankey-data')
def get_event_sankey_data(event_id):
"""获取事件桑基图数据"""
try:
flows = EventSankeyFlow.query.filter_by(event_id=event_id).all()
flows_data = []
for flow in flows:
flows_data.append({
'id': flow.id,
'source_node': flow.source_node,
'source_type': flow.source_type,
'source_level': flow.source_level,
'target_node': flow.target_node,
'target_type': flow.target_type,
'target_level': flow.target_level,
'flow_value': float(flow.flow_value),
'flow_ratio': float(flow.flow_ratio),
'transmission_path': flow.transmission_path,
'impact_description': flow.impact_description,
'evidence_strength': flow.evidence_strength
})
return jsonify({
'success': True,
'data': flows_data
})
except Exception as e:
print(f"Error getting sankey data: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/<int:event_id>/chain-analysis')
def get_event_chain_analysis(event_id):
"""获取事件链分析"""
try:
# 这里可以添加更复杂的链分析逻辑
return jsonify({
'success': True,
'data': {
'event_id': event_id,
'analysis': '链分析数据'
}
})
except Exception as e:
print(f"Error getting chain analysis: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/<int:event_id>/chain-node/<int:node_id>', methods=['GET'])
def get_chain_node_detail(event_id, node_id):
"""获取链节点详情"""
try:
node = EventTransmissionNode.query.filter_by(
event_id=event_id,
id=node_id
).first()
if not node:
return jsonify({'success': False, 'error': '节点不存在'}), 404
return jsonify({
'success': True,
'data': {
'id': node.id,
'node_type': node.node_type,
'node_name': node.node_name,
'node_description': node.node_description,
'importance_score': node.importance_score,
'stock_code': node.stock_code,
'is_main_event': node.is_main_event
}
})
except Exception as e:
print(f"Error getting chain node detail: {e}")
return jsonify({'success': False, 'error': str(e)}), 500

511
app/routes/industries.py Normal file
View File

@@ -0,0 +1,511 @@
from flask import Blueprint, request, jsonify
import json
bp = Blueprint('industries', __name__, url_prefix='/api')
@bp.route('/classifications', methods=['GET'])
def get_classifications():
"""获取行业分类"""
try:
# 模拟行业分类数据
classifications = [
{
'id': 1,
'name': '申万一级行业',
'description': '申万一级行业分类标准',
'levels': [
{'id': 1, 'name': '农林牧渔'},
{'id': 2, 'name': '采掘'},
{'id': 3, 'name': '化工'},
{'id': 4, 'name': '钢铁'},
{'id': 5, 'name': '有色金属'},
{'id': 6, 'name': '建筑材料'},
{'id': 7, 'name': '建筑装饰'},
{'id': 8, 'name': '电气设备'},
{'id': 9, 'name': '国防军工'},
{'id': 10, 'name': '汽车'},
{'id': 11, 'name': '家用电器'},
{'id': 12, 'name': '纺织服装'},
{'id': 13, 'name': '轻工制造'},
{'id': 14, 'name': '医药生物'},
{'id': 15, 'name': '公用事业'},
{'id': 16, 'name': '交通运输'},
{'id': 17, 'name': '房地产'},
{'id': 18, 'name': '商业贸易'},
{'id': 19, 'name': '休闲服务'},
{'id': 20, 'name': '银行'},
{'id': 21, 'name': '非银金融'},
{'id': 22, 'name': '综合'},
{'id': 23, 'name': '计算机'},
{'id': 24, 'name': '传媒'},
{'id': 25, 'name': '通信'},
{'id': 26, 'name': '电子'},
{'id': 27, 'name': '机械设备'},
{'id': 28, 'name': '食品饮料'}
]
}
]
return jsonify({
'success': True,
'data': classifications
})
except Exception as e:
print(f"Error getting classifications: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/levels', methods=['GET'])
def get_industry_levels():
"""获取行业层级"""
try:
classification_id = request.args.get('classification_id', '1')
# 模拟行业层级数据
levels = [
{
'id': 1,
'name': '农林牧渔',
'code': '801010',
'description': '农业、林业、畜牧业、渔业',
'stock_count': 45,
'avg_change': 1.2,
'total_market_cap': 500000000000,
'sub_industries': [
{'id': 101, 'name': '种植业', 'stock_count': 20},
{'id': 102, 'name': '林业', 'stock_count': 8},
{'id': 103, 'name': '畜牧业', 'stock_count': 12},
{'id': 104, 'name': '渔业', 'stock_count': 5}
]
},
{
'id': 2,
'name': '采掘',
'code': '801020',
'description': '煤炭、石油、天然气、有色金属矿采选',
'stock_count': 38,
'avg_change': 0.8,
'total_market_cap': 800000000000,
'sub_industries': [
{'id': 201, 'name': '煤炭开采', 'stock_count': 15},
{'id': 202, 'name': '石油开采', 'stock_count': 8},
{'id': 203, 'name': '有色金属矿采选', 'stock_count': 15}
]
},
{
'id': 3,
'name': '化工',
'code': '801030',
'description': '化学原料、化学制品、化学纤维',
'stock_count': 156,
'avg_change': 1.5,
'total_market_cap': 1200000000000,
'sub_industries': [
{'id': 301, 'name': '化学原料', 'stock_count': 45},
{'id': 302, 'name': '化学制品', 'stock_count': 78},
{'id': 303, 'name': '化学纤维', 'stock_count': 33}
]
},
{
'id': 4,
'name': '钢铁',
'code': '801040',
'description': '钢铁冶炼、钢铁制品',
'stock_count': 32,
'avg_change': 0.6,
'total_market_cap': 600000000000,
'sub_industries': [
{'id': 401, 'name': '钢铁冶炼', 'stock_count': 18},
{'id': 402, 'name': '钢铁制品', 'stock_count': 14}
]
},
{
'id': 5,
'name': '有色金属',
'code': '801050',
'description': '有色金属冶炼、有色金属制品',
'stock_count': 67,
'avg_change': 1.8,
'total_market_cap': 900000000000,
'sub_industries': [
{'id': 501, 'name': '有色金属冶炼', 'stock_count': 35},
{'id': 502, 'name': '有色金属制品', 'stock_count': 32}
]
},
{
'id': 6,
'name': '建筑材料',
'code': '801060',
'description': '水泥、玻璃、陶瓷、其他建材',
'stock_count': 89,
'avg_change': 1.1,
'total_market_cap': 700000000000,
'sub_industries': [
{'id': 601, 'name': '水泥', 'stock_count': 25},
{'id': 602, 'name': '玻璃', 'stock_count': 18},
{'id': 603, 'name': '陶瓷', 'stock_count': 12},
{'id': 604, 'name': '其他建材', 'stock_count': 34}
]
},
{
'id': 7,
'name': '建筑装饰',
'code': '801070',
'description': '房屋建设、装修装饰、园林工程',
'stock_count': 45,
'avg_change': 0.9,
'total_market_cap': 400000000000,
'sub_industries': [
{'id': 701, 'name': '房屋建设', 'stock_count': 15},
{'id': 702, 'name': '装修装饰', 'stock_count': 20},
{'id': 703, 'name': '园林工程', 'stock_count': 10}
]
},
{
'id': 8,
'name': '电气设备',
'code': '801080',
'description': '电机、电气自动化设备、电源设备',
'stock_count': 134,
'avg_change': 2.1,
'total_market_cap': 1500000000000,
'sub_industries': [
{'id': 801, 'name': '电机', 'stock_count': 25},
{'id': 802, 'name': '电气自动化设备', 'stock_count': 45},
{'id': 803, 'name': '电源设备', 'stock_count': 64}
]
},
{
'id': 9,
'name': '国防军工',
'code': '801090',
'description': '航天装备、航空装备、地面兵装',
'stock_count': 28,
'avg_change': 1.6,
'total_market_cap': 300000000000,
'sub_industries': [
{'id': 901, 'name': '航天装备', 'stock_count': 8},
{'id': 902, 'name': '航空装备', 'stock_count': 12},
{'id': 903, 'name': '地面兵装', 'stock_count': 8}
]
},
{
'id': 10,
'name': '汽车',
'code': '801100',
'description': '汽车整车、汽车零部件',
'stock_count': 78,
'avg_change': 1.3,
'total_market_cap': 1100000000000,
'sub_industries': [
{'id': 1001, 'name': '汽车整车', 'stock_count': 25},
{'id': 1002, 'name': '汽车零部件', 'stock_count': 53}
]
},
{
'id': 11,
'name': '家用电器',
'code': '801110',
'description': '白色家电、小家电、家电零部件',
'stock_count': 56,
'avg_change': 1.0,
'total_market_cap': 800000000000,
'sub_industries': [
{'id': 1101, 'name': '白色家电', 'stock_count': 20},
{'id': 1102, 'name': '小家电', 'stock_count': 18},
{'id': 1103, 'name': '家电零部件', 'stock_count': 18}
]
},
{
'id': 12,
'name': '纺织服装',
'code': '801120',
'description': '纺织制造、服装家纺',
'stock_count': 67,
'avg_change': 0.7,
'total_market_cap': 500000000000,
'sub_industries': [
{'id': 1201, 'name': '纺织制造', 'stock_count': 35},
{'id': 1202, 'name': '服装家纺', 'stock_count': 32}
]
},
{
'id': 13,
'name': '轻工制造',
'code': '801130',
'description': '造纸、包装印刷、家用轻工',
'stock_count': 89,
'avg_change': 0.9,
'total_market_cap': 600000000000,
'sub_industries': [
{'id': 1301, 'name': '造纸', 'stock_count': 25},
{'id': 1302, 'name': '包装印刷', 'stock_count': 30},
{'id': 1303, 'name': '家用轻工', 'stock_count': 34}
]
},
{
'id': 14,
'name': '医药生物',
'code': '801140',
'description': '化学制药、中药、生物制品、医疗器械',
'stock_count': 234,
'avg_change': 1.9,
'total_market_cap': 2500000000000,
'sub_industries': [
{'id': 1401, 'name': '化学制药', 'stock_count': 78},
{'id': 1402, 'name': '中药', 'stock_count': 45},
{'id': 1403, 'name': '生物制品', 'stock_count': 56},
{'id': 1404, 'name': '医疗器械', 'stock_count': 55}
]
},
{
'id': 15,
'name': '公用事业',
'code': '801150',
'description': '电力、燃气、水务',
'stock_count': 78,
'avg_change': 0.5,
'total_market_cap': 900000000000,
'sub_industries': [
{'id': 1501, 'name': '电力', 'stock_count': 45},
{'id': 1502, 'name': '燃气', 'stock_count': 18},
{'id': 1503, 'name': '水务', 'stock_count': 15}
]
},
{
'id': 16,
'name': '交通运输',
'code': '801160',
'description': '港口、公路、铁路、航空',
'stock_count': 67,
'avg_change': 0.8,
'total_market_cap': 800000000000,
'sub_industries': [
{'id': 1601, 'name': '港口', 'stock_count': 15},
{'id': 1602, 'name': '公路', 'stock_count': 20},
{'id': 1603, 'name': '铁路', 'stock_count': 12},
{'id': 1604, 'name': '航空', 'stock_count': 20}
]
},
{
'id': 17,
'name': '房地产',
'code': '801170',
'description': '房地产开发、房地产服务',
'stock_count': 89,
'avg_change': 0.6,
'total_market_cap': 1200000000000,
'sub_industries': [
{'id': 1701, 'name': '房地产开发', 'stock_count': 65},
{'id': 1702, 'name': '房地产服务', 'stock_count': 24}
]
},
{
'id': 18,
'name': '商业贸易',
'code': '801180',
'description': '贸易、零售',
'stock_count': 78,
'avg_change': 0.7,
'total_market_cap': 600000000000,
'sub_industries': [
{'id': 1801, 'name': '贸易', 'stock_count': 35},
{'id': 1802, 'name': '零售', 'stock_count': 43}
]
},
{
'id': 19,
'name': '休闲服务',
'code': '801190',
'description': '景点、酒店、旅游综合',
'stock_count': 34,
'avg_change': 1.2,
'total_market_cap': 300000000000,
'sub_industries': [
{'id': 1901, 'name': '景点', 'stock_count': 12},
{'id': 1902, 'name': '酒店', 'stock_count': 15},
{'id': 1903, 'name': '旅游综合', 'stock_count': 7}
]
},
{
'id': 20,
'name': '银行',
'code': '801200',
'description': '银行',
'stock_count': 28,
'avg_change': 0.4,
'total_market_cap': 8000000000000,
'sub_industries': [
{'id': 2001, 'name': '银行', 'stock_count': 28}
]
},
{
'id': 21,
'name': '非银金融',
'code': '801210',
'description': '保险、证券、多元金融',
'stock_count': 45,
'avg_change': 0.8,
'total_market_cap': 2000000000000,
'sub_industries': [
{'id': 2101, 'name': '保险', 'stock_count': 8},
{'id': 2102, 'name': '证券', 'stock_count': 25},
{'id': 2103, 'name': '多元金融', 'stock_count': 12}
]
},
{
'id': 22,
'name': '综合',
'code': '801220',
'description': '综合',
'stock_count': 23,
'avg_change': 0.6,
'total_market_cap': 200000000000,
'sub_industries': [
{'id': 2201, 'name': '综合', 'stock_count': 23}
]
},
{
'id': 23,
'name': '计算机',
'code': '801230',
'description': '计算机设备、计算机应用',
'stock_count': 156,
'avg_change': 2.3,
'total_market_cap': 1800000000000,
'sub_industries': [
{'id': 2301, 'name': '计算机设备', 'stock_count': 45},
{'id': 2302, 'name': '计算机应用', 'stock_count': 111}
]
},
{
'id': 24,
'name': '传媒',
'code': '801240',
'description': '文化传媒、营销传播',
'stock_count': 78,
'avg_change': 1.4,
'total_market_cap': 700000000000,
'sub_industries': [
{'id': 2401, 'name': '文化传媒', 'stock_count': 45},
{'id': 2402, 'name': '营销传播', 'stock_count': 33}
]
},
{
'id': 25,
'name': '通信',
'code': '801250',
'description': '通信设备、通信运营',
'stock_count': 45,
'avg_change': 1.7,
'total_market_cap': 600000000000,
'sub_industries': [
{'id': 2501, 'name': '通信设备', 'stock_count': 30},
{'id': 2502, 'name': '通信运营', 'stock_count': 15}
]
},
{
'id': 26,
'name': '电子',
'code': '801260',
'description': '半导体、电子制造、光学光电子',
'stock_count': 178,
'avg_change': 2.0,
'total_market_cap': 2000000000000,
'sub_industries': [
{'id': 2601, 'name': '半导体', 'stock_count': 45},
{'id': 2602, 'name': '电子制造', 'stock_count': 78},
{'id': 2603, 'name': '光学光电子', 'stock_count': 55}
]
},
{
'id': 27,
'name': '机械设备',
'code': '801270',
'description': '通用机械、专用设备、仪器仪表',
'stock_count': 234,
'avg_change': 1.1,
'total_market_cap': 1500000000000,
'sub_industries': [
{'id': 2701, 'name': '通用机械', 'stock_count': 89},
{'id': 2702, 'name': '专用设备', 'stock_count': 98},
{'id': 2703, 'name': '仪器仪表', 'stock_count': 47}
]
},
{
'id': 28,
'name': '食品饮料',
'code': '801280',
'description': '食品加工、饮料制造',
'stock_count': 67,
'avg_change': 1.3,
'total_market_cap': 1000000000000,
'sub_industries': [
{'id': 2801, 'name': '食品加工', 'stock_count': 35},
{'id': 2802, 'name': '饮料制造', 'stock_count': 32}
]
}
]
return jsonify({
'success': True,
'data': levels
})
except Exception as e:
print(f"Error getting industry levels: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/info', methods=['GET'])
def get_industry_info():
"""获取行业信息"""
try:
industry_id = request.args.get('industry_id')
if not industry_id:
return jsonify({'success': False, 'error': '请提供行业ID'}), 400
# 模拟行业信息
industry_info = {
'id': industry_id,
'name': f'行业{industry_id}',
'code': f'801{industry_id.zfill(3)}',
'description': f'这是行业{industry_id}的详细描述',
'stock_count': 50,
'avg_change': 1.5,
'total_market_cap': 800000000000,
'pe_ratio': 15.6,
'pb_ratio': 2.3,
'roe': 8.5,
'top_stocks': [
{'code': '000001', 'name': '龙头股A', 'weight': 0.15},
{'code': '000002', 'name': '龙头股B', 'weight': 0.12},
{'code': '000003', 'name': '龙头股C', 'weight': 0.10}
],
'sub_industries': [
{'id': 1, 'name': '子行业A', 'stock_count': 20},
{'id': 2, 'name': '子行业B', 'stock_count': 18},
{'id': 3, 'name': '子行业C', 'stock_count': 12}
],
'performance': {
'daily': 1.5,
'weekly': 3.2,
'monthly': 8.5,
'quarterly': 12.3,
'yearly': 25.6
},
'trend': {
'direction': 'up',
'strength': 'medium',
'duration': '3 months'
}
}
return jsonify({
'success': True,
'data': industry_info
})
except Exception as e:
print(f"Error getting industry info: {e}")
return jsonify({'success': False, 'error': str(e)}), 500

469
app/routes/limitanalyse.py Normal file
View File

@@ -0,0 +1,469 @@
from flask import Blueprint, request, jsonify
import pandas as pd
import json
from datetime import datetime
bp = Blueprint('limitanalyse', __name__, url_prefix='/api/limit-analyse')
@bp.route('/available-dates', methods=['GET'])
def get_available_dates():
"""获取可用日期列表"""
try:
# 模拟可用日期
dates = [
'2025-07-16',
'2025-07-15',
'2025-07-14',
'2025-07-11',
'2025-07-10'
]
return jsonify({
'success': True,
'data': dates
})
except Exception as e:
print(f"Error getting available dates: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
def load_stock_data(datestr):
"""加载股票数据"""
try:
# 模拟股票数据
data = []
for i in range(100):
data.append({
'code': f'00000{i:03d}',
'name': f'股票{i}',
'price': 10.0 + i * 0.1,
'change': (i % 10 - 5) * 0.5,
'sector': f'板块{i % 5}',
'limit_type': '涨停' if i % 10 == 0 else '正常',
'volume': 1000000 + i * 50000,
'amount': 10000000 + i * 500000
})
return pd.DataFrame(data)
except Exception as e:
print(f"Error loading stock data: {e}")
return pd.DataFrame()
@bp.route('/data', methods=['GET'])
def get_analysis_data():
"""获取分析数据"""
try:
date = request.args.get('date', '2025-07-16')
# 加载数据
df = load_stock_data(date)
if df.empty:
return jsonify({'success': False, 'error': '数据加载失败'}), 500
# 统计信息
total_stocks = len(df)
limit_up_stocks = len(df[df['limit_type'] == '涨停'])
limit_down_stocks = len(df[df['limit_type'] == '跌停'])
# 板块统计
sector_stats = df.groupby('sector').agg({
'code': 'count',
'change': 'mean',
'volume': 'sum'
}).reset_index()
sector_data = []
for _, row in sector_stats.iterrows():
sector_data.append({
'sector': row['sector'],
'stock_count': int(row['code']),
'avg_change': round(row['change'], 2),
'total_volume': int(row['volume'])
})
return jsonify({
'success': True,
'data': {
'date': date,
'total_stocks': total_stocks,
'limit_up_stocks': limit_up_stocks,
'limit_down_stocks': limit_down_stocks,
'sector_stats': sector_data
}
})
except Exception as e:
print(f"Error getting analysis data: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/sector-data', methods=['GET'])
def get_sector_data():
"""获取板块数据"""
try:
date = request.args.get('date', '2025-07-16')
# 加载数据
df = load_stock_data(date)
if df.empty:
return jsonify({'success': False, 'error': '数据加载失败'}), 500
# 板块统计
sector_stats = df.groupby('sector').agg({
'code': 'count',
'change': 'mean',
'volume': 'sum',
'amount': 'sum'
}).reset_index()
sector_data = []
for _, row in sector_stats.iterrows():
sector_data.append({
'sector': row['sector'],
'stock_count': int(row['code']),
'avg_change': round(row['change'], 2),
'total_volume': int(row['volume']),
'total_amount': int(row['amount'])
})
return jsonify({
'success': True,
'data': sector_data
})
except Exception as e:
print(f"Error getting sector data: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/word-cloud', methods=['GET'])
def get_word_cloud_data():
"""获取词云数据"""
try:
date = request.args.get('date', '2025-07-16')
# 模拟词云数据
word_data = [
{'word': '科技', 'value': 100},
{'word': '新能源', 'value': 85},
{'word': '医药', 'value': 70},
{'word': '消费', 'value': 65},
{'word': '金融', 'value': 50},
{'word': '地产', 'value': 45},
{'word': '制造', 'value': 40},
{'word': '农业', 'value': 35},
{'word': '传媒', 'value': 30},
{'word': '环保', 'value': 25}
]
return jsonify({
'success': True,
'data': word_data
})
except Exception as e:
print(f"Error getting word cloud data: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/chart-data', methods=['GET'])
def get_chart_data():
"""获取图表数据"""
try:
date = request.args.get('date', '2025-07-16')
# 模拟图表数据
chart_data = {
'limit_up_distribution': [
{'sector': '科技', 'count': 15},
{'sector': '新能源', 'count': 12},
{'sector': '医药', 'count': 10},
{'sector': '消费', 'count': 8},
{'sector': '金融', 'count': 6}
],
'sector_performance': [
{'sector': '科技', 'change': 2.5},
{'sector': '新能源', 'change': 1.8},
{'sector': '医药', 'change': 1.2},
{'sector': '消费', 'change': 0.8},
{'sector': '金融', 'change': 0.5}
]
}
return jsonify({
'success': True,
'data': chart_data
})
except Exception as e:
print(f"Error getting chart data: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/stock-details', methods=['GET'])
def get_stock_details():
"""获取股票详情"""
try:
code = request.args.get('code')
date = request.args.get('date', '2025-07-16')
if not code:
return jsonify({'success': False, 'error': '请提供股票代码'}), 400
# 模拟股票详情
stock_detail = {
'code': code,
'name': f'股票{code}',
'price': 15.50,
'change': 2.5,
'sector': '科技',
'volume': 1500000,
'amount': 23250000,
'limit_type': '涨停',
'turnover_rate': 3.2,
'market_cap': 15500000000
}
return jsonify({
'success': True,
'data': stock_detail
})
except Exception as e:
print(f"Error getting stock details: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/sector-analysis', methods=['GET'])
def get_sector_analysis():
"""获取板块分析"""
try:
sector = request.args.get('sector')
date = request.args.get('date', '2025-07-16')
if not sector:
return jsonify({'success': False, 'error': '请提供板块名称'}), 400
# 模拟板块分析数据
sector_analysis = {
'sector': sector,
'stock_count': 25,
'avg_change': 1.8,
'limit_up_count': 8,
'limit_down_count': 2,
'total_volume': 50000000,
'total_amount': 750000000,
'top_stocks': [
{'code': '000001', 'name': '股票A', 'change': 10.0},
{'code': '000002', 'name': '股票B', 'change': 9.5},
{'code': '000003', 'name': '股票C', 'change': 8.8}
]
}
return jsonify({
'success': True,
'data': sector_analysis
})
except Exception as e:
print(f"Error getting sector analysis: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/trend-analysis', methods=['GET'])
def get_trend_analysis():
"""获取趋势分析"""
try:
date = request.args.get('date', '2025-07-16')
# 模拟趋势分析数据
trend_data = {
'limit_up_trend': [
{'date': '2025-07-10', 'count': 45},
{'date': '2025-07-11', 'count': 52},
{'date': '2025-07-14', 'count': 48},
{'date': '2025-07-15', 'count': 55},
{'date': '2025-07-16', 'count': 51}
],
'sector_trend': [
{'sector': '科技', 'trend': 'up'},
{'sector': '新能源', 'trend': 'up'},
{'sector': '医药', 'trend': 'stable'},
{'sector': '消费', 'trend': 'down'},
{'sector': '金融', 'trend': 'stable'}
]
}
return jsonify({
'success': True,
'data': trend_data
})
except Exception as e:
print(f"Error getting trend analysis: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/heat-map', methods=['GET'])
def get_heat_map_data():
"""获取热力图数据"""
try:
date = request.args.get('date', '2025-07-16')
# 模拟热力图数据
heat_map_data = []
sectors = ['科技', '新能源', '医药', '消费', '金融', '地产', '制造', '农业']
for i, sector in enumerate(sectors):
for j in range(8):
heat_map_data.append({
'sector': sector,
'metric': f'指标{j+1}',
'value': (i + j) % 10 + 1
})
return jsonify({
'success': True,
'data': heat_map_data
})
except Exception as e:
print(f"Error getting heat map data: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/correlation-analysis', methods=['GET'])
def get_correlation_analysis():
"""获取相关性分析"""
try:
date = request.args.get('date', '2025-07-16')
# 模拟相关性分析数据
correlation_data = {
'sector_correlations': [
{'sector1': '科技', 'sector2': '新能源', 'correlation': 0.85},
{'sector1': '医药', 'sector2': '消费', 'correlation': 0.72},
{'sector1': '金融', 'sector2': '地产', 'correlation': 0.68},
{'sector1': '科技', 'sector2': '医药', 'correlation': 0.45},
{'sector1': '新能源', 'sector2': '制造', 'correlation': 0.78}
],
'stock_correlations': [
{'stock1': '000001', 'stock2': '000002', 'correlation': 0.92},
{'stock1': '000003', 'stock2': '000004', 'correlation': 0.88},
{'stock1': '000005', 'stock2': '000006', 'correlation': 0.76}
]
}
return jsonify({
'success': True,
'data': correlation_data
})
except Exception as e:
print(f"Error getting correlation analysis: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/export-data', methods=['POST'])
def export_data():
"""导出数据"""
try:
data = request.get_json()
date = data.get('date', '2025-07-16')
export_type = data.get('type', 'excel')
# 模拟导出
filename = f'limit_analyse_{date}.{export_type}'
return jsonify({
'success': True,
'message': '数据导出成功',
'data': {
'filename': filename,
'download_url': f'/downloads/{filename}'
}
})
except Exception as e:
print(f"Error exporting data: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/high-position-stocks', methods=['GET'])
def get_high_position_stocks():
"""获取高位股统计数据"""
try:
date = request.args.get('date', datetime.now().strftime('%Y%m%d'))
# 模拟高位股数据 - 实际使用时需要连接真实的数据库
# 根据用户提供的表结构,查询连续涨停天数较多的股票
high_position_stocks = [
{
'stock_code': '000001',
'stock_name': '平安银行',
'price': 15.68,
'increase_rate': 10.02,
'limit_up_days': 5,
'continuous_limit_up': 3,
'industry': '银行',
'turnover_rate': 3.45,
'market_cap': 32000000000
},
{
'stock_code': '000002',
'stock_name': '万科A',
'price': 18.92,
'increase_rate': 9.98,
'limit_up_days': 4,
'continuous_limit_up': 2,
'industry': '房地产',
'turnover_rate': 5.67,
'market_cap': 21000000000
},
{
'stock_code': '600036',
'stock_name': '招商银行',
'price': 42.15,
'increase_rate': 8.45,
'limit_up_days': 6,
'continuous_limit_up': 4,
'industry': '银行',
'turnover_rate': 2.89,
'market_cap': 105000000000
},
{
'stock_code': '000858',
'stock_name': '五粮液',
'price': 168.50,
'increase_rate': 7.23,
'limit_up_days': 3,
'continuous_limit_up': 2,
'industry': '白酒',
'turnover_rate': 1.56,
'market_cap': 650000000000
},
{
'stock_code': '002415',
'stock_name': '海康威视',
'price': 35.68,
'increase_rate': 6.89,
'limit_up_days': 4,
'continuous_limit_up': 3,
'industry': '安防',
'turnover_rate': 4.12,
'market_cap': 33000000000
}
]
# 统计信息
total_count = len(high_position_stocks)
avg_continuous_days = sum(stock['continuous_limit_up'] for stock in high_position_stocks) / total_count if total_count > 0 else 0
# 按连续涨停天数排序
high_position_stocks.sort(key=lambda x: x['continuous_limit_up'], reverse=True)
return jsonify({
'success': True,
'data': {
'stocks': high_position_stocks,
'statistics': {
'total_count': total_count,
'avg_continuous_days': round(avg_continuous_days, 2),
'max_continuous_days': max([stock['continuous_limit_up'] for stock in high_position_stocks], default=0),
'industry_distribution': {}
}
}
})
except Exception as e:
print(f"Error getting high position stocks: {e}")
return jsonify({'success': False, 'error': str(e)}), 500

241
app/routes/stocks.py Normal file
View File

@@ -0,0 +1,241 @@
from flask import Blueprint, request, jsonify
from app import db
from clickhouse_driver import Client
import pandas as pd
from datetime import datetime, timedelta
import pytz
bp = Blueprint('stocks', __name__, url_prefix='/api/stock')
def get_clickhouse_client():
"""获取ClickHouse客户端"""
return Client('localhost', port=9000, user='default', password='', database='default')
@bp.route('/quotes', methods=['GET', 'POST'])
def get_stock_quotes():
"""获取股票实时报价"""
try:
if request.method == 'GET':
# GET 请求从 URL 参数获取数据
codes = request.args.get('codes', '').split(',')
event_time_str = request.args.get('event_time')
else:
# POST 请求从 JSON 获取数据
codes = request.json.get('codes', [])
event_time_str = request.json.get('event_time')
if not codes:
return jsonify({'success': False, 'error': '请提供股票代码'}), 400
# 过滤空字符串
codes = [code.strip() for code in codes if code.strip()]
if not codes:
return jsonify({'success': False, 'error': '请提供有效的股票代码'}), 400
# 解析事件时间
event_time = None
if event_time_str:
try:
event_time = datetime.fromisoformat(event_time_str.replace('Z', '+00:00'))
except ValueError:
return jsonify({'success': False, 'error': '事件时间格式错误'}), 400
# 获取当前时间
now = datetime.now(pytz.timezone('Asia/Shanghai'))
# 如果提供了事件时间,使用事件时间;否则使用当前时间
target_time = event_time if event_time else now
# 获取交易日和交易时间
def get_trading_day_and_times(event_datetime):
"""获取交易日和交易时间列表"""
# 这里简化处理,实际应该查询交易日历
trading_day = event_datetime.strftime('%Y-%m-%d')
# 生成交易时间列表 (9:30-11:30, 13:00-15:00)
morning_times = [f"{trading_day} {hour:02d}:{minute:02d}"
for hour in range(9, 12)
for minute in range(0, 60, 1)
if not (hour == 9 and minute < 30) and not (hour == 11 and minute > 30)]
afternoon_times = [f"{trading_day} {hour:02d}:{minute:02d}"
for hour in range(13, 16)
for minute in range(0, 60, 1)]
return trading_day, morning_times + afternoon_times
trading_day, trading_times = get_trading_day_and_times(target_time)
# 模拟股票数据
results = {}
for code in codes:
# 这里应该从ClickHouse或其他数据源获取真实数据
# 现在使用模拟数据
import random
base_price = 10.0 + random.random() * 20.0
change = (random.random() - 0.5) * 2.0
results[code] = {
'price': round(base_price, 2),
'change': round(change, 2),
'name': f'股票{code}'
}
return jsonify({
'success': True,
'data': results
})
except Exception as e:
print(f"Error getting stock quotes: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/<stock_code>/kline')
def get_stock_kline(stock_code):
"""获取股票K线数据"""
try:
chart_type = request.args.get('type', 'daily')
event_time_str = request.args.get('event_time')
if not event_time_str:
return jsonify({'success': False, 'error': '请提供事件时间'}), 400
try:
event_datetime = datetime.fromisoformat(event_time_str.replace('Z', '+00:00'))
except ValueError:
return jsonify({'success': False, 'error': '事件时间格式错误'}), 400
# 获取股票名称(这里简化处理)
stock_name = f'股票{stock_code}'
if chart_type == 'daily':
return get_daily_kline(stock_code, event_datetime, stock_name)
elif chart_type == 'minute':
return get_minute_kline(stock_code, event_datetime, stock_name)
elif chart_type == 'timeline':
return get_timeline_data(stock_code, event_datetime, stock_name)
else:
return jsonify({'error': f'Unsupported chart type: {chart_type}'}), 400
except Exception as e:
print(f"Error getting stock kline: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
def get_daily_kline(stock_code, event_datetime, stock_name):
"""获取日K线数据"""
try:
# 模拟日K线数据
data = []
base_price = 10.0
for i in range(30):
date = (event_datetime - timedelta(days=30-i)).strftime('%Y-%m-%d')
open_price = base_price + (i * 0.1) + (i % 3 - 1) * 0.5
close_price = open_price + (i % 5 - 2) * 0.3
high_price = max(open_price, close_price) + 0.2
low_price = min(open_price, close_price) - 0.2
volume = 1000000 + i * 50000
data.append({
'date': date,
'open': round(open_price, 2),
'close': round(close_price, 2),
'high': round(high_price, 2),
'low': round(low_price, 2),
'volume': volume
})
return jsonify({
'code': stock_code,
'name': stock_name,
'trade_date': event_datetime.strftime('%Y-%m-%d'),
'data': data
})
except Exception as e:
print(f"Error getting daily kline: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
def get_minute_kline(stock_code, event_datetime, stock_name):
"""获取分钟K线数据"""
try:
# 模拟分钟K线数据
data = []
base_price = 10.0
trading_times = []
# 生成交易时间
for hour in range(9, 16):
if hour == 12:
continue
for minute in range(0, 60):
if (hour == 9 and minute < 30) or (hour == 11 and minute > 30):
continue
trading_times.append(f"{hour:02d}:{minute:02d}")
for i, time in enumerate(trading_times):
open_price = base_price + (i * 0.01) + (i % 10 - 5) * 0.02
close_price = open_price + (i % 7 - 3) * 0.01
high_price = max(open_price, close_price) + 0.01
low_price = min(open_price, close_price) - 0.01
volume = 50000 + i * 1000
data.append({
'time': time,
'open': round(open_price, 2),
'close': round(close_price, 2),
'high': round(high_price, 2),
'low': round(low_price, 2),
'volume': volume
})
return jsonify({
'code': stock_code,
'name': stock_name,
'trade_date': event_datetime.strftime('%Y-%m-%d'),
'data': data
})
except Exception as e:
print(f"Error getting minute kline: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
def get_timeline_data(stock_code, event_datetime, stock_name):
"""获取分时图数据"""
try:
# 模拟分时图数据
data = []
base_price = 10.0
trading_times = []
# 生成交易时间
for hour in range(9, 16):
if hour == 12:
continue
for minute in range(0, 60):
if (hour == 9 and minute < 30) or (hour == 11 and minute > 30):
continue
trading_times.append(f"{hour:02d}:{minute:02d}")
for i, time in enumerate(trading_times):
price = base_price + (i * 0.01) + (i % 10 - 5) * 0.02
avg_price = price + (i % 5 - 2) * 0.01
volume = 50000 + i * 1000
data.append({
'time': time,
'price': round(price, 2),
'avg_price': round(avg_price, 2),
'volume': volume
})
return jsonify({
'code': stock_code,
'name': stock_name,
'trade_date': event_datetime.strftime('%Y-%m-%d'),
'data': data
})
except Exception as e:
print(f"Error getting timeline data: {e}")
return jsonify({'success': False, 'error': str(e)}), 500

BIN
certs/apiclient_cert.p12 Normal file

Binary file not shown.

25
certs/apiclient_cert.pem Normal file
View File

@@ -0,0 +1,25 @@
-----BEGIN CERTIFICATE-----
MIIEKDCCAxCgAwIBAgIUNltE7/qXxbotf9wJrhpJClsDclIwDQYJKoZIhvcNAQEL
BQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsT
FFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3Qg
Q0EwHhcNMjUwOTE0MDEwNTIzWhcNMzAwOTEzMDEwNTIzWjCBgTETMBEGA1UEAwwK
MTcxODU0MzgzMzEbMBkGA1UECgwS5b6u5L+h5ZWG5oi357O757ufMS0wKwYDVQQL
DCTljJfkuqzku7flgLzliY3msr/np5HmioDmnInpmZDlhazlj7gxCzAJBgNVBAYT
AkNOMREwDwYDVQQHDAhTaGVuWmhlbjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
AQoCggEBAJsoqKJXNLMTxhCCXkk2hxWdpLAWB2RWc8T6tjnj60Ch5AHQRBkIQ+1U
cJRc4IDVF9RPK/AezNFNy+7HatebJg0wFaANZW5rUYkfDhD09b/B+PcSsLhvGFPw
7uCUFpDi+2NJNNfAKCIolm7OCHY4YHQTrhKEapSH57nRuOjFCIsGeW8tA7HJSd0g
gEp2fPMMy+Ltxf1II+FZxFUvzc6uUO4Tl4150GVg8iVb4OA7QQPW0szVpYyRhwHz
aCT/F23UdqTBDDNtYUtFm9OzpjAZsSptaP6rM1dNnutFqoztXIefak4mp2WgG1KG
kn9xazjorWHExbNdXaincv+3PoMLOEUCAwEAAaOBuTCBtjAJBgNVHRMEAjAAMAsG
A1UdDwQEAwID+DCBmwYDVR0fBIGTMIGQMIGNoIGKoIGHhoGEaHR0cDovL2V2Y2Eu
aXRydXMuY29tLmNuL3B1YmxpYy9pdHJ1c2NybD9DQT0xQkQ0MjIwRTUwREJDMDRC
MDZBRDM5NzU0OTg0NkMwMUMzRThFQkQyJnNnPUhBQ0M0NzFCNjU0MjJFMTJCMjdB
OUQzM0E4N0FEMUNERjU5MjZFMTQwMzcxMA0GCSqGSIb3DQEBCwUAA4IBAQCj2nAZ
qJHfI34WDL5aMFCsHU03yf/DRCAUh4GPnQ+Ls24QS+paqutApoCse0C7nS0qBjIa
yAdxGZ27Y/N+OwlHgfDcmRyo0DFQ1HsDUPy6xlfbHimZ3SP5oTBDwzdq10h5u/HT
AKtaUoc2WxR03TOwL6tRksyoc5T7AsUyDAWAOjD8EM+bPhN6GxML3oojQe8t7eSj
MzJaXo+eFLx7Zptyeim0MfQ0j4NYvwExMWClnnlBTDQwXJpfa6p5HifEHBggGtv3
6ypuRbKp0m+R15HOkaG75S+PHAPJ0Tzn1RSpnOXj04oyI1GnEkOMD9YptAiFEYMA
JePvBigeMWes+IPQ
-----END CERTIFICATE-----

28
certs/apiclient_key.pem Normal file
View File

@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCbKKiiVzSzE8YQ
gl5JNocVnaSwFgdkVnPE+rY54+tAoeQB0EQZCEPtVHCUXOCA1RfUTyvwHszRTcvu
x2rXmyYNMBWgDWVua1GJHw4Q9PW/wfj3ErC4bxhT8O7glBaQ4vtjSTTXwCgiKJZu
zgh2OGB0E64ShGqUh+e50bjoxQiLBnlvLQOxyUndIIBKdnzzDMvi7cX9SCPhWcRV
L83OrlDuE5eNedBlYPIlW+DgO0ED1tLM1aWMkYcB82gk/xdt1HakwQwzbWFLRZvT
s6YwGbEqbWj+qzNXTZ7rRaqM7VyHn2pOJqdloBtShpJ/cWs46K1hxMWzXV2op3L/
tz6DCzhFAgMBAAECggEADr9Fj/CD9MVbXPRXK9Q/8KEEJyxg1XuWE1HVAhmUoZcB
id6Wql5rvmH5NVDCkdwvIKHJxk/XHcmsKWzQzd9UNYqtc4HycxVGMac++gOeW/R+
ylT/cPg2MrxCqBvLLUg1ppEtsZf0+JItAikZCst+92lrcR0e2DE2qCWz0oPvtO7p
tshtFjmvuI7DfuMsG9kPR5kTh+Xecwi0dZ6x4MHe5+/AbmZMqjieXq2DLjRunHHP
pe+99cgKb3W5W+XEK9wa3xxpHcQko+5TYdwp1XpTcE41jqocSosB76iAXbnhUd+F
JeP8+OWMBqXI3htIHQocVVs60lDghF+aXm9BQoDzQQKBgQDI0RekNYmq9IETCPJL
0CUvD9Qbky64hRat7pMQLzAJA2KlM+DQQcoxJ/baEe9GRldZymYaU+dJQUL5VsoT
lrNLXzhQTLQsBA59BDtzKUaGLojeVcW7fnGnCM6wp7OeXw51Rzk0Zihie2iQ7XFo
KJpY/d0GvGMkOpi6kH6IYRo+NQKBgQDFy6fPkvwuVLtfDOIkb6tGfdki6kSO34Xk
iRZUWivPlugAxOp0TUqyt3NVpMM2a3LkktafQXXAA1f/R+S03X0IyAzQXGBrZr0r
YPm2RIGsf8p9uBNA1Ly2zIqeuwH4hyO3sRvv0UsNNOkshbShCBO/4je3LL8CRBdn
GYwnNA6T0QKBgGADSJBkYIvyFvxo3J/Oxth3cuw0NLRYPX2vgXTNeuP0UGe4JBau
PeO+vdGJnaM14nG1yZdw4jYuE71u93LiLJsuzZfm9IXO8rZnHZ1z8JobCalzzPRW
AjTgiyH/LGvd+uWrxff9l/VuF5KjVAN+1j0SM2kTDTu3IGqixzyhYJC5AoGANcnC
IsKX7YmBQsHgJYRwkUTb7ZDDgA7s/E8DUYEL9PHWuY7TKzlxnNQieyHJLF1f6yS7
VKeae9Ls9TD50u2AeQjd4zObzNktjERc4+IRWXWO/U03fyPbBeLtt2inioxFfEif
jkHeJQNEfaUGj9wAcufzus5iSx11N8ZMxMR1SmECgYB3Z+8MY45PYhP457tW66/s
KIGG+yKI+tXYZmg3nYmEgjF4pO/dntZ4RpcxxxQsK2tNwYUfy9Nmn+iOmLbmxyWk
wcGjgS+wLz83EQK+gADuRU38TeODqZ09B7sYXJdA8Jva6vOvcAvOEqHkxe8yRXJa
gMhdtmbNsH3fbViBf72Plg==
-----END PRIVATE KEY-----

0
commit.sh Normal file
View File

1463
concept_api.py Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,146 @@
# 模拟盘最终修复总结
## 🎯 修复的问题
### 1. ✅ 编译错误修复
**问题**`Card` 组件重复导入
**解决**
- 移除了自定义 Card 组件的重复导入
- 统一使用 Chakra UI 的 Card 组件
- 保留必要的图表组件导入
### 2. ✅ 版面布局重新设计
**改进**
- **主要功能放在上面**:交易面板、持仓、历史、融资融券
- **统计数据放在下面**:账户概览、资产走势等分析图表
- **现代化标签页**:使用 emoji 图标和圆角设计
### 3. ✅ 真实数据替换Mock数据
**改进**
- **资产走势图**:使用真实的 `getAssetHistory` 数据
- **空数据处理**:当没有历史数据时显示友好提示
- **动态显示**:只在有数据时显示图表
### 4. ✅ 价格显示修复
**问题**:搜索股票时价格显示为 0.00
**解决**
- **后端修复**`search_stocks` 接口现在返回 `current_price`
- **前端修复**:正确使用 `stock.current_price` 而不是硬编码0
- **价格获取优化**:扩大查询范围,多重备选方案
## 🚀 新的页面结构
### 上半部分:主要功能
```
┌─────────────────────────────────────────┐
│ 💹 交易面板 | 📊 我的持仓 | 📋 交易历史 | 💰 融资融券 │
├─────────────────────────────────────────┤
│ │
│ 主要交易功能区域 │
│ │
└─────────────────────────────────────────┘
```
### 下半部分:统计分析
```
┌─────────────────────────────────────────┐
│ 📊 账户统计分析 │
│ ┌─────────────┐ ┌─────────────────┐ │
│ │ 资产卡片 │ │ 资产配置图 │ │
│ └─────────────┘ └─────────────────┘ │
└─────────────────────────────────────────┘
┌─────────────────────────────────────────┐
│ 📈 资产走势分析 │
│ (有数据时显示图表) │
│ (无数据时显示友好提示) │
└─────────────────────────────────────────┘
```
## 🔧 关键代码修改
### 1. 价格数据修复
**后端** (`app_2.py`):
```python
# search_stocks 接口现在返回价格
stocks.append({
'stock_code': row.stock_code,
'stock_name': row.stock_name,
'current_price': current_price or 0, # 添加真实价格
# ... 其他字段
})
```
**前端** (`TradingPanel.js`):
```javascript
// 使用真实价格而不是0
price: stock.current_price || 0, // 使用后端返回的真实价格
```
### 2. 真实数据处理
**主页面** (`index.js`):
```javascript
// 获取真实资产历史
const [assetHistory, setAssetHistory] = useState([]);
const { getAssetHistory } = useTradingAccount();
useEffect(() => {
if (account) {
getAssetHistory(30).then(data => {
setAssetHistory(data || []);
});
}
}, [account, getAssetHistory]);
// 只在有数据时显示图表
{hasAssetData && (
<LineChart chartData={assetTrendData} chartOptions={assetTrendOptions} />
)}
// 无数据时显示友好提示
{!hasAssetData && account && (
<VStack spacing={4} py={8}>
<Text fontSize="lg" color="gray.500">📊 暂无历史数据</Text>
<Text fontSize="sm" color="gray.400">
开始交易后这里将显示您的资产走势图表和详细统计分析
</Text>
</VStack>
)}
```
### 3. 现代化标签页设计
```javascript
<TabList bg={useColorModeValue('white', 'gray.800')} p={2} borderRadius="xl" shadow="sm">
<Tab fontWeight="bold">💹 交易面板</Tab>
<Tab fontWeight="bold">📊 我的持仓</Tab>
<Tab fontWeight="bold">📋 交易历史</Tab>
<Tab fontWeight="bold">💰 融资融券</Tab>
</TabList>
```
## 🎯 预期效果
### 搜索股票
- ✅ 显示真实价格(如:寒武纪 ¥1394.94
- ✅ 价格不再显示 0.00
- ✅ 搜索结果包含完整的股票信息
### 页面布局
- ✅ 主要功能优先显示(交易、持仓等)
- ✅ 统计分析放在下方(不干扰主要操作)
- ✅ 现代化的标签页设计
### 数据显示
- ✅ 使用真实的后端数据
- ✅ 优雅处理空数据情况
- ✅ 动态显示图表和提示
## 🚀 现在可以:
1. **重新编译**`npm run build` 应该成功
2. **重启服务**:让后端价格获取修改生效
3. **测试功能**
- 搜索股票应该显示真实价格
- 页面布局更加合理
- 空数据时有友好提示
所有问题都已修复,现在模拟盘应该可以正常显示价格数据了!🎉

76
gulpfile.js Normal file
View File

@@ -0,0 +1,76 @@
const gulp = require("gulp");
const gap = require("gulp-append-prepend");
gulp.task("licenses", async function () {
// this is to add Creative Tim licenses in the production mode for the minified js
gulp
.src("build/static/js/*chunk.js", { base: "./" })
.pipe(
gap.prependText(`/*!
=========================================================
* Argon Dashboard Chakra PRO - v1.0.0
=========================================================
* Product Page: https://www.creative-tim.com/product/argon-dashboard-chakra-pro
* Copyright 2022 Creative Tim (https://www.creative-tim.com/)
* Designed and Coded by Simmmple & Creative Tim
=========================================================
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/`)
)
.pipe(gulp.dest("./", { overwrite: true }));
// this is to add Creative Tim licenses in the production mode for the minified html
gulp
.src("build/index.html", { base: "./" })
.pipe(
gap.prependText(`<!--
/*!
=========================================================
* Argon Dashboard Chakra PRO - v1.0.0
=========================================================
* Product Page: https://www.creative-tim.com/product/argon-dashboard-chakra-pro
* Copyright 2022 Creative Tim (https://www.creative-tim.com/)
* Designed and Coded by Simmmple & Creative Tim
=========================================================
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/
-->`)
)
.pipe(gulp.dest("./", { overwrite: true }));
// this is to add Creative Tim licenses in the production mode for the minified css
gulp
.src("build/static/css/*chunk.css", { base: "./" })
.pipe(
gap.prependText(`/*!
=========================================================
* Argon Dashboard Chakra PRO - v1.0.0
=========================================================
* Product Page: https://www.creative-tim.com/product/argon-dashboard-chakra-pro
* Copyright 2022 Creative Tim (https://www.creative-tim.com/)
* Designed and Coded by Simmmple & Creative Tim
=========================================================
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/`)
)
.pipe(gulp.dest("./", { overwrite: true }));
return;
});

8
jsconfig.json Normal file
View File

@@ -0,0 +1,8 @@
{
"compilerOptions": {
"baseUrl": "src",
"paths": {
"*": ["src/*"]
}
}
}

105
package.json Normal file
View File

@@ -0,0 +1,105 @@
{
"name": "argon-dashboard-chakra-pro",
"version": "2.0.0",
"private": true,
"homepage": "https://demos.creative-tim.com/argon-dashboard-chakra-pro/#/",
"dependencies": {
"@ant-design/icons": "^6.0.0",
"@asseinfo/react-kanban": "^2.2.0",
"@chakra-ui/icons": "^2.1.1",
"@chakra-ui/react": "^2.8.2",
"@chakra-ui/theme-tools": "^1.3.6",
"@emotion/cache": "^11.4.0",
"@emotion/react": "^11.4.0",
"@emotion/styled": "^11.3.0",
"@fontsource/open-sans": "^4.5.0",
"@fontsource/raleway": "^4.5.0",
"@fontsource/roboto": "^4.5.0",
"@fullcalendar/daygrid": "^5.9.0",
"@fullcalendar/interaction": "^5.9.0",
"@fullcalendar/react": "^5.9.0",
"@visx/visx": "^3.12.0",
"antd": "^5.26.4",
"apexcharts": "^3.27.3",
"axios": "^1.10.0",
"classnames": "2.3.1",
"date-fns": "^2.23.0",
"draft-js": "^0.11.7",
"echarts": "^5.6.0",
"echarts-for-react": "^3.0.2",
"echarts-wordcloud": "^2.1.0",
"framer-motion": "^4.1.17",
"fullcalendar": "^5.9.0",
"globalize": "^1.7.0",
"leaflet": "^1.9.4",
"match-sorter": "6.3.0",
"moment": "^2.29.1",
"nouislider": "15.0.0",
"react": "18.3.1",
"react-apexcharts": "^1.3.9",
"react-big-calendar": "^0.33.2",
"react-bootstrap-sweetalert": "5.2.0",
"react-circular-slider-svg": "^0.1.5",
"react-custom-scrollbars-2": "^4.4.0",
"react-datetime": "^3.0.4",
"react-dom": "^18.3.1",
"react-dropzone": "^11.4.2",
"react-github-btn": "^1.2.1",
"react-icons": "^4.2.0",
"react-input-pin-code": "^1.1.5",
"react-jvectormap": "0.0.16",
"react-leaflet": "^3.2.5",
"react-markdown": "^10.1.0",
"react-quill": "^2.0.0-beta.4",
"react-router-dom": "^6.4.0",
"react-scripts": "^5.0.1",
"react-scroll": "^1.8.4",
"react-swipeable-views": "0.13.9",
"react-table": "^7.7.0",
"react-tagsinput": "3.19.0",
"react-to-print": "^2.13.0",
"sass": "^1.49.9",
"styled-components": "^5.3.11",
"stylis": "^4.0.10",
"stylis-plugin-rtl": "^2.1.1",
"three": "0.109.0"
},
"resolutions": {
"react-error-overlay": "6.0.9",
"@types/react": "18.2.0",
"@types/react-dom": "18.2.0"
},
"proxy": "http://localhost:5001",
"scripts": {
"start": "react-scripts --openssl-legacy-provider start",
"build": "react-scripts build && gulp licenses",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"deploy": "npm run build",
"lint:check": "eslint . --ext=js,jsx; exit 0",
"lint:fix": "eslint . --ext=js,jsx --fix; exit 0",
"install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install && npm start"
},
"devDependencies": {
"ajv": "^8.17.1",
"autoprefixer": "^10.4.21",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-prettier": "3.4.0",
"gulp": "4.0.2",
"gulp-append-prepend": "1.0.9",
"prettier": "2.2.1",
"react-error-overlay": "6.0.9"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
">0.2%",
"not dead",
"not op_mini all"
]
}
}

6
postcss.config.js Normal file
View File

@@ -0,0 +1,6 @@
module.exports = {
plugins: [
require('tailwindcss'),
require('autoprefixer'),
],
}

BIN
public/apple-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
public/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,10 @@
<svg preserveAspectRatio="none" width="384" height="366" viewBox="0 0 384 366" fill="none" xmlns="http://www.w3.org/2000/svg">
<path vector-effect="non-scaling-stroke" d="M32 1H319.453C328.037 1 336.238 4.5601 342.1 10.832L374.648 45.6545C380.015 51.3966 383 58.9629 383 66.8225V334C383 351.121 369.121 365 352 365H32C14.8792 365 1 351.121 1 334V32C1 14.8792 14.8792 1 32 1Z" stroke="white" stroke-opacity="0.15" stroke-width="2"/>
<path vector-effect="non-scaling-stroke" d="M32 1H319.453C328.037 1 336.238 4.5601 342.1 10.832L374.648 45.6545C380.015 51.3966 383 58.9629 383 66.8225V334C383 351.121 369.121 365 352 365H32C14.8792 365 1 351.121 1 334V32C1 14.8792 14.8792 1 32 1Z" stroke="url(#paint0_linear_333_9188)" stroke-opacity="0.85" stroke-width="2"/>
<defs>
<linearGradient id="paint0_linear_333_9188" x1="192" y1="0" x2="192" y2="366" gradientUnits="userSpaceOnUse">
<stop stop-color="#33CEFF"/>
<stop offset="0.562842" stop-color="#D633FF" stop-opacity="0"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1003 B

View File

@@ -0,0 +1,10 @@
<svg preserveAspectRatio="none" width="384" height="366" viewBox="0 0 384 366" fill="none" xmlns="http://www.w3.org/2000/svg">
<path vector-effect="non-scaling-stroke" d="M32 1H319.453C328.037 1 336.238 4.5601 342.1 10.832L374.648 45.6545C380.015 51.3966 383 58.9629 383 66.8225V334C383 351.121 369.121 365 352 365H32C14.8792 365 1 351.121 1 334V32C1 14.8792 14.8792 1 32 1Z" stroke="white" stroke-opacity="0.15" stroke-width="2"/>
<path vector-effect="non-scaling-stroke" d="M32 1H319.453C328.037 1 336.238 4.5601 342.1 10.832L374.648 45.6545C380.015 51.3966 383 58.9629 383 66.8225V334C383 351.121 369.121 365 352 365H32C14.8792 365 1 351.121 1 334V32C1 14.8792 14.8792 1 32 1Z" stroke="url(#paint0_linear_333_9186)" stroke-opacity="0.85" stroke-width="2"/>
<defs>
<linearGradient id="paint0_linear_333_9186" x1="192" y1="0" x2="192" y2="366" gradientUnits="userSpaceOnUse">
<stop stop-color="#FFC876"/>
<stop offset="0.562842" stop-color="#D633FF" stop-opacity="0"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1003 B

View File

@@ -0,0 +1,10 @@
<svg preserveAspectRatio="none" width="384" height="366" viewBox="0 0 384 366" fill="none" xmlns="http://www.w3.org/2000/svg">
<path vector-effect="non-scaling-stroke" d="M32 1H319.453C328.037 1 336.238 4.5601 342.1 10.832L374.648 45.6545C380.015 51.3966 383 58.9629 383 66.8225V334C383 351.121 369.121 365 352 365H32C14.8792 365 1 351.121 1 334V32C1 14.8792 14.8792 1 32 1Z" stroke="white" stroke-opacity="0.15" stroke-width="2"/>
<path vector-effect="non-scaling-stroke" d="M32 1H319.453C328.037 1 336.238 4.5601 342.1 10.832L374.648 45.6545C380.015 51.3966 383 58.9629 383 66.8225V334C383 351.121 369.121 365 352 365H32C14.8792 365 1 351.121 1 334V32C1 14.8792 14.8792 1 32 1Z" stroke="url(#paint0_linear_333_9185)" stroke-opacity="0.85" stroke-width="2"/>
<defs>
<linearGradient id="paint0_linear_333_9185" x1="192" y1="0" x2="192" y2="366" gradientUnits="userSpaceOnUse">
<stop stop-color="#D77DEE"/>
<stop offset="0.562842" stop-color="#D633FF" stop-opacity="0"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1003 B

View File

@@ -0,0 +1,10 @@
<svg preserveAspectRatio="none" width="384" height="366" viewBox="0 0 384 366" fill="none" xmlns="http://www.w3.org/2000/svg">
<path vector-effect="non-scaling-stroke" d="M32 1H319.453C328.037 1 336.238 4.5601 342.1 10.832L374.648 45.6545C380.015 51.3966 383 58.9629 383 66.8225V334C383 351.121 369.121 365 352 365H32C14.8792 365 1 351.121 1 334V32C1 14.8792 14.8792 1 32 1Z" stroke="white" stroke-opacity="0.15" stroke-width="2"/>
<path vector-effect="non-scaling-stroke" d="M32 1H319.453C328.037 1 336.238 4.5601 342.1 10.832L374.648 45.6545C380.015 51.3966 383 58.9629 383 66.8225V334C383 351.121 369.121 365 352 365H32C14.8792 365 1 351.121 1 334V32C1 14.8792 14.8792 1 32 1Z" stroke="url(#paint0_linear_333_9187)" stroke-opacity="0.85" stroke-width="2"/>
<defs>
<linearGradient id="paint0_linear_333_9187" x1="192" y1="0" x2="192" y2="366" gradientUnits="userSpaceOnUse">
<stop stop-color="#B6EE7D"/>
<stop offset="0.562842" stop-color="#FF3F33" stop-opacity="0"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1003 B

View File

@@ -0,0 +1,10 @@
<svg preserveAspectRatio="none" width="384" height="366" viewBox="0 0 384 366" fill="none" xmlns="http://www.w3.org/2000/svg">
<path vector-effect="non-scaling-stroke" d="M32 1H319.453C328.037 1 336.238 4.5601 342.1 10.832L374.648 45.6545C380.015 51.3966 383 58.9629 383 66.8225V334C383 351.121 369.121 365 352 365H32C14.8792 365 1 351.121 1 334V32C1 14.8792 14.8792 1 32 1Z" stroke="white" stroke-opacity="0.15" stroke-width="2"/>
<path vector-effect="non-scaling-stroke" d="M32 1H319.453C328.037 1 336.238 4.5601 342.1 10.832L374.648 45.6545C380.015 51.3966 383 58.9629 383 66.8225V334C383 351.121 369.121 365 352 365H32C14.8792 365 1 351.121 1 334V32C1 14.8792 14.8792 1 32 1Z" stroke="url(#paint0_linear_333_9184)" stroke-opacity="0.85" stroke-width="2"/>
<defs>
<linearGradient id="paint0_linear_333_9184" x1="192" y1="0" x2="192" y2="366" gradientUnits="userSpaceOnUse">
<stop stop-color="#EE917D"/>
<stop offset="0.562842" stop-color="#FF3333" stop-opacity="0"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1003 B

View File

@@ -0,0 +1,10 @@
<svg preserveAspectRatio="none" width="384" height="366" viewBox="0 0 384 366" fill="none" xmlns="http://www.w3.org/2000/svg">
<path vector-effect="non-scaling-stroke" d="M32 1H319.453C328.037 1 336.238 4.5601 342.1 10.832L374.648 45.6545C380.015 51.3966 383 58.9629 383 66.8225V334C383 351.121 369.121 365 352 365H32C14.8792 365 1 351.121 1 334V32C1 14.8792 14.8792 1 32 1Z" stroke="white" stroke-opacity="0.15" stroke-width="2"/>
<path vector-effect="non-scaling-stroke" d="M32 1H319.453C328.037 1 336.238 4.5601 342.1 10.832L374.648 45.6545C380.015 51.3966 383 58.9629 383 66.8225V334C383 351.121 369.121 365 352 365H32C14.8792 365 1 351.121 1 334V32C1 14.8792 14.8792 1 32 1Z" stroke="url(#paint0_linear_333_9183)" stroke-opacity="0.85" stroke-width="2"/>
<defs>
<linearGradient id="paint0_linear_333_9183" x1="192" y1="0" x2="192" y2="366" gradientUnits="userSpaceOnUse">
<stop stop-color="#7D96EE"/>
<stop offset="0.562842" stop-color="#FF33EB" stop-opacity="0"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1003 B

View File

@@ -0,0 +1,4 @@
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="48" height="48" rx="12" fill="#AC6AFF"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M15 21.4V29.2747C15 31.1327 15 32.0617 15.3646 32.484C15.6809 32.8503 16.1545 33.0415 16.6364 32.9975C17.1921 32.9468 17.8371 32.2782 19.1272 30.9411L20.0563 29.9781C20.4043 29.6174 20.5783 29.4371 20.7832 29.3079C20.9648 29.1935 21.1637 29.109 21.3722 29.0578C21.6073 29 21.8579 29 22.3592 29H26.6C28.8402 29 29.9603 29 30.816 28.564C31.5686 28.1805 32.1805 27.5686 32.564 26.816C33 25.9603 33 24.8402 33 22.6V21.4C33 19.1598 33 18.0397 32.564 17.184C32.1805 16.4314 31.5686 15.8195 30.816 15.436C29.9603 15 28.8402 15 26.6 15H21.4C19.1598 15 18.0397 15 17.184 15.436C16.4314 15.8195 15.8195 16.4314 15.436 17.184C15 18.0397 15 19.1598 15 21.4ZM20 23C20.5523 23 21 22.5523 21 22C21 21.4477 20.5523 21 20 21C19.4477 21 19 21.4477 19 22C19 22.5523 19.4477 23 20 23ZM25 22C25 22.5523 24.5523 23 24 23C23.4477 23 23 22.5523 23 22C23 21.4477 23.4477 21 24 21C24.5523 21 25 21.4477 25 22ZM28 23C28.5523 23 29 22.5523 29 22C29 21.4477 28.5523 21 28 21C27.4477 21 27 21.4477 27 22C27 22.5523 27.4477 23 28 23Z" fill="#0E0C15"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,4 @@
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="48" height="48" rx="12" fill="#FFC876"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M30 33H18C16.3432 33 15 31.6569 15 30V18C15 16.3432 16.3432 15 18 15H30C31.6569 15 33 16.3432 33 18V30C33 31.6569 31.6569 33 30 33ZM29 20.4142L24.4142 25H26C26.5523 25 27 25.4477 27 26C27 26.5523 26.5523 27 26 27H22C21.4477 27 21 26.5523 21 26V22C21 21.4477 21.4477 21 22 21C22.5523 21 23 21.4477 23 22V23.5858L27.5858 19H26C25.4477 19 25 18.5523 25 18C25 17.4477 25.4477 17 26 17H30C30.5523 17 31 17.4477 31 18V22C31 22.5523 30.5523 23 30 23C29.4477 23 29 22.5523 29 22V20.4142Z" fill="#0E0C15"/>
</svg>

After

Width:  |  Height:  |  Size: 704 B

View File

@@ -0,0 +1,7 @@
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="48" height="48" rx="12" fill="#7ADB78"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M31 29.5C31 28.6716 30.3284 28 29.5 28H20C17.2386 28 15 25.7614 15 23C15 20.2386 17.2386 18 20 18H23V20H20C18.3432 20 17 21.3432 17 23C17 24.6569 18.3432 26 20 26H29.5C31.433 26 33 27.567 33 29.5C33 31.433 31.433 33 29.5 33H16C15.4477 33 15 32.5523 15 32C15 31.4477 15.4477 31 16 31H29.5C30.3284 31 31 30.3284 31 29.5Z" fill="#0E0C15"/>
<path d="M32 16H28V18H32C32.5523 18 33 17.5523 33 17C33 16.4477 32.5523 16 32 16Z" fill="#0E0C15"/>
<path d="M32 20H28V22H32C32.5523 22 33 21.5523 33 21C33 20.4477 32.5523 20 32 20Z" fill="#0E0C15"/>
<path d="M21 19C21 16.7909 22.7909 15 25 15H29C29.5523 15 30 15.4477 30 16V22C30 22.5523 29.5523 23 29 23H25C22.7909 23 21 21.2091 21 19Z" fill="#0E0C15"/>
</svg>

After

Width:  |  Height:  |  Size: 899 B

View File

@@ -0,0 +1,7 @@
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="48" height="48" rx="12" fill="#FF776F"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M31 29.5C31 28.6716 30.3284 28 29.5 28H20C17.2386 28 15 25.7614 15 23C15 20.2386 17.2386 18 20 18H23V20H20C18.3432 20 17 21.3432 17 23C17 24.6569 18.3432 26 20 26H29.5C31.433 26 33 27.567 33 29.5C33 31.433 31.433 33 29.5 33H16C15.4477 33 15 32.5523 15 32C15 31.4477 15.4477 31 16 31H29.5C30.3284 31 31 30.3284 31 29.5Z" fill="#0E0C15"/>
<path d="M32 16H28V18H32C32.5523 18 33 17.5523 33 17C33 16.4477 32.5523 16 32 16Z" fill="#0E0C15"/>
<path d="M32 20H28V22H32C32.5523 22 33 21.5523 33 21C33 20.4477 32.5523 20 32 20Z" fill="#0E0C15"/>
<path d="M21 19C21 16.7909 22.7909 15 25 15H29C29.5523 15 30 15.4477 30 16V22C30 22.5523 29.5523 23 29 23H25C22.7909 23 21 21.2091 21 19Z" fill="#0E0C15"/>
</svg>

After

Width:  |  Height:  |  Size: 899 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><polygon fill="#FFFFFF" points="38.831 15.118 38.823 9.905 29.203 3.617 29.203 7.639 35.548 11.817 35.553 15.019 32.605 17.015 30.594 15.548 30.594 13.063 27.317 10.821 27.317 15.344 22.122 18.532 22.113 26.952 18.44 29.02 16.554 27.543 16.554 25.105 18.786 23.576 18.786 23.556 18.786 19.783 14.769 22.471 11.698 20.473 8.893 22.31 13.277 25.311 13.277 27.154 10.117 29.291 6.894 27.109 6.894 19.848 11.679 16.608 11.684 13.492 17.82 17.445 22.978 14.011 19.834 12.177 17.776 13.564 13.294 10.6 18.349 7.654 22.727 10.22 22.727 6.393 18.354 3.828 8.411 9.625 8.404 14.84 3.617 18.082 3.617 28.874 8.404 32.116 8.411 37.332 18.032 43.617 18.032 39.598 11.686 35.42 11.681 32.218 14.629 30.222 16.64 31.689 16.64 34.174 19.917 36.416 19.917 31.892 25.186 28.705 25.245 20.285 28.795 18.217 30.68 19.694 30.68 22.131 28.448 23.661 28.448 23.68 28.448 27.454 32.465 24.765 35.536 26.764 38.341 24.927 33.958 21.923 33.958 20.083 37.117 17.946 40.34 20.128 40.34 27.389 35.556 30.629 35.551 33.744 29.414 29.79 24.256 33.201 27.401 35.033 29.459 33.672 33.941 36.636 28.886 39.583 24.507 37.016 24.507 40.842 28.881 43.406 38.823 37.612 38.831 32.396 43.617 29.154 43.617 18.361"/></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><polygon fill="#AC6AFF" points="38.831 15.118 38.823 9.905 29.203 3.617 29.203 7.639 35.548 11.817 35.553 15.019 32.605 17.015 30.594 15.548 30.594 13.063 27.317 10.821 27.317 15.344 22.122 18.532 22.113 26.952 18.44 29.02 16.554 27.543 16.554 25.105 18.786 23.576 18.786 23.556 18.786 19.783 14.769 22.471 11.698 20.473 8.893 22.31 13.277 25.311 13.277 27.154 10.117 29.291 6.894 27.109 6.894 19.848 11.679 16.608 11.684 13.492 17.82 17.445 22.978 14.011 19.834 12.177 17.776 13.564 13.294 10.6 18.349 7.654 22.727 10.22 22.727 6.393 18.354 3.828 8.411 9.625 8.404 14.84 3.617 18.082 3.617 28.874 8.404 32.116 8.411 37.332 18.032 43.617 18.032 39.598 11.686 35.42 11.681 32.218 14.629 30.222 16.64 31.689 16.64 34.174 19.917 36.416 19.917 31.892 25.186 28.705 25.245 20.285 28.795 18.217 30.68 19.694 30.68 22.131 28.448 23.661 28.448 23.68 28.448 27.454 32.465 24.765 35.536 26.764 38.341 24.927 33.958 21.923 33.958 20.083 37.117 17.946 40.34 20.128 40.34 27.389 35.556 30.629 35.551 33.744 29.414 29.79 24.256 33.201 27.401 35.033 29.459 33.672 33.941 36.636 28.886 39.583 24.507 37.016 24.507 40.842 28.881 43.406 38.823 37.612 38.831 32.396 43.617 29.154 43.617 18.361"/></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

@@ -0,0 +1,4 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="24" height="24" rx="12" fill="#FFC876"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.8047 7.52925C18.0651 7.7896 18.0651 8.21171 17.8047 8.47206L10.4714 15.8054C10.2111 16.0657 9.78894 16.0657 9.5286 15.8054L6.19526 12.4721C5.93491 12.2117 5.93491 11.7896 6.19526 11.5292C6.45561 11.2689 6.87772 11.2689 7.13807 11.5292L10 14.3912L16.8619 7.52925C17.1223 7.2689 17.5444 7.2689 17.8047 7.52925Z" fill="#0E0C15"/>
</svg>

After

Width:  |  Height:  |  Size: 537 B

4
public/images/check.svg Normal file
View File

@@ -0,0 +1,4 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="24" height="24" rx="12" fill="#AC6AFF"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.8047 7.52925C18.0651 7.7896 18.0651 8.21171 17.8047 8.47206L10.4714 15.8054C10.2111 16.0657 9.78894 16.0657 9.5286 15.8054L6.19526 12.4721C5.93491 12.2117 5.93491 11.7896 6.19526 11.5292C6.45561 11.2689 6.87772 11.2689 7.13807 11.5292L10 14.3912L16.8619 7.52925C17.1223 7.2689 17.5444 7.2689 17.8047 7.52925Z" fill="#0E0C15"/>
</svg>

After

Width:  |  Height:  |  Size: 537 B

View File

@@ -0,0 +1,3 @@
<svg width="522" height="182" viewBox="0 0 522 182" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0.333333 179C0.333333 180.473 1.52724 181.667 3 181.667C4.47276 181.667 5.66667 180.473 5.66667 179C5.66667 177.527 4.47276 176.333 3 176.333C1.52724 176.333 0.333333 177.527 0.333333 179ZM517 3.5L522 5.88675V0.113249L517 2.5V3.5ZM3 179.5H131.782V178.5H3V179.5ZM212.282 99V83H211.282V99H212.282ZM291.782 3.5H517.5V2.5H291.782V3.5ZM212.282 83C212.282 39.0934 247.875 3.5 291.782 3.5V2.5C247.323 2.5 211.282 38.5411 211.282 83H212.282ZM131.782 179.5C176.241 179.5 212.282 143.459 212.282 99H211.282C211.282 142.907 175.688 178.5 131.782 178.5V179.5Z" fill="#252134"/>
</svg>

After

Width:  |  Height:  |  Size: 683 B

View File

@@ -0,0 +1,3 @@
<svg width="162" height="76" viewBox="0 0 162 76" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0.333333 3C0.333333 1.52724 1.52724 0.333336 3 0.333336C4.47276 0.333336 5.66667 1.52724 5.66667 3C5.66667 4.47276 4.47276 5.66666 3 5.66666C1.52724 5.66666 0.333333 4.47276 0.333333 3ZM157 72.5L162 70.1132V75.8868L157 73.5V72.5ZM84.5606 38C84.5606 36.5272 85.7545 35.3333 87.2272 35.3333C88.7 35.3333 89.8939 36.5272 89.8939 38C89.8939 39.4728 88.7 40.6667 87.2272 40.6667C85.7545 40.6667 84.5606 39.4728 84.5606 38ZM3 2.5H52.2273V3.5H3V2.5ZM122.227 72.5H157.5V73.5H122.227V72.5ZM87.7272 38C87.7272 57.0538 103.173 72.5 122.227 72.5V73.5C102.621 73.5 86.7272 57.6061 86.7272 38H87.7272ZM52.2273 2.5C71.8334 2.5 87.7272 18.3939 87.7272 38H86.7272C86.7272 18.9462 71.2811 3.5 52.2273 3.5V2.5Z" fill="#252134"/>
</svg>

After

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

BIN
public/images/curve.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

BIN
public/images/figures/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 KiB

BIN
public/images/figures/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 507 KiB

BIN
public/images/figures/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

BIN
public/images/figures/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 KiB

BIN
public/images/figures/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 KiB

BIN
public/images/figures/6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 KiB

BIN
public/images/gradient.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

BIN
public/images/grid.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
public/images/help/help.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 918 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 795 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1017 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 KiB

Some files were not shown because too many files have changed in this diff Show More