{ "schema_version": 1, "diagram_type": "architecture", "meta": { "title": "A股量化研究平台 · 系统架构", "quality_profile": "showcase", "viewBox": [1360, 660], "views": [ { "id": "main-chain", "label": "主研究链", "focus": ["web-ui", "api", "services", "domain", "sqlite", "parquet"], "note": "从 Web UI 经 Research Specification 到持久化的业务主链。" }, { "id": "quant-path", "label": "量化引擎链路", "focus": ["services", "qlib-adapter", "qlib"], "note": "Qlib 只经 Adapter 被调用,业务层不直接 import qlib。" }, { "id": "source-path", "label": "数据源链路", "focus": ["tushare", "sina", "services"], "note": "Tushare 首选,新浪仅作缺失兜底与交叉验证。" } ] }, "components": [ { "id": "web-ui", "type": "frontend", "label": "Web UI", "sublabel": "Next.js · Lightweight Charts", "pos": [460, 16], "size": [320, 64] }, { "id": "api", "type": "backend", "label": "FastAPI API", "sublabel": "Pydantic DTO · REST / SSE", "pos": [460, 118], "size": [320, 64] }, { "id": "services", "type": "backend", "label": "Application Services", "sublabel": "数据 / 因子 / 策略 / 回测 / 实验", "pos": [400, 232], "size": [440, 108] }, { "id": "domain", "type": "backend", "label": "Domain · Repository", "sublabel": "实体 + Protocol(禁 SQL)", "pos": [460, 392], "size": [320, 80] }, { "id": "agent", "type": "backend", "label": "Agent Service", "sublabel": "AI 助手 · 受控 Tool", "pos": [30, 40], "size": [240, 62] }, { "id": "tushare", "type": "external", "label": "Tushare", "sublabel": "日线 / 财务 / 日历(首选)", "pos": [30, 232], "size": [240, 64] }, { "id": "sina", "type": "external", "label": "新浪财经", "sublabel": "兜底 / 交叉验证(备用)", "pos": [30, 390], "size": [240, 64] }, { "id": "qlib-adapter", "type": "backend", "label": "Quant · Qlib Adapter", "sublabel": "Dataset / 训练 / 回测封装", "pos": [1010, 232], "size": [290, 72] }, { "id": "qlib", "type": "external", "label": "Qlib 引擎", "sublabel": "LightGBM / 回测(不改源码)", "pos": [1010, 400], "size": [290, 68] }, { "id": "sqlite", "type": "database", "label": "SQLite", "sublabel": "元数据 / 实验 / Job", "pos": [330, 532], "size": [240, 64] }, { "id": "parquet", "type": "database", "label": "Parquet · Qlib Dataset", "sublabel": "行情 / 财务 / 特征", "pos": [750, 532], "size": [260, 64] } ], "connections": [ { "id": "req-rest", "from": "web-ui", "to": "api", "label": "REST / SSE", "labelAt": [620, 94] }, { "id": "to-spec", "from": "api", "to": "services", "label": "Research Specification", "variant": "emphasis", "labelAt": [620, 196] }, { "id": "to-domain", "from": "services", "to": "domain", "label": "Repository Protocol · 编排", "labelAt": [620, 366] }, { "id": "domain-sqlite", "from": "domain", "to": "sqlite", "label": "元数据 / 实验", "fromSide": "bottom", "toSide": "top" }, { "id": "domain-parquet", "from": "domain", "to": "parquet", "label": "时序 / 特征", "fromSide": "bottom", "toSide": "top" }, { "id": "fetch-tushare", "from": "tushare", "to": "services", "label": "行情 / 财务(首选)", "variant": "emphasis", "labelAt": [250, 318] }, { "id": "fallback-sina", "from": "sina", "to": "services", "label": "兜底(缺失)", "variant": "dashed" }, { "id": "to-adapter", "from": "services", "to": "qlib-adapter", "label": "因子 / 回测 Job", "variant": "emphasis" }, { "id": "adapter-qlib", "from": "qlib-adapter", "to": "qlib", "label": "Dataset / 训练 / 回测", "fromSide": "bottom", "toSide": "top", "labelAt": [1155, 318] }, { "id": "agent-tools", "from": "agent", "to": "services", "label": "受控 Tool(Phase 5)", "variant": "dashed" } ], "cards": [ { "dot": "emerald", "title": "主研究链", "items": [ "Web UI → API(Research Specification DTO)→ 服务编排 → Repository → SQLite / Parquet", "Qlib 仅经 Qlib Adapter 调用,业务层不直接 import qlib" ] }, { "dot": "violet", "title": "数据源与边界纪律", "items": [ "Tushare 首选,新浪兜底须经统一 Provider 并记录来源,禁止静默切换", "业务层禁 SQL / Session 直连;Agent 仅走受控 Tool(Phase 5)" ] }, { "dot": "amber", "title": "异步与可复现", "items": [ "因子 / 训练 / 回测为异步 Job:queued → running → success / failed / cancelled", "所有研究落 Experiment,含数据与代码版本,可一键复跑" ] } ] }