- 重构数据访问层:引入DAO模式,支持MySQL/SQLite双数据库 - 新增数据库架构:完整的股票数据、AI分析、自选股管理表结构 - 升级AI分析服务:集成豆包大模型,支持多维度分析 - 优化API路由:分离市场数据API,提供更清晰的接口设计 - 完善项目文档:添加数据库迁移指南、新功能指南等 - 清理冗余文件:删除旧的缓存文件和无用配置 - 新增调度器:支持定时任务和数据自动更新 - 改进前端模板:简化的股票展示页面 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
28 lines
699 B
Python
28 lines
699 B
Python
from fastapi import FastAPI
|
|
from fastapi.staticfiles import StaticFiles
|
|
from fastapi.templating import Jinja2Templates
|
|
import tushare as ts
|
|
from app.config import Config
|
|
|
|
# 确保必要的目录和文件存在
|
|
Config.ensure_directories()
|
|
|
|
# 创建FastAPI实例
|
|
app = FastAPI()
|
|
|
|
# 设置tushare token
|
|
ts.set_token(Config.TUSHARE_TOKEN)
|
|
pro = ts.pro_api()
|
|
|
|
|
|
# Mount static files
|
|
app.mount("/static", StaticFiles(directory=Config.STATIC_DIR), name="static")
|
|
|
|
# Set up templates
|
|
templates = Jinja2Templates(directory=Config.TEMPLATES_DIR)
|
|
|
|
# 导入路由
|
|
from app.api import stock_routes
|
|
from app.api import market_routes
|
|
app.include_router(stock_routes.router)
|
|
app.include_router(market_routes.router) |